const int num_corespeed = hm_get_corespeed_with_device_id (device_id);
const int num_memoryspeed = hm_get_memoryspeed_with_device_id (device_id);
const int num_buslanes = hm_get_buslanes_with_device_id (device_id);
- // not working
- //const int num_throttle = hm_get_throttle_with_device_id (device_id);
+ const int num_throttle = hm_get_throttle_with_device_id (device_id);
char output_buf[256] = { 0 };
output_len = strlen (output_buf);
}
- /*
- if (num_throttle >= 0)
+ if (num_throttle == 1)
{
- snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Throttle:%u", num_throttle);
+ snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " *Throttled*");
output_len = strlen (output_buf);
}
- */
if (output_len == 0)
{
}
else if (device_param->device_vendor_id == VENDOR_ID_NV)
{
- #ifdef _WIN
- hm_set_fanspeed_with_device_id_nvapi (device_id, fan_speed_new, 1);
- #endif
+
}
fan_speed_chgd[device_id] = 1;
if (gpu_temp_disable == 0)
{
- #if defined(WIN)
- NVAPI_PTR *nvapi = (NVAPI_PTR *) mymalloc (sizeof (NVAPI_PTR));
-
- if (nvapi_init (nvapi) == 0)
- data.hm_nv = nvapi;
-
- if (data.hm_nv)
- {
- if (hm_NvAPI_Initialize (data.hm_nv) == NVAPI_OK)
- {
- HM_ADAPTER_NV nvGPUHandle[DEVICES_MAX] = { 0 };
-
- int tmp_in = hm_get_adapter_index_nv (nvGPUHandle);
-
- int tmp_out = 0;
-
- for (int i = 0; i < tmp_in; i++)
- {
- hm_adapters_nv[tmp_out++].adapter_index.nv = nvGPUHandle[i];
- }
-
- for (int i = 0; i < tmp_out; i++)
- {
- NV_GPU_COOLER_SETTINGS pCoolerSettings;
-
- pCoolerSettings.Version = GPU_COOLER_SETTINGS_VER | sizeof (NV_GPU_COOLER_SETTINGS);
-
- if (hm_NvAPI_GPU_GetCoolerSettings (data.hm_nv, hm_adapters_nv[i].adapter_index.nv, 0, &pCoolerSettings) != NVAPI_NOT_SUPPORTED) hm_adapters_nv[i].fan_get_supported = 1;
- }
- }
- }
- #endif // WIN
-
- #if defined(LINUX)
NVML_PTR *nvml = (NVML_PTR *) mymalloc (sizeof (NVML_PTR));
if (nvml_init (nvml) == 0)
unsigned int speed;
if (hm_NVML_nvmlDeviceGetFanSpeed (data.hm_nv, 1, hm_adapters_nv[i].adapter_index.nv, &speed) != NVML_ERROR_NOT_SUPPORTED) hm_adapters_nv[i].fan_get_supported = 1;
+
+ hm_NVML_nvmlDeviceSetComputeMode (data.hm_nv, 1, hm_adapters_nv[i].adapter_index.nv, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
+
+ hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nv, 1, hm_adapters_nv[i].adapter_index.nv, NVML_GOM_ALL_ON);
+
+ unsigned int minLimit;
+ unsigned int maxLimit;
+
+ if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data.hm_nv, 1, hm_adapters_nv[i].adapter_index.nv, &minLimit, &maxLimit) == NVML_SUCCESS)
+ {
+ if (maxLimit > 0)
+ {
+ hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nv, 1, hm_adapters_nv[i].adapter_index.nv, maxLimit);
+ }
+ }
}
}
}
- #endif // LINUX
data.hm_amd = NULL;
if (gpu_temp_disable == 0)
{
const int gpu_temp_threshold_slowdown = hm_get_threshold_slowdown_with_device_id (device_id);
+ const int gpu_temp_threshold_shutdown = hm_get_threshold_slowdown_with_device_id (device_id);
+
+ data.hm_device[device_id].gpu_temp_threshold_slowdown = (gpu_temp_threshold_slowdown > 0) ? gpu_temp_threshold_slowdown : 10000;
+ data.hm_device[device_id].gpu_temp_threshold_shutdown = (gpu_temp_threshold_shutdown > 0) ? gpu_temp_threshold_shutdown : 10000;
- data.hm_device[device_id].gpu_temp_threshold_slowdown = (gpu_temp_threshold_slowdown == -1) ? 100000 : gpu_temp_threshold_slowdown;
+ // we could use those numbers for gpu_temp_retain and gpu_temp_abort, too
}
/**
}
else if (device_param->device_vendor_id == VENDOR_ID_NV)
{
- #ifdef _WIN
- rc = hm_set_fanspeed_with_device_id_nvapi (device_id, fanspeed, 1);
- #endif
+
}
if (rc == 0)
}
else if (device_param->device_vendor_id == VENDOR_ID_NV)
{
- #ifdef _WIN
- rc = hm_set_fanspeed_with_device_id_nvapi (device_id, fanspeed, 16);
- #endif
+
}
if (rc == -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id + 1);
{
if (data.hm_nv)
{
- #if defined(LINUX)
-
hm_NVML_nvmlShutdown (data.hm_nv);
nvml_close (data.hm_nv);
- #elif defined(WIN)
-
- hm_NvAPI_Unload (data.hm_nv);
-
- nvapi_close (data.hm_nv);
-
- #endif
-
data.hm_nv = NULL;
}