@@ -316,7 +316,12 @@ ucs_status_t mca_btl_uct_am_handler (void *arg, void *data, size_t length, unsig
316
316
return UCS_OK ;
317
317
}
318
318
319
+ #if UCT_API > UCT_VERSION (1 , 7 )
320
+ static int mca_btl_uct_component_process_uct_md (uct_component_h component , uct_md_resource_desc_t * md_desc ,
321
+ char * * allowed_ifaces )
322
+ #else
319
323
static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t * md_desc , char * * allowed_ifaces )
324
+ #endif
320
325
{
321
326
mca_rcache_base_resources_t rcache_resources ;
322
327
uct_tl_resource_desc_t * tl_desc ;
@@ -350,8 +355,14 @@ static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t *md_desc
350
355
351
356
md = OBJ_NEW (mca_btl_uct_md_t );
352
357
358
+
359
+ #if UCT_API > UCT_VERSION (1 , 7 )
360
+ uct_md_config_read (component , NULL , NULL , & uct_config );
361
+ uct_md_open (component , md_desc -> md_name , uct_config , & md -> uct_md );
362
+ #else
353
363
uct_md_config_read (md_desc -> md_name , NULL , NULL , & uct_config );
354
364
uct_md_open (md_desc -> md_name , uct_config , & md -> uct_md );
365
+ #endif
355
366
uct_config_release (uct_config );
356
367
357
368
uct_md_query (md -> uct_md , & md_attr );
@@ -377,6 +388,10 @@ static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t *md_desc
377
388
return OPAL_ERR_NOT_AVAILABLE ;
378
389
}
379
390
391
+ #if UCT_API > UCT_VERSION (1 , 7 )
392
+ module -> uct_component = component ;
393
+ #endif
394
+
380
395
mca_btl_uct_component .modules [mca_btl_uct_component .module_count ++ ] = module ;
381
396
382
397
/* NTH: a registration cache shouldn't be necessary when using UCT but there are measurable
@@ -402,6 +417,42 @@ static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t *md_desc
402
417
return OPAL_SUCCESS ;
403
418
}
404
419
420
+ #if UCT_API > UCT_VERSION (1 , 7 )
421
+ static int mca_btl_uct_component_process_uct_component (uct_component_h component , char * * allowed_ifaces )
422
+ {
423
+ uct_component_attr_t attr = {.field_mask = UCT_COMPONENT_ATTR_FIELD_NAME |
424
+ UCT_COMPONENT_ATTR_FIELD_MD_RESOURCE_COUNT };
425
+ ucs_status_t ucs_status ;
426
+ int rc ;
427
+
428
+ ucs_status = uct_component_query (component , & attr );
429
+ if (UCS_OK != ucs_status ) {
430
+ return OPAL_ERROR ;
431
+ }
432
+
433
+ BTL_VERBOSE (("processing uct component %s" , attr .name ));
434
+
435
+ attr .md_resources = calloc (attr .md_resource_count , sizeof (* attr .md_resources ));
436
+ attr .field_mask |= UCT_COMPONENT_ATTR_FIELD_MD_RESOURCES ;
437
+ ucs_status = uct_component_query (component , & attr );
438
+ if (UCS_OK != ucs_status ) {
439
+ return OPAL_ERROR ;
440
+ }
441
+
442
+ for (int i = 0 ; i < attr .md_resource_count ; ++ i ) {
443
+ rc = mca_btl_uct_component_process_uct_md (component , attr .md_resources + i ,
444
+ allowed_ifaces );
445
+ if (OPAL_SUCCESS != rc ) {
446
+ break ;
447
+ }
448
+ }
449
+
450
+ free (attr .md_resources );
451
+
452
+ return OPAL_SUCCESS ;
453
+ }
454
+ #endif /* UCT_API > UCT_VERSION(1, 7) */
455
+
405
456
/*
406
457
* UCT component initialization:
407
458
* (1) read interface list from kernel and compare against component parameters
@@ -417,6 +468,7 @@ static mca_btl_base_module_t **mca_btl_uct_component_init (int *num_btl_modules,
417
468
struct mca_btl_base_module_t * * base_modules ;
418
469
uct_md_resource_desc_t * resources ;
419
470
unsigned resource_count ;
471
+ ucs_status_t ucs_status ;
420
472
char * * allowed_ifaces ;
421
473
int rc ;
422
474
@@ -433,10 +485,32 @@ static mca_btl_base_module_t **mca_btl_uct_component_init (int *num_btl_modules,
433
485
return NULL ;
434
486
}
435
487
436
- uct_query_md_resources (& resources , & resource_count );
437
-
438
488
mca_btl_uct_component .module_count = 0 ;
439
489
490
+ #if UCT_API > UCT_VERSION (1 , 7 )
491
+ uct_component_h * components ;
492
+ unsigned num_components ;
493
+
494
+ ucs_status = uct_query_components (& components , & num_components );
495
+ if (UCS_OK != ucs_status ) {
496
+ BTL_ERROR (("could not query UCT components" ));
497
+ return NULL ;
498
+ }
499
+
500
+ /* generate all suitable btl modules */
501
+ for (unsigned i = 0 ; i < num_components ; ++ i ) {
502
+ rc = mca_btl_uct_component_process_uct_component (components [i ], allowed_ifaces );
503
+ if (OPAL_SUCCESS != rc ) {
504
+ break ;
505
+ }
506
+ }
507
+
508
+ uct_release_component_list (components );
509
+
510
+ #else /* UCT 1.6 and older */
511
+
512
+ uct_query_md_resources (& resources , & resource_count );
513
+
440
514
/* generate all suitable btl modules */
441
515
for (unsigned i = 0 ; i < resource_count ; ++ i ) {
442
516
rc = mca_btl_uct_component_process_uct_md (resources + i , allowed_ifaces );
@@ -445,9 +519,11 @@ static mca_btl_base_module_t **mca_btl_uct_component_init (int *num_btl_modules,
445
519
}
446
520
}
447
521
448
- opal_argv_free (allowed_ifaces );
449
522
uct_release_md_resource_list (resources );
450
523
524
+ #endif /* UCT_API > UCT_VERSION(1, 7) */
525
+
526
+ opal_argv_free (allowed_ifaces );
451
527
mca_btl_uct_modex_send ();
452
528
453
529
/* pass module array back to caller */
0 commit comments