diff --git a/nvml.cpp b/nvml.cpp index 843d7e8..ff4d7e0 100644 --- a/nvml.cpp +++ b/nvml.cpp @@ -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() 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() } 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 */ diff --git a/nvml.h b/nvml.h index 6a60ab9..74bbe19 100644 --- a/nvml.h +++ b/nvml.h @@ -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;