|
|
|
@ -2658,11 +2658,11 @@ int hm_get_adapter_index_nv (HM_ADAPTER_NV nvGPUHandle[DEVICES_MAX])
|
|
|
|
|
|
|
|
|
|
for (uint i = 0; i < DEVICES_MAX; i++)
|
|
|
|
|
{
|
|
|
|
|
if (hc_NVML_nvmlDeviceGetHandleByIndex (data.hm_dll, 1, i, &nvGPUHandle[i]) != NVML_SUCCESS) break;
|
|
|
|
|
if (hc_NVML_nvmlDeviceGetHandleByIndex (data.hm_dll_nv, 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 (data.hm_dll, nvGPUHandle[i], name, sizeof (name) - 1);
|
|
|
|
|
//hc_NVML_nvmlDeviceGetName (data.hm_dll_nv, nvGPUHandle[i], name, sizeof (name) - 1);
|
|
|
|
|
|
|
|
|
|
pGpuCount++;
|
|
|
|
|
}
|
|
|
|
@ -2689,11 +2689,11 @@ void hm_close (HM_LIB hm_dll)
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HM_LIB hm_init ()
|
|
|
|
|
HM_LIB hm_init (const cl_uint vendor_id)
|
|
|
|
|
{
|
|
|
|
|
HM_LIB hm_dll = NULL;
|
|
|
|
|
|
|
|
|
|
if (data.vendor_id == VENDOR_ID_AMD)
|
|
|
|
|
if (vendor_id == VENDOR_ID_AMD)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _POSIX
|
|
|
|
|
hm_dll = dlopen ("libatiadlxx.so", RTLD_LAZY | RTLD_GLOBAL);
|
|
|
|
@ -2710,7 +2710,7 @@ HM_LIB hm_init ()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef LINUX
|
|
|
|
|
if (data.vendor_id == VENDOR_ID_NV)
|
|
|
|
|
if (vendor_id == VENDOR_ID_NV)
|
|
|
|
|
{
|
|
|
|
|
hm_dll = dlopen ("libnvidia-ml.so", RTLD_LAZY | RTLD_GLOBAL);
|
|
|
|
|
}
|
|
|
|
@ -2719,9 +2719,9 @@ HM_LIB hm_init ()
|
|
|
|
|
return hm_dll;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int get_adapters_num_amd (HM_LIB hm_dll, int *iNumberAdapters)
|
|
|
|
|
int get_adapters_num_amd (HM_LIB hm_dll_amd, int *iNumberAdapters)
|
|
|
|
|
{
|
|
|
|
|
if (hc_ADL_Adapter_NumberOfAdapters_Get (hm_dll, iNumberAdapters) != ADL_OK) return -1;
|
|
|
|
|
if (hc_ADL_Adapter_NumberOfAdapters_Get (hm_dll_amd, iNumberAdapters) != ADL_OK) return -1;
|
|
|
|
|
|
|
|
|
|
if (iNumberAdapters == 0)
|
|
|
|
|
{
|
|
|
|
@ -2769,13 +2769,13 @@ int hm_show_performance_level (HM_LIB hm_dll, int iAdapterIndex)
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
LPAdapterInfo hm_get_adapter_info_amd (HM_LIB hm_dll, int iNumberAdapters)
|
|
|
|
|
LPAdapterInfo hm_get_adapter_info_amd (HM_LIB hm_dll_amd, int iNumberAdapters)
|
|
|
|
|
{
|
|
|
|
|
size_t AdapterInfoSize = iNumberAdapters * sizeof (AdapterInfo);
|
|
|
|
|
|
|
|
|
|
LPAdapterInfo lpAdapterInfo = (LPAdapterInfo) mymalloc (AdapterInfoSize);
|
|
|
|
|
|
|
|
|
|
if (hc_ADL_Adapter_AdapterInfo_Get (hm_dll, lpAdapterInfo, AdapterInfoSize) != ADL_OK) return NULL;
|
|
|
|
|
if (hc_ADL_Adapter_AdapterInfo_Get (hm_dll_amd, lpAdapterInfo, AdapterInfoSize) != ADL_OK) return NULL;
|
|
|
|
|
|
|
|
|
|
return lpAdapterInfo;
|
|
|
|
|
}
|
|
|
|
@ -2934,7 +2934,7 @@ uint32_t *hm_get_list_valid_adl_adapters (int iNumberAdapters, int *num_adl_adap
|
|
|
|
|
return adl_adapters;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hm_check_fanspeed_control (HM_LIB hm_dll, hm_attrs_t *hm_device, uint32_t *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo)
|
|
|
|
|
int hm_check_fanspeed_control (HM_LIB hm_dll_amd, hm_attrs_t *hm_device, uint32_t *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo)
|
|
|
|
|
{
|
|
|
|
|
// loop through all valid devices
|
|
|
|
|
|
|
|
|
@ -2952,7 +2952,7 @@ int hm_check_fanspeed_control (HM_LIB hm_dll, hm_attrs_t *hm_device, uint32_t *v
|
|
|
|
|
|
|
|
|
|
int opencl_device_index = i;
|
|
|
|
|
|
|
|
|
|
// if (hm_show_performance_level (hm_dll, info.iAdapterIndex) != 0) return -1;
|
|
|
|
|
// if (hm_show_performance_level (hm_dll_amd, info.iAdapterIndex) != 0) return -1;
|
|
|
|
|
|
|
|
|
|
// get fanspeed info
|
|
|
|
|
|
|
|
|
@ -2964,7 +2964,7 @@ int hm_check_fanspeed_control (HM_LIB hm_dll, hm_attrs_t *hm_device, uint32_t *v
|
|
|
|
|
|
|
|
|
|
FanSpeedInfo.iSize = sizeof (ADLFanSpeedInfo);
|
|
|
|
|
|
|
|
|
|
if (hc_ADL_Overdrive5_FanSpeedInfo_Get (hm_dll, info.iAdapterIndex, 0, &FanSpeedInfo) != ADL_OK) return -1;
|
|
|
|
|
if (hc_ADL_Overdrive5_FanSpeedInfo_Get (hm_dll_amd, info.iAdapterIndex, 0, &FanSpeedInfo) != ADL_OK) return -1;
|
|
|
|
|
|
|
|
|
|
// check read and write capability in fanspeedinfo
|
|
|
|
|
|
|
|
|
@ -2984,7 +2984,7 @@ int hm_check_fanspeed_control (HM_LIB hm_dll, hm_attrs_t *hm_device, uint32_t *v
|
|
|
|
|
|
|
|
|
|
memset (&faninfo, 0, sizeof (faninfo));
|
|
|
|
|
|
|
|
|
|
if (hc_ADL_Overdrive6_FanSpeed_Get (hm_dll, info.iAdapterIndex, &faninfo) != ADL_OK) return -1;
|
|
|
|
|
if (hc_ADL_Overdrive6_FanSpeed_Get (hm_dll_amd, info.iAdapterIndex, &faninfo) != ADL_OK) return -1;
|
|
|
|
|
|
|
|
|
|
// check read capability in fanspeedinfo
|
|
|
|
|
|
|
|
|
@ -3002,7 +3002,7 @@ int hm_check_fanspeed_control (HM_LIB hm_dll, hm_attrs_t *hm_device, uint32_t *v
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hm_get_overdrive_version (HM_LIB hm_dll, hm_attrs_t *hm_device, uint32_t *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo)
|
|
|
|
|
int hm_get_overdrive_version (HM_LIB hm_dll_amd, hm_attrs_t *hm_device, uint32_t *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < num_adl_adapters; i++)
|
|
|
|
|
{
|
|
|
|
@ -3018,7 +3018,7 @@ int hm_get_overdrive_version (HM_LIB hm_dll, hm_attrs_t *hm_device, uint32_t *va
|
|
|
|
|
int od_enabled = 0;
|
|
|
|
|
int od_version = 0;
|
|
|
|
|
|
|
|
|
|
if (hc_ADL_Overdrive_Caps (hm_dll, info.iAdapterIndex, &od_supported, &od_enabled, &od_version) != ADL_OK) return -1;
|
|
|
|
|
if (hc_ADL_Overdrive_Caps (hm_dll_amd, info.iAdapterIndex, &od_supported, &od_enabled, &od_version) != ADL_OK) return -1;
|
|
|
|
|
|
|
|
|
|
// store the overdrive version in hm_device
|
|
|
|
|
|
|
|
|
@ -3062,9 +3062,9 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
|
|
|
|
{
|
|
|
|
|
if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
|
|
|
|
|
|
|
|
|
if (data.vendor_id == VENDOR_ID_AMD)
|
|
|
|
|
if (data.devices_param[device_id].vendor_id == VENDOR_ID_AMD)
|
|
|
|
|
{
|
|
|
|
|
if (data.hm_dll)
|
|
|
|
|
if (data.hm_dll_amd)
|
|
|
|
|
{
|
|
|
|
|
if (data.hm_device[device_id].od_version == 5)
|
|
|
|
|
{
|
|
|
|
@ -3072,7 +3072,7 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
|
|
|
|
|
|
|
|
|
Temperature.iSize = sizeof (ADLTemperature);
|
|
|
|
|
|
|
|
|
|
if (hc_ADL_Overdrive5_Temperature_Get (data.hm_dll, data.hm_device[device_id].adapter_index.amd, 0, &Temperature) != ADL_OK) return -1;
|
|
|
|
|
if (hc_ADL_Overdrive5_Temperature_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, 0, &Temperature) != ADL_OK) return -1;
|
|
|
|
|
|
|
|
|
|
return Temperature.iTemperature / 1000;
|
|
|
|
|
}
|
|
|
|
@ -3080,19 +3080,18 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
|
|
|
|
{
|
|
|
|
|
int Temperature = 0;
|
|
|
|
|
|
|
|
|
|
if (hc_ADL_Overdrive6_Temperature_Get (data.hm_dll, data.hm_device[device_id].adapter_index.amd, &Temperature) != ADL_OK) return -1;
|
|
|
|
|
if (hc_ADL_Overdrive6_Temperature_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &Temperature) != ADL_OK) return -1;
|
|
|
|
|
|
|
|
|
|
return Temperature / 1000;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.vendor_id == VENDOR_ID_NV)
|
|
|
|
|
else if (data.devices_param[device_id].vendor_id == VENDOR_ID_NV)
|
|
|
|
|
{
|
|
|
|
|
#ifdef LINUX
|
|
|
|
|
int temperature = 0;
|
|
|
|
|
|
|
|
|
|
hc_NVML_nvmlDeviceGetTemperature (data.hm_dll, data.hm_device[device_id].adapter_index.nv, NVML_TEMPERATURE_GPU, (unsigned int *) &temperature);
|
|
|
|
|
hc_NVML_nvmlDeviceGetTemperature (data.hm_dll_nv, data.hm_device[device_id].adapter_index.nv, NVML_TEMPERATURE_GPU, (unsigned int *) &temperature);
|
|
|
|
|
|
|
|
|
|
return temperature;
|
|
|
|
|
#endif
|
|
|
|
@ -3121,9 +3120,9 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
|
|
|
|
|
|
|
|
|
if (data.hm_device[device_id].fan_supported == 1)
|
|
|
|
|
{
|
|
|
|
|
if (data.vendor_id == VENDOR_ID_AMD)
|
|
|
|
|
if (data.devices_param[device_id].vendor_id == VENDOR_ID_AMD)
|
|
|
|
|
{
|
|
|
|
|
if (data.hm_dll)
|
|
|
|
|
if (data.hm_dll_amd)
|
|
|
|
|
{
|
|
|
|
|
if (data.hm_device[device_id].od_version == 5)
|
|
|
|
|
{
|
|
|
|
@ -3135,7 +3134,7 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
|
|
|
|
lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
|
|
|
|
lpFanSpeedValue.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
|
|
|
|
|
|
|
|
|
|
if (hc_ADL_Overdrive5_FanSpeed_Get (data.hm_dll, data.hm_device[device_id].adapter_index.amd, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
|
|
|
|
if (hc_ADL_Overdrive5_FanSpeed_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
|
|
|
|
|
|
|
|
|
return lpFanSpeedValue.iFanSpeed;
|
|
|
|
|
}
|
|
|
|
@ -3145,19 +3144,18 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
|
|
|
|
|
|
|
|
|
memset (&faninfo, 0, sizeof (faninfo));
|
|
|
|
|
|
|
|
|
|
if (hc_ADL_Overdrive6_FanSpeed_Get (data.hm_dll, data.hm_device[device_id].adapter_index.amd, &faninfo) != ADL_OK) return -1;
|
|
|
|
|
if (hc_ADL_Overdrive6_FanSpeed_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &faninfo) != ADL_OK) return -1;
|
|
|
|
|
|
|
|
|
|
return faninfo.iFanSpeedPercent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.vendor_id == VENDOR_ID_NV)
|
|
|
|
|
else if (data.devices_param[device_id].vendor_id == VENDOR_ID_NV)
|
|
|
|
|
{
|
|
|
|
|
#ifdef LINUX
|
|
|
|
|
int speed = 0;
|
|
|
|
|
|
|
|
|
|
hc_NVML_nvmlDeviceGetFanSpeed (data.hm_dll, 1, data.hm_device[device_id].adapter_index.nv, (unsigned int *) &speed);
|
|
|
|
|
hc_NVML_nvmlDeviceGetFanSpeed (data.hm_dll_nv, 1, data.hm_device[device_id].adapter_index.nv, (unsigned int *) &speed);
|
|
|
|
|
|
|
|
|
|
return speed;
|
|
|
|
|
#endif
|
|
|
|
@ -3179,26 +3177,25 @@ int hm_get_utilization_with_device_id (const uint device_id)
|
|
|
|
|
{
|
|
|
|
|
if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
|
|
|
|
|
|
|
|
|
if (data.vendor_id == VENDOR_ID_AMD)
|
|
|
|
|
if (data.devices_param[device_id].vendor_id == VENDOR_ID_AMD)
|
|
|
|
|
{
|
|
|
|
|
if (data.hm_dll)
|
|
|
|
|
if (data.hm_dll_amd)
|
|
|
|
|
{
|
|
|
|
|
ADLPMActivity PMActivity;
|
|
|
|
|
|
|
|
|
|
PMActivity.iSize = sizeof (ADLPMActivity);
|
|
|
|
|
|
|
|
|
|
if (hc_ADL_Overdrive_CurrentActivity_Get (data.hm_dll, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
|
|
|
|
|
if (hc_ADL_Overdrive_CurrentActivity_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
|
|
|
|
|
|
|
|
|
|
return PMActivity.iActivityPercent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.vendor_id == VENDOR_ID_NV)
|
|
|
|
|
else if (data.devices_param[device_id].vendor_id == VENDOR_ID_NV)
|
|
|
|
|
{
|
|
|
|
|
#ifdef LINUX
|
|
|
|
|
nvmlUtilization_t utilization;
|
|
|
|
|
|
|
|
|
|
hc_NVML_nvmlDeviceGetUtilizationRates (data.hm_dll, data.hm_device[device_id].adapter_index.nv, &utilization);
|
|
|
|
|
hc_NVML_nvmlDeviceGetUtilizationRates (data.hm_dll_nv, data.hm_device[device_id].adapter_index.nv, &utilization);
|
|
|
|
|
|
|
|
|
|
return utilization.gpu;
|
|
|
|
|
#endif
|
|
|
|
@ -3221,7 +3218,7 @@ int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed
|
|
|
|
|
{
|
|
|
|
|
if (data.hm_device[device_id].fan_supported == 1)
|
|
|
|
|
{
|
|
|
|
|
if (data.hm_dll)
|
|
|
|
|
if (data.hm_dll_amd)
|
|
|
|
|
{
|
|
|
|
|
if (data.hm_device[device_id].od_version == 5)
|
|
|
|
|
{
|
|
|
|
@ -3234,7 +3231,7 @@ int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed
|
|
|
|
|
lpFanSpeedValue.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
|
|
|
|
|
lpFanSpeedValue.iFanSpeed = fanspeed;
|
|
|
|
|
|
|
|
|
|
if (hc_ADL_Overdrive5_FanSpeed_Set (data.hm_dll, data.hm_device[device_id].adapter_index.amd, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
|
|
|
|
if (hc_ADL_Overdrive5_FanSpeed_Set (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -3247,7 +3244,7 @@ int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed
|
|
|
|
|
fan_speed_value.iSpeedType = ADL_OD6_FANSPEED_TYPE_PERCENT;
|
|
|
|
|
fan_speed_value.iFanSpeed = fanspeed;
|
|
|
|
|
|
|
|
|
|
if (hc_ADL_Overdrive6_FanSpeed_Set (data.hm_dll, data.hm_device[device_id].adapter_index.amd, &fan_speed_value) != ADL_OK) return -1;
|
|
|
|
|
if (hc_ADL_Overdrive6_FanSpeed_Set (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &fan_speed_value) != ADL_OK) return -1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -5106,6 +5103,41 @@ void handle_left_request_lm (pot_t *pot, uint pot_cnt, char *input_buf, int inpu
|
|
|
|
|
if (weak_hash_found == 1) myfree (pot_right_ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint setup_opencl_platforms_filter (char *opencl_platforms)
|
|
|
|
|
{
|
|
|
|
|
uint opencl_platforms_filter = 0;
|
|
|
|
|
|
|
|
|
|
if (opencl_platforms)
|
|
|
|
|
{
|
|
|
|
|
char *platforms = strdup (opencl_platforms);
|
|
|
|
|
|
|
|
|
|
char *next = strtok (platforms, ",");
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
int platform = atoi (next);
|
|
|
|
|
|
|
|
|
|
if (platform < 1 || platform > 31)
|
|
|
|
|
{
|
|
|
|
|
log_error ("ERROR: invalid OpenCL platform %u specified", platform);
|
|
|
|
|
|
|
|
|
|
exit (-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
opencl_platforms_filter |= 1 << (platform - 1);
|
|
|
|
|
|
|
|
|
|
} while ((next = strtok (NULL, ",")) != NULL);
|
|
|
|
|
|
|
|
|
|
free (platforms);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
opencl_platforms_filter = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return opencl_platforms_filter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cl_device_type setup_device_types_filter (char *opencl_device_types)
|
|
|
|
|
{
|
|
|
|
|
cl_device_type device_types_filter = 0;
|
|
|
|
|