Skip to content

Commit

Permalink
Print both NVML and NVAPI GPU name
Browse files Browse the repository at this point in the history
  • Loading branch information
sasha0552 authored Oct 28, 2024
1 parent 0fb4f3a commit f8f773c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,23 @@ int main(int argc, char *argv[]) {

// If GPU is managed
if (state->managed) {
// Buffer to store the GPU name
char gpuName[256];
// Buffer to store the NVML GPU name
char nvmlGpuName[256];

// Retrieve the GPU name
NVML_CALL(nvmlDeviceGetName(nvmlDevices[i], gpuName, sizeof(gpuName)), errored);
// Retrieve the NVML GPU name
NVML_CALL(nvmlDeviceGetName(nvmlDevices[i], nvmlGpuName, sizeof(nvmlGpuName)), errored);

// Print the managed GPU details
printf("%u. %s (GPU id = %u)\n", managedGPUs, gpuName, i);
printf("(NVML) %u. %s (GPU id = %u)\n", managedGPUs, nvmlGpuName, i);

// Buffer to store the NVAPI GPU name
NvAPI_ShortString nvapiGpuName;

// Retrieve the NVAPI GPU name
NVAPI_CALL(NvAPI_GPU_GetFullName(nvapiDevices[i], nvapiGpuName), errored);

// Print the managed GPU details
printf("(NVAPI) %u. %s (GPU id = %u)\n", managedGPUs, nvapiGpuName, i);

// Increment the managed GPU counter
managedGPUs++;
Expand Down

0 comments on commit f8f773c

Please sign in to comment.