- OS: Windows
- CUDA version: 11.5
- GPU Driver version: 531.79
I have two graphics cards on my PC: GPU 0 is Intel UHD Graphics 770, and GPU 1 is GeForce RTX 3060.
I’m developing an application that uses NVML (NVIDIA Management Library) to interact with NVIDIA GPUs. To ensure NVML works correctly, I tested it using a sample code from the NVIDIA GPU Deployment Kit:
#include <stdio.h>
#include <nvml.h>
const char* convertToComputeModeString(nvmlComputeMode_t mode) {
switch (mode) {
case NVML_COMPUTEMODE_DEFAULT:
return "Default";
case NVML_COMPUTEMODE_EXCLUSIVE_THREAD:
return "Exclusive_Thread";
case NVML_COMPUTEMODE_PROHIBITED:
return "Prohibited";
case NVML_COMPUTEMODE_EXCLUSIVE_PROCESS:
return "Exclusive Process";
default:
return "Unknown";
}
}
int main() {
nvmlReturn_t result;
unsigned int device_count, i;
// Initialize NVML library
result = nvmlInit();
if (NVML_SUCCESS != result) {
printf("Failed to initialize NVML: %sn", nvmlErrorString(result));
return 1;
}
// Query the number of NVIDIA devices
result = nvmlDeviceGetCount(&device_count);
if (NVML_SUCCESS != result) {
printf("Failed to query device count: %sn", nvmlErrorString(result));
nvmlShutdown();
return 1;
}
printf("Found %d device%snn", device_count, device_count != 1 ? "s" : "");
// List and query details of each device
printf("Listing devices:n");
for (i = 0; i < device_count; i++) {
nvmlDevice_t device;
char name[NVML_DEVICE_NAME_BUFFER_SIZE];
nvmlPciInfo_t pci;
nvmlComputeMode_t compute_mode;
// Get handle for the device
result = nvmlDeviceGetHandleByIndex(i, &device);
if (NVML_SUCCESS != result) {
printf("Failed to get handle for device %i: %sn", i, nvmlErrorString(result));
nvmlShutdown();
return 1;
}
}
// Shutdown NVML library
nvmlShutdown();
return 0;
}
Upon running this program, I receive the following output:
Found 1 device
Listing devices:
Failed to get handle for device 0: Not Supported
It appears that all functionalities work except for nvmlDeviceGetHandleByIndex(). Any suggestions on resolving this issue would be greatly appreciated. Thank you!
I’ve looked online for a similar issue, but I couldn’t find anything that was relevant or helpful. I’ve also gone through the documentation, but it doesn’t explain what “Not Supported” means in this particular case.