@@ -40,6 +40,7 @@ opal_common_ofi_module_t opal_common_ofi = {.prov_include = NULL,
40
40
.output = -1 };
41
41
static const char default_prov_exclude_list [] = "shm,sockets,tcp,udp,rstream,usnic" ;
42
42
static opal_mutex_t opal_common_ofi_mutex = OPAL_MUTEX_STATIC_INIT ;
43
+ static int opal_common_ofi_verbose_level = 0 ;
43
44
static int opal_common_ofi_init_ref_cnt = 0 ;
44
45
#ifdef HAVE_STRUCT_FI_OPS_MEM_MONITOR
45
46
static bool opal_common_ofi_installed_memory_monitor = false;
@@ -264,20 +265,18 @@ int opal_common_ofi_is_in_list(char **list, char *item)
264
265
265
266
int opal_common_ofi_mca_register (const mca_base_component_t * component )
266
267
{
267
- static int include_index ;
268
- static int exclude_index ;
269
- static int verbose_index ;
270
- int verbose ;
271
- int param ;
268
+ static int include_index = -1 ;
269
+ static int exclude_index = -1 ;
270
+ static int verbose_index = -1 ;
271
+ int ret ;
272
272
273
273
if (fi_version () < FI_VERSION (1 , 0 )) {
274
274
return OPAL_ERROR ;
275
275
}
276
276
277
277
OPAL_THREAD_LOCK (& opal_common_ofi_mutex );
278
278
279
- param = mca_base_var_find ("opal" , "opal_common" , "ofi" , "provider_include" );
280
- if (0 > param ) {
279
+ if (0 > include_index ) {
281
280
/*
282
281
* this monkey business is needed because of the way the MCA VARs stuff tries to handle
283
282
* pointers to strings when when destructing the MCA var database. If you don't do
@@ -296,12 +295,13 @@ int opal_common_ofi_mca_register(const mca_base_component_t *component)
296
295
"exclusive with mtl_ofi_provider_exclude." ,
297
296
MCA_BASE_VAR_TYPE_STRING , NULL , 0 , 0 , OPAL_INFO_LVL_1 , MCA_BASE_VAR_SCOPE_READONLY ,
298
297
opal_common_ofi .prov_include );
299
- } else {
300
- include_index = param ;
298
+ if (0 > include_index ) {
299
+ ret = include_index ;
300
+ goto err ;
301
+ }
301
302
}
302
303
303
- param = mca_base_var_find ("opal" , "opal_common" , "ofi" , "provider_exclude" );
304
- if (0 > param ) {
304
+ if (0 > exclude_index ) {
305
305
if (NULL == opal_common_ofi .prov_exclude ) {
306
306
opal_common_ofi .prov_exclude = (char * * ) malloc (sizeof (char * ));
307
307
assert (NULL != opal_common_ofi .prov_exclude );
@@ -314,42 +314,73 @@ int opal_common_ofi_mca_register(const mca_base_component_t *component)
314
314
"exclusive with mtl_ofi_provider_include." ,
315
315
MCA_BASE_VAR_TYPE_STRING , NULL , 0 , 0 , OPAL_INFO_LVL_1 , MCA_BASE_VAR_SCOPE_READONLY ,
316
316
opal_common_ofi .prov_exclude );
317
- } else {
318
- exclude_index = param ;
317
+ if (0 > exclude_index ) {
318
+ ret = exclude_index ;
319
+ goto err ;
320
+ }
319
321
}
320
322
321
- param = mca_base_var_find ("opal" , "opal_common" , "ofi" , "verbose" );
322
- if (0 > param ) {
323
+ if (0 > verbose_index ) {
323
324
verbose_index = mca_base_var_register ("opal" , "opal_common" , "ofi" , "verbose" ,
324
325
"Verbose level of the OFI components" ,
325
326
MCA_BASE_VAR_TYPE_INT , NULL , 0 ,
326
327
MCA_BASE_VAR_FLAG_SETTABLE , OPAL_INFO_LVL_3 ,
327
328
MCA_BASE_VAR_SCOPE_LOCAL ,
328
- & verbose );
329
- } else {
330
- verbose_index = param ;
329
+ & opal_common_ofi_verbose_level );
330
+ if (0 > verbose_index ) {
331
+ ret = verbose_index ;
332
+ goto err ;
333
+ }
331
334
}
332
335
333
336
if (component ) {
334
- mca_base_var_register_synonym (include_index , component -> mca_project_name ,
335
- component -> mca_type_name , component -> mca_component_name ,
336
- "provider_include" , 0 );
337
- mca_base_var_register_synonym (exclude_index , component -> mca_project_name ,
338
- component -> mca_type_name , component -> mca_component_name ,
339
- "provider_exclude" , 0 );
340
- mca_base_var_register_synonym (verbose_index , component -> mca_project_name ,
341
- component -> mca_type_name , component -> mca_component_name ,
342
- "verbose" , 0 );
337
+ ret = mca_base_var_register_synonym (include_index ,
338
+ component -> mca_project_name ,
339
+ component -> mca_type_name ,
340
+ component -> mca_component_name ,
341
+ "provider_include" , 0 );
342
+ if (0 > ret ) {
343
+ goto err ;
344
+ }
345
+ ret = mca_base_var_register_synonym (exclude_index ,
346
+ component -> mca_project_name ,
347
+ component -> mca_type_name ,
348
+ component -> mca_component_name ,
349
+ "provider_exclude" , 0 );
350
+ if (0 > ret ) {
351
+ goto err ;
352
+ }
353
+ ret = mca_base_var_register_synonym (verbose_index ,
354
+ component -> mca_project_name ,
355
+ component -> mca_type_name ,
356
+ component -> mca_component_name ,
357
+ "verbose" , 0 );
358
+ if (0 > ret ) {
359
+ goto err ;
360
+ }
343
361
}
344
362
363
+ /* The frameworks initialize their output streams during
364
+ * register(), so we similarly try to initialize the output stream
365
+ * as early as possible. Because we may register synonyms for
366
+ * each dependent component, we don't necessarily have all the
367
+ * data to set verbosity during the first call to
368
+ * common_ofi_register(). The MCA infrastructure has rules on
369
+ * synonym value evaluation, so our rubric is to re-set verbosity
370
+ * after every call to register() (which has registered a new
371
+ * synonym). This is not perfect, but it's not horrible, either.
372
+ */
345
373
if (opal_common_ofi .output == -1 ) {
346
374
opal_common_ofi .output = opal_output_open (NULL );
347
- opal_output_set_verbosity (opal_common_ofi .output , verbose );
348
375
}
376
+ opal_output_set_verbosity (opal_common_ofi .output , opal_common_ofi_verbose_level );
377
+
378
+ ret = OPAL_SUCCESS ;
349
379
380
+ err :
350
381
OPAL_THREAD_UNLOCK (& opal_common_ofi_mutex );
351
382
352
- return OPAL_SUCCESS ;
383
+ return ret ;
353
384
}
354
385
355
386
/* check that the tx attributes match */
0 commit comments