From f8f773ce3fd18c9d7782e868d03e2b7ea689b423 Mon Sep 17 00:00:00 2001 From: sasha0552 Date: Mon, 28 Oct 2024 01:41:46 +0000 Subject: [PATCH] Print both NVML and NVAPI GPU name --- src/main.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 11c99b5..2716665 100644 --- a/src/main.c +++ b/src/main.c @@ -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++;