for (uint i = 0; i < DEVICES_MAX; i++)
{
- // do not use wrapper function to omit warning message
- if (nvmlDeviceGetHandleByIndex (i, &nvGPUHandle[i]) != NVML_SUCCESS) break;
+ if (hc_NVML_nvmlDeviceGetHandleByIndex (data.hm_dll, 1, i, &nvGPUHandle[i]) != NVML_SUCCESS) break;
//can be used to determine if the device by index matches the cuda device by index
//char name[100]; memset (name, 0, sizeof (name));
- //hc_NVML_nvmlDeviceGetName (nvGPUHandle[i], name, sizeof (name) - 1);
+ //hc_NVML_nvmlDeviceGetName (data.hm_dll, nvGPUHandle[i], name, sizeof (name) - 1);
pGpuCount++;
}
}
#endif
-void hm_close_amd (HM_LIB hm_dll)
+void hm_close (HM_LIB hm_dll)
{
#ifdef _POSIX
dlclose (hm_dll);
#endif
}
-HM_LIB hm_init_amd ()
+HM_LIB hm_init ()
{
- #ifdef _POSIX
- HM_LIB hm_dll = dlopen ("libatiadlxx.so", RTLD_LAZY | RTLD_GLOBAL);
+ HM_LIB hm_dll = NULL;
- #elif _WIN
- HM_LIB hm_dll = LoadLibrary ("atiadlxx.dll");
+ if (data.vendor_id == VENDOR_ID_AMD)
+ {
+ #ifdef _POSIX
+ hm_dll = dlopen ("libatiadlxx.so", RTLD_LAZY | RTLD_GLOBAL);
+
+ #elif _WIN
+ hm_dll = LoadLibrary ("atiadlxx.dll");
- if (hm_dll == NULL)
+ if (hm_dll == NULL)
+ {
hm_dll = LoadLibrary ("atiadlxy.dll");
+ }
+ #endif
+ }
+
+ #ifdef LINUX
+ if (data.vendor_id == VENDOR_ID_NV)
+ {
+ hm_dll = dlopen ("libnvidia-ml.so", RTLD_LAZY | RTLD_GLOBAL);
+ }
#endif
return hm_dll;
#ifdef LINUX
int temperature = 0;
- hc_NVML_nvmlDeviceGetTemperature (data.hm_device[device_id].adapter_index.nv, NVML_TEMPERATURE_GPU, (unsigned int *) &temperature);
+ hc_NVML_nvmlDeviceGetTemperature (data.hm_dll, data.hm_device[device_id].adapter_index.nv, NVML_TEMPERATURE_GPU, (unsigned int *) &temperature);
return temperature;
#endif
#ifdef LINUX
int speed = 0;
- hc_NVML_nvmlDeviceGetFanSpeed (data.hm_device[device_id].adapter_index.nv, (unsigned int *) &speed);
+ hc_NVML_nvmlDeviceGetFanSpeed (data.hm_dll, 1, data.hm_device[device_id].adapter_index.nv, (unsigned int *) &speed);
return speed;
#endif
#ifdef LINUX
nvmlUtilization_t utilization;
- hc_NVML_nvmlDeviceGetUtilizationRates (data.hm_device[device_id].adapter_index.nv, &utilization);
+ hc_NVML_nvmlDeviceGetUtilizationRates (data.hm_dll, data.hm_device[device_id].adapter_index.nv, &utilization);
return utilization.gpu;
#endif