Skip to content

Commit cdb631d

Browse files
authored
Merge pull request #10758 from jjhursey/fix-ucx-reg-segv
osc/ucx: Move the ucx_mca_register/deregister to open/close
2 parents 4b327e5 + 1d50132 commit cdb631d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

ompi/mca/osc/ucx/osc_ucx_component.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright (c) 2021 Triad National Security, LLC. All rights
55
* reserved.
66
*
7+
* Copyright (c) 2022 IBM Corporation. All rights reserved.
78
* $COPYRIGHT$
89
*
910
* Additional copyrights may follow
@@ -44,6 +45,7 @@ static void _osc_ucx_init_unlock(void)
4445

4546

4647
static int component_open(void);
48+
static int component_close(void);
4749
static int component_register(void);
4850
static int component_init(bool enable_progress_threads, bool enable_mpi_threads);
4951
static int component_finalize(void);
@@ -62,6 +64,7 @@ ompi_osc_ucx_component_t mca_osc_ucx_component = {
6264
MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
6365
OMPI_RELEASE_VERSION),
6466
.mca_open_component = component_open,
67+
.mca_close_component = component_close,
6568
.mca_register_component_params = component_register,
6669
},
6770
.osc_data = {
@@ -143,6 +146,14 @@ static bool check_config_value_bool (char *key, opal_info_t *info)
143146
}
144147

145148
static int component_open(void) {
149+
opal_common_ucx_mca_register();
150+
151+
return OMPI_SUCCESS;
152+
}
153+
154+
static int component_close(void) {
155+
opal_common_ucx_mca_deregister();
156+
146157
return OMPI_SUCCESS;
147158
}
148159

@@ -253,7 +264,6 @@ static int component_init(bool enable_progress_threads, bool enable_mpi_threads)
253264

254265
mca_osc_ucx_component.enable_mpi_threads = enable_mpi_threads;
255266
mca_osc_ucx_component.wpool = opal_common_ucx_wpool_allocate();
256-
opal_common_ucx_mca_register();
257267

258268
ret = ucp_context_init(enable_mpi_threads, ompi_proc_world_size());
259269
if (OMPI_ERROR == ret) {
@@ -286,7 +296,7 @@ static int component_init(bool enable_progress_threads, bool enable_mpi_threads)
286296
}
287297

288298
static int component_finalize(void) {
289-
opal_common_ucx_mca_deregister();
299+
290300
if (mca_osc_ucx_component.env_initialized) {
291301
opal_common_ucx_wpool_finalize(mca_osc_ucx_component.wpool);
292302
}

0 commit comments

Comments
 (0)