Provide an error when there are no NICs on a system (#286)

This commit is contained in:
Yiltan
2025-10-20 13:07:56 -04:00
committed by GitHub
orang tua c44f4ece1f
melakukan b534423de7
+5 -1
Melihat File
@@ -386,8 +386,9 @@ namespace rocshmem
// Query the number of IBV devices // Query the number of IBV devices
int numIbvDevices = 0; int numIbvDevices = 0;
ibv_device** deviceList = ibv_get_device_list(&numIbvDevices); ibv_device** deviceList = ibv_get_device_list(&numIbvDevices);
CHECK_NNULL(deviceList, "ibv_get_device_list");
if (deviceList && numIbvDevices > 0) { if (numIbvDevices > 0) {
// Loop over each device to collect information // Loop over each device to collect information
for (int i = 0; i < numIbvDevices; i++) { for (int i = 0; i < numIbvDevices; i++) {
IbvDevice ibvDevice; IbvDevice ibvDevice;
@@ -453,6 +454,9 @@ namespace rocshmem
} }
ibvDeviceList.push_back(ibvDevice); ibvDeviceList.push_back(ibvDevice);
} }
} else {
fprintf(stderr, "[Error] No visible InfiniBand devices found.\n");
exit(1);
} }
ibv_free_device_list(deviceList); ibv_free_device_list(deviceList);
isInitialized = true; isInitialized = true;