Browse Source

nvml: grab nvidia driver version string too

master
Tanguy Pruvot 10 years ago
parent
commit
aec310d4a7
  1. 5
      nvml.cpp
  2. 1
      nvml.h

5
nvml.cpp

@ -139,6 +139,8 @@ wrap_nvml_handle * wrap_nvml_create() @@ -139,6 +139,8 @@ wrap_nvml_handle * wrap_nvml_create()
wrap_dlsym(nvmlh->nvml_dll, "nvmlDeviceGetPowerUsage");
nvmlh->nvmlDeviceGetPowerUsage = (wrap_nvmlReturn_t (*)(wrap_nvmlDevice_t, unsigned int *))
wrap_dlsym(nvmlh->nvml_dll, "nvmlDeviceGetPowerUsage");
nvmlh->nvmlSystemGetDriverVersion = (wrap_nvmlReturn_t (*)(char *, unsigned int))
wrap_dlsym(nvmlh->nvml_dll, "nvmlSystemGetDriverVersion");
nvmlh->nvmlErrorString = (char* (*)(wrap_nvmlReturn_t))
wrap_dlsym(nvmlh->nvml_dll, "nvmlErrorString");
nvmlh->nvmlShutdown = (wrap_nvmlReturn_t (*)())
@ -146,6 +148,8 @@ wrap_nvml_handle * wrap_nvml_create() @@ -146,6 +148,8 @@ wrap_nvml_handle * wrap_nvml_create()
if (nvmlh->nvmlInit == NULL ||
nvmlh->nvmlShutdown == NULL ||
nvmlh->nvmlErrorString == NULL ||
nvmlh->nvmlSystemGetDriverVersion == NULL ||
nvmlh->nvmlDeviceGetCount == NULL ||
nvmlh->nvmlDeviceGetHandleByIndex == NULL ||
nvmlh->nvmlDeviceGetPciInfo == NULL ||
@ -161,6 +165,7 @@ wrap_nvml_handle * wrap_nvml_create() @@ -161,6 +165,7 @@ wrap_nvml_handle * wrap_nvml_create()
}
nvmlh->nvmlInit();
nvmlh->nvmlSystemGetDriverVersion(driver_version, sizeof(driver_version));
nvmlh->nvmlDeviceGetCount(&nvmlh->nvml_gpucount);
/* Query CUDA device count, in case it doesn't agree with NVML, since */

1
nvml.h

@ -71,6 +71,7 @@ typedef struct { @@ -71,6 +71,7 @@ typedef struct {
wrap_nvmlReturn_t (*nvmlDeviceGetFanSpeed)(wrap_nvmlDevice_t, unsigned int *);
wrap_nvmlReturn_t (*nvmlDeviceGetPerformanceState)(wrap_nvmlDevice_t, int *); /* enum */
wrap_nvmlReturn_t (*nvmlDeviceGetPowerUsage)(wrap_nvmlDevice_t, unsigned int *);
wrap_nvmlReturn_t (*nvmlSystemGetDriverVersion)(char *version, unsigned int len);
char* (*nvmlErrorString)(wrap_nvmlReturn_t);
wrap_nvmlReturn_t (*nvmlShutdown)(void);
} wrap_nvml_handle;

Loading…
Cancel
Save