@@ -1338,7 +1338,7 @@ struct fi_info *assign_nic_with_hwloc(struct fi_info *fabric, struct fi_info **p
1338
1338
int ret = 0 ;
1339
1339
hwloc_bitmap_t bindset = hwloc_bitmap_alloc ();
1340
1340
1341
- ret = hwloc_get_proc_last_cpu_location (shmem_topology , getpid (), bindset , HWLOC_CPUBIND_PROCESS );
1341
+ ret = hwloc_get_proc_last_cpu_location (shmem_internal_topology , getpid (), bindset , HWLOC_CPUBIND_PROCESS );
1342
1342
if (ret < 0 ) {
1343
1343
RAISE_ERROR_MSG ("hwloc_get_proc_last_cpu_location failed (%s)\n" , strerror (errno ));
1344
1344
}
@@ -1352,10 +1352,16 @@ struct fi_info *assign_nic_with_hwloc(struct fi_info *fabric, struct fi_info **p
1352
1352
if (cur_prov -> nic -> bus_attr -> bus_type != FI_BUS_PCI ) continue ;
1353
1353
1354
1354
struct fi_pci_attr pci = cur_prov -> nic -> bus_attr -> attr .pci ;
1355
- hwloc_obj_t io_device = hwloc_get_pcidev_by_busid (shmem_topology , pci .domain_id , pci .bus_id , pci .device_id , pci .function_id );
1356
- if (!io_device ) RAISE_ERROR_MSG ("hwloc_get_pcidev_by_busid failed\n" );
1357
- hwloc_obj_t first_non_io = hwloc_get_non_io_ancestor_obj (shmem_topology , io_device );
1358
- if (!first_non_io ) RAISE_ERROR_MSG ("hwloc_get_non_io_ancestor_obj failed\n" );
1355
+ hwloc_obj_t io_device = hwloc_get_pcidev_by_busid (shmem_internal_topology , pci .domain_id , pci .bus_id , pci .device_id , pci .function_id );
1356
+ if (!io_device ) {
1357
+ RAISE_WARN_MSG ("hwloc_get_pcidev_by_busid failed\n" );
1358
+ return provs [shmem_internal_my_pe % num_nics ];
1359
+ };
1360
+ hwloc_obj_t first_non_io = hwloc_get_non_io_ancestor_obj (shmem_internal_topology , io_device );
1361
+ if (!first_non_io ) {
1362
+ RAISE_WARN_MSG ("hwloc_get_non_io_ancestor_obj failed\n" );
1363
+ return provs [shmem_internal_my_pe % num_nics ];
1364
+ }
1359
1365
1360
1366
if (hwloc_bitmap_isincluded (bindset , first_non_io -> cpuset ) ||
1361
1367
hwloc_bitmap_isincluded (first_non_io -> cpuset , bindset )) {
@@ -1372,7 +1378,6 @@ struct fi_info *assign_nic_with_hwloc(struct fi_info *fabric, struct fi_info **p
1372
1378
RAISE_WARN_MSG ("Could not detect any NICs with affinity to the process\n" );
1373
1379
1374
1380
/* If no 'close' NICs, select from list of all NICs using round-robin assignment */
1375
- //return provs[shmem_team_my_pe(SHMEMX_TEAM_NODE) % num_nics];
1376
1381
return provs [shmem_internal_my_pe % num_nics ];
1377
1382
}
1378
1383
@@ -1386,7 +1391,6 @@ struct fi_info *assign_nic_with_hwloc(struct fi_info *fabric, struct fi_info **p
1386
1391
1387
1392
hwloc_bitmap_free (bindset );
1388
1393
1389
- //struct fi_info *provider = prov_list[shmem_team_my_pe(SHMEMX_TEAM_NODE) % num_close_nics];
1390
1394
struct fi_info * provider = prov_list [shmem_internal_my_pe % num_close_nics ];
1391
1395
free (prov_list );
1392
1396
@@ -1512,7 +1516,8 @@ int query_for_fabric(struct fabric_info *info)
1512
1516
info -> prov_name != NULL ? info -> prov_name : "<auto>" );
1513
1517
1514
1518
/* If the user supplied a fabric or domain name, use it to select the
1515
- * fabric. Otherwise, select the first fabric in the list. */
1519
+ * fabrics that may be chosen. Otherwise, consider all available
1520
+ * fabrics */
1516
1521
int num_nics = 0 ;
1517
1522
struct fi_info * fallback = NULL ;
1518
1523
struct fi_info * filtered_fabrics_list_head = NULL ;
@@ -1544,38 +1549,41 @@ int query_for_fabric(struct fabric_info *info)
1544
1549
1545
1550
info -> p_info = NULL ;
1546
1551
1547
- for (cur_fabric = filtered_fabrics_list_head ; cur_fabric ; cur_fabric = cur_fabric -> next ) {
1548
- if (!fallback ) fallback = cur_fabric ;
1549
- if (cur_fabric -> nic && !nic_already_used (cur_fabric -> nic , multirail_fabric_list_head , num_nics )) {
1550
- num_nics += 1 ;
1551
- if (!multirail_fabric_list_head ) multirail_fabric_list_head = cur_fabric ;
1552
- if (multirail_fabric_last_added ) multirail_fabric_last_added -> next = cur_fabric ;
1553
- multirail_fabric_last_added = cur_fabric ;
1554
- }
1555
- }
1556
-
1557
- DEBUG_MSG ("Total num. NICs detected: %d\n" , num_nics );
1558
- if ((num_nics == 0 ) || (shmem_internal_params .DISABLE_MULTIRAIL )) {
1559
- info -> p_info = fallback ;
1552
+ if (shmem_internal_params .DISABLE_MULTIRAIL ) {
1553
+ info -> p_info = filtered_fabrics_list_head ;
1560
1554
}
1561
1555
else {
1562
- int idx = 0 ;
1563
- struct fi_info * * prov_list = (struct fi_info * * ) malloc (num_nics * sizeof (struct fi_info * ));
1564
- for (cur_fabric = multirail_fabric_list_head ; cur_fabric ; cur_fabric = cur_fabric -> next ) {
1565
- prov_list [idx ++ ] = cur_fabric ;
1556
+ /* Generate a linked list of all fabrics with a non-null nic value */
1557
+ for (cur_fabric = filtered_fabrics_list_head ; cur_fabric ; cur_fabric = cur_fabric -> next ) {
1558
+ if (!fallback ) fallback = cur_fabric ;
1559
+ if (cur_fabric -> nic && !nic_already_used (cur_fabric -> nic , multirail_fabric_list_head , num_nics )) {
1560
+ num_nics += 1 ;
1561
+ if (!multirail_fabric_list_head ) multirail_fabric_list_head = cur_fabric ;
1562
+ if (multirail_fabric_last_added ) multirail_fabric_last_added -> next = cur_fabric ;
1563
+ multirail_fabric_last_added = cur_fabric ;
1564
+ }
1566
1565
}
1567
- qsort (prov_list , num_nics , sizeof (struct fi_info * ), compare_nic_names );
1568
- //DEBUG_MSG("[%d]: local_pe = %d\n", shmem_internal_my_pe, shmem_team_my_pe(SHMEMX_TEAM_NODE));
1566
+
1567
+ DEBUG_MSG ("Total num. NICs detected: %d\n" , num_nics );
1568
+ if (num_nics == 0 ) {
1569
+ info -> p_info = fallback ;
1570
+ }
1571
+ else {
1572
+ int idx = 0 ;
1573
+ struct fi_info * * prov_list = (struct fi_info * * ) malloc (num_nics * sizeof (struct fi_info * ));
1574
+ for (cur_fabric = multirail_fabric_list_head ; cur_fabric ; cur_fabric = cur_fabric -> next ) {
1575
+ prov_list [idx ++ ] = cur_fabric ;
1576
+ }
1577
+ qsort (prov_list , num_nics , sizeof (struct fi_info * ), compare_nic_names );
1569
1578
#ifdef USE_HWLOC
1570
- info -> p_info = assign_nic_with_hwloc (info -> p_info , prov_list , num_nics );
1579
+ info -> p_info = assign_nic_with_hwloc (info -> p_info , prov_list , num_nics );
1571
1580
#else
1572
- /* Round-robin assignment of NICs to PEs */
1573
- //info->p_info = prov_list[shmem_team_my_pe(SHMEMX_TEAM_NODE) % num_nics];
1574
- info -> p_info = prov_list [shmem_internal_my_pe % num_nics ];
1581
+ /* Round-robin assignment of NICs to PEs */
1582
+ info -> p_info = prov_list [shmem_internal_my_pe % num_nics ];
1575
1583
#endif
1576
- free (prov_list );
1584
+ free (prov_list );
1585
+ }
1577
1586
}
1578
-
1579
1587
if (NULL == info -> p_info ) {
1580
1588
RAISE_WARN_MSG ("OFI transport, no valid fabric (prov=%s, fabric=%s, domain=%s)\n" ,
1581
1589
info -> prov_name != NULL ? info -> prov_name : "<auto>" ,
0 commit comments