#define BITMAP_MAX 24
#define GPU_TEMP_DISABLE 0
#define GPU_TEMP_ABORT 90
-#define GPU_TEMP_RETAIN 80
+#define GPU_TEMP_RETAIN 70
#define WORKLOAD_PROFILE 2
#define KERNEL_ACCEL 0
#define KERNEL_LOOPS 0
if (device_param->skipped) continue;
- #define HM_STR_BUF_SIZE 255
+ const int num_temperature = hm_get_temperature_with_device_id (device_id);
+ const int num_fanspeed = hm_get_fanspeed_with_device_id (device_id);
+ const int num_utilization = hm_get_utilization_with_device_id (device_id);
+ 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);
- if (data.hm_device[device_id].fan_supported == 1)
+ char output_buf[256] = { 0 };
+
+ int output_len = 0;
+
+ if (num_temperature >= 0)
{
- char utilization[HM_STR_BUF_SIZE] = { 0 };
- char temperature[HM_STR_BUF_SIZE] = { 0 };
- char fanspeed[HM_STR_BUF_SIZE] = { 0 };
+ snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Temp:%3uc", num_temperature);
- hm_device_val_to_str ((char *) utilization, HM_STR_BUF_SIZE, "%", hm_get_utilization_with_device_id (device_id));
- hm_device_val_to_str ((char *) temperature, HM_STR_BUF_SIZE, "c", hm_get_temperature_with_device_id (device_id));
+ output_len = strlen (output_buf);
+ }
- if (device_param->device_vendor_id == VENDOR_ID_AMD)
- {
- hm_device_val_to_str ((char *) fanspeed, HM_STR_BUF_SIZE, "%", hm_get_fanspeed_with_device_id (device_id));
- }
- else if (device_param->device_vendor_id == VENDOR_ID_NV)
- {
- hm_device_val_to_str ((char *) fanspeed, HM_STR_BUF_SIZE, "%", hm_get_fanspeed_with_device_id (device_id));
- }
+ if (num_fanspeed >= 0)
+ {
+ snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Fan:%3u%%", num_fanspeed);
- log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, %s Fan", device_id + 1, utilization, temperature, fanspeed);
+ output_len = strlen (output_buf);
}
- else
+
+ if (num_utilization >= 0)
{
- char utilization[HM_STR_BUF_SIZE] = { 0 };
- char temperature[HM_STR_BUF_SIZE] = { 0 };
+ snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Util:%3u%%", num_utilization);
- hm_device_val_to_str ((char *) utilization, HM_STR_BUF_SIZE, "%", hm_get_utilization_with_device_id (device_id));
- hm_device_val_to_str ((char *) temperature, HM_STR_BUF_SIZE, "c", hm_get_temperature_with_device_id (device_id));
+ output_len = strlen (output_buf);
+ }
+
+ if (num_corespeed >= 0)
+ {
+ snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Core:%4uMhz", num_corespeed);
+
+ output_len = strlen (output_buf);
+ }
+
+ if (num_memoryspeed >= 0)
+ {
+ snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Mem:%4uMhz", num_memoryspeed);
+
+ output_len = strlen (output_buf);
+ }
+
+ if (num_buslanes >= 0)
+ {
+ snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Lanes:%u", num_buslanes);
- log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, N/A Fan", device_id + 1, utilization, temperature);
+ output_len = strlen (output_buf);
}
+
+ /*
+ if (num_throttle >= 0)
+ {
+ snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Throttle:%u", num_throttle);
+
+ output_len = strlen (output_buf);
+ }
+ */
+
+ if (output_len == 0)
+ {
+ snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " N/A");
+
+ output_len = strlen (output_buf);
+ }
+
+ log_info ("HWMon.Dev.#%d...:%s", device_id + 1, output_buf);
}
hc_thread_mutex_unlock (mux_adl);
out_fp = stdout;
}
+
lock_file (out_fp);
}
else
#ifdef HAVE_HWMON
uint hwmon_check = 0;
+ int slowdown_warnings = 0;
+
// these variables are mainly used for fan control (AMD only)
int *fan_speed_chgd = (int *) mycalloc (data.devices_cnt, sizeof (int));
if (data.devices_status != STATUS_RUNNING) continue;
#ifdef HAVE_HWMON
+
+ if (1)
+ {
+ hc_thread_mutex_lock (mux_adl);
+
+ for (uint device_id = 0; device_id < data.devices_cnt; device_id++)
+ {
+ hc_device_param_t *device_param = &data.devices_param[device_id];
+
+ if (device_param->skipped) continue;
+
+ if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) continue;
+
+ const int temperature = hm_get_temperature_with_device_id (device_id);
+
+ const int threshold = data.hm_device[device_id].gpu_temp_threshold_slowdown;
+
+ if (temperature >= threshold)
+ {
+ if (slowdown_warnings < 3)
+ {
+ if (data.quiet == 0) clear_prompt ();
+
+ log_info ("WARNING: Drivers temperature threshold (%dc) hit on GPU #%d, expect performance to drop...", threshold, device_id + 1);
+
+ if (slowdown_warnings == 2)
+ {
+ log_info ("");
+ }
+
+ if (data.quiet == 0) fprintf (stdout, "%s", PROMPT);
+ if (data.quiet == 0) fflush (stdout);
+
+ slowdown_warnings++;
+ }
+ }
+ else
+ {
+ slowdown_warnings = 0;
+ }
+ }
+
+ hc_thread_mutex_unlock (mux_adl);
+ }
+
if (hwmon_check == 1)
{
hc_thread_mutex_lock (mux_adl);
*/
#ifdef _WIN
-void SetConsoleWindowSize (const int x, const int y)
+void SetConsoleWindowSize (const int x)
{
HANDLE h = GetStdHandle (STD_OUTPUT_HANDLE);
SMALL_RECT *sr = &bufferInfo.srWindow;
- sr->Left = 0;
- sr->Top = 0;
- sr->Right = MAX (sr->Right, x - 1);
- sr->Bottom = MAX (sr->Bottom, y - 1);
+ sr->Right = MAX (sr->Right, x - 1);
COORD co;
co.X = sr->Right + 1;
co.Y = sr->Bottom + 1;
- co.Y = MAX (co.Y, 1337);
-
if (!SetConsoleScreenBufferSize (h, co)) return;
if (!SetConsoleWindowInfo (h, TRUE, sr)) return;
int main (int argc, char **argv)
{
#ifdef _WIN
- SetConsoleWindowSize (132, 44);
+ SetConsoleWindowSize (132);
#endif
/**
weak_hash_threshold = 0;
gpu_temp_disable = 1;
+ #ifdef HAVE_HWMON
+ #ifdef HAVE_ADL
+ powertune_enable = 1;
+ #endif
+ #endif
+
data.status_timer = status_timer;
data.restore_timer = restore_timer;
data.restore_disable = restore_disable;
{
if (device_param->skipped == 0)
{
- log_info ("Device #%u: %s, %lu/%lu MB allocatable, %dMhz, %uMCU",
+ log_info ("Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
device_id + 1,
device_name,
(unsigned int) (device_maxmem_alloc / 1024 / 1024),
(unsigned int) (device_global_mem / 1024 / 1024),
- (unsigned int) (device_maxclock_frequency),
(unsigned int) device_processors);
}
else
#ifdef HAVE_HWMON
#if defined(HAVE_NVML) || defined(HAVE_NVAPI)
- hm_attrs_t hm_adapters_nv[DEVICES_MAX] = { { { 0 }, 0, 0 } };
+ hm_attrs_t hm_adapters_nv[DEVICES_MAX] = { { { 0 }, 0, 0, 0, 0 } };
#endif
#ifdef HAVE_ADL
- hm_attrs_t hm_adapters_amd[DEVICES_MAX] = { { { 0 }, 0, 0 } };
+ hm_attrs_t hm_adapters_amd[DEVICES_MAX] = { { { 0 }, 0, 0, 0, 0 } };
#endif
if (gpu_temp_disable == 0)
}
}
- /*
- * Temporary fix:
- * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
- * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
- * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
- * Driver / ADL bug?
- */
+ /**
+ * Temporary fix:
+ * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
+ * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
+ * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
+ * Driver / ADL bug?
+ */
#ifdef HAVE_ADL
if (powertune_enable == 1)
run_kernel_bzero (device_param, device_param->d_markov_css_buf, size_markov_css);
}
+ /**
+ * Store thermal target temperature so we can send a notice to user
+ */
+
+ #if defined(HAVE_HWMON)
+ if (gpu_temp_disable == 0)
+ {
+ const int gpu_temp_threshold_slowdown = hm_get_threshold_slowdown_with_device_id (device_id);
+
+ data.hm_device[device_id].gpu_temp_threshold_slowdown = (gpu_temp_threshold_slowdown == -1) ? 100000 : gpu_temp_threshold_slowdown;
+ }
+ #endif
+
/**
* Store initial fanspeed if gpu_temp_retain is enabled
*/