@@ -38,6 +38,8 @@ opal_common_ucx_module_t opal_common_ucx =
38
38
{
39
39
.progress_iterations = 100 ,
40
40
.opal_mem_hooks = 1 ,
41
+ .tls = NULL ,
42
+ .devices = NULL ,
41
43
};
42
44
43
45
static opal_mutex_t opal_common_ucx_mutex = OPAL_MUTEX_STATIC_INIT ;
@@ -80,28 +82,38 @@ OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *
80
82
& opal_common_ucx .opal_mem_hooks );
81
83
82
84
if (NULL == opal_common_ucx .tls ) {
83
- opal_common_ucx .tls = default_tls ;
85
+ // Extra level of string indirection needed to make ompi_info
86
+ // happy since it will unload this library before the MCA base
87
+ // cleans up the MCA vars. This will cause the string to go
88
+ // out of scope unless we place the pointer to it on the heap.
89
+ opal_common_ucx .tls = (char * * ) malloc (sizeof (char * ));
90
+ * opal_common_ucx .tls = strdup (default_tls );
84
91
}
85
92
86
- tls_index = mca_base_var_register (
87
- "opal" , "opal_common" , "ucx" , "tls" ,
93
+ tls_index = mca_base_component_var_register (
94
+ component , "tls" ,
88
95
"List of UCX transports which should be supported on the system, to enable "
89
96
"selecting the UCX component. Special values: any (any available). "
90
97
"A '^' prefix negates the list. "
91
98
"For example, in order to exclude on shared memory and TCP transports, "
92
99
"please set to '^posix,sysv,self,tcp,cma,knem,xpmem'." ,
93
- MCA_BASE_VAR_TYPE_STRING , NULL , 0 , 0 , OPAL_INFO_LVL_3 , MCA_BASE_VAR_SCOPE_LOCAL ,
94
- & opal_common_ucx .tls );
100
+ MCA_BASE_VAR_TYPE_STRING , NULL , 0 ,
101
+ MCA_BASE_VAR_FLAG_SETTABLE , OPAL_INFO_LVL_3 ,
102
+ MCA_BASE_VAR_SCOPE_LOCAL ,
103
+ opal_common_ucx .tls );
95
104
96
105
if (NULL == opal_common_ucx .devices ) {
97
- opal_common_ucx .devices = default_devices ;
106
+ opal_common_ucx .devices = (char * * ) malloc (sizeof (char * ));
107
+ * opal_common_ucx .devices = strdup (default_devices );
98
108
}
99
- devices_index = mca_base_var_register (
100
- "opal" , "opal_common" , "ucx" , "devices" ,
109
+ devices_index = mca_base_component_var_register (
110
+ component , "devices" ,
101
111
"List of device driver pattern names, which, if supported by UCX, will "
102
112
"bump its priority above ob1. Special values: any (any available)" ,
103
- MCA_BASE_VAR_TYPE_STRING , NULL , 0 , 0 , OPAL_INFO_LVL_3 , MCA_BASE_VAR_SCOPE_LOCAL ,
104
- & opal_common_ucx .devices );
113
+ MCA_BASE_VAR_TYPE_STRING , NULL , 0 ,
114
+ MCA_BASE_VAR_FLAG_SETTABLE , OPAL_INFO_LVL_3 ,
115
+ MCA_BASE_VAR_SCOPE_LOCAL ,
116
+ opal_common_ucx .devices );
105
117
106
118
if (component ) {
107
119
mca_base_var_register_synonym (verbose_index , component -> mca_project_name ,
@@ -233,8 +245,8 @@ OPAL_DECLSPEC opal_common_ucx_support_level_t opal_common_ucx_support_level(ucp_
233
245
int ret ;
234
246
#endif
235
247
236
- is_any_tl = !strcmp (opal_common_ucx .tls , "any" );
237
- is_any_device = !strcmp (opal_common_ucx .devices , "any" );
248
+ is_any_tl = !strcmp (* opal_common_ucx .tls , "any" );
249
+ is_any_device = !strcmp (* opal_common_ucx .devices , "any" );
238
250
239
251
/* Check for special value "any" */
240
252
if (is_any_tl && is_any_device ) {
@@ -245,19 +257,19 @@ OPAL_DECLSPEC opal_common_ucx_support_level_t opal_common_ucx_support_level(ucp_
245
257
246
258
#if HAVE_DECL_OPEN_MEMSTREAM
247
259
/* Split transports list */
248
- negate = ('^' == (opal_common_ucx .tls )[0 ]);
249
- tl_list = opal_argv_split (opal_common_ucx .tls + (negate ? 1 : 0 ), ',' );
260
+ negate = ('^' == (* opal_common_ucx .tls )[0 ]);
261
+ tl_list = opal_argv_split (* opal_common_ucx .tls + (negate ? 1 : 0 ), ',' );
250
262
if (tl_list == NULL ) {
251
263
MCA_COMMON_UCX_VERBOSE (1 , "failed to split tl list '%s', ucx is disabled" ,
252
- opal_common_ucx .tls );
264
+ * opal_common_ucx .tls );
253
265
goto out ;
254
266
}
255
267
256
268
/* Split devices list */
257
- device_list = opal_argv_split (opal_common_ucx .devices , ',' );
269
+ device_list = opal_argv_split (* opal_common_ucx .devices , ',' );
258
270
if (device_list == NULL ) {
259
271
MCA_COMMON_UCX_VERBOSE (1 , "failed to split devices list '%s', ucx is disabled" ,
260
- opal_common_ucx .devices );
272
+ * opal_common_ucx .devices );
261
273
goto out_free_tl_list ;
262
274
}
263
275
0 commit comments