1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 00:28:11 +00:00

Make use of hwmon_ctx_t

This commit is contained in:
jsteube 2016-09-28 22:28:44 +02:00
parent fdd48b52ec
commit 7191780296
10 changed files with 755 additions and 917 deletions

View File

@ -6,41 +6,21 @@
#ifndef _HWMON_H #ifndef _HWMON_H
#define _HWMON_H #define _HWMON_H
int get_adapters_num_adl (void *adl, int *iNumberAdapters); int hm_get_threshold_slowdown_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_threshold_shutdown_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_temperature_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_fanpolicy_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_fanspeed_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_buslanes_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_utilization_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_memoryspeed_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_corespeed_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_throttle_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_set_fanspeed_with_device_id_adl (const hwmon_ctx_t *hwmon_ctx, const uint device_id, const int fanspeed, const int fanpolicy);
int hm_set_fanspeed_with_device_id_nvapi (const hwmon_ctx_t *hwmon_ctx, const uint device_id, const int fanspeed, const int fanpolicy);
int hm_set_fanspeed_with_device_id_xnvctrl (const hwmon_ctx_t *hwmon_ctx, const uint device_id, const int fanspeed);
int hm_get_adapter_index_adl (hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo); int hwmon_ctx_init (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options, const opencl_ctx_t *opencl_ctx);
void hwmon_ctx_destroy (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options, const opencl_ctx_t *opencl_ctx);
int hm_get_adapter_index_nvapi (HM_ADAPTER_NVAPI nvapiGPUHandle[DEVICES_MAX]);
int hm_get_adapter_index_nvml (HM_ADAPTER_NVML nvmlGPUHandle[DEVICES_MAX]);
LPAdapterInfo hm_get_adapter_info_adl (void *adl, int iNumberAdapters);
u32 *hm_get_list_valid_adl_adapters (int iNumberAdapters, int *num_adl_adapters, LPAdapterInfo lpAdapterInfo);
int hm_get_overdrive_version (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
int hm_check_fanspeed_control (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
// int hm_get_device_num (void *adl, HM_ADAPTER_ADL hm_adapter_index, int *hm_device_num);
// void hm_get_opencl_busid_devid (hm_attrs_t *hm_device, uint opencl_num_devices, cl_device_id *devices);
int hm_get_threshold_slowdown_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_threshold_shutdown_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_temperature_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_fanspeed_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_fanpolicy_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_buslanes_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_utilization_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_memoryspeed_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_corespeed_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_throttle_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_set_fanspeed_with_device_id_adl (const uint device_id, const int fanspeed, const int fanpolicy);
int hm_set_fanspeed_with_device_id_nvapi (const uint device_id, const int fanspeed, const int fanpolicy);
int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fanspeed);
void hm_device_val_to_str (char *target_buf, int max_buf_size, char *suffix, int value);
int hwmon_ctx_init (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options);
void hwmon_ctx_destroy (hwmon_ctx_t *hwmon_ctx);
#endif // _HWMON_H #endif // _HWMON_H

View File

@ -11,8 +11,8 @@
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries); double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx); void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx);
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx); void status_display (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx);
void status_benchmark_automate (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig); void status_benchmark_automate (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig);
void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options); void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options);

View File

@ -809,8 +809,8 @@ typedef struct
int od_version; int od_version;
int fan_get_supported; bool fan_get_supported;
int fan_set_supported; bool fan_set_supported;
} hm_attrs_t; } hm_attrs_t;
@ -1210,6 +1210,11 @@ typedef struct
hm_attrs_t *hm_device; hm_attrs_t *hm_device;
ADLOD6MemClockState *od_clock_mem_status;
int *od_power_control_status;
unsigned int *nvml_power_limit;
} hwmon_ctx_t; } hwmon_ctx_t;
typedef struct typedef struct
@ -1245,16 +1250,6 @@ typedef struct
u32 shutdown_inner; u32 shutdown_inner;
u32 shutdown_outer; u32 shutdown_outer;
/**
* hardware watchdog
*/
void *hm_adl;
void *hm_nvml;
void *hm_nvapi;
void *hm_xnvctrl;
hm_attrs_t hm_device[DEVICES_MAX];
/** /**
* crack-per-time * crack-per-time
*/ */

View File

@ -224,7 +224,7 @@ static void goodbye_screen (const user_options_t *user_options, const time_t *pr
log_info_nn ("Stopped: %s", ctime (proc_stop)); log_info_nn ("Stopped: %s", ctime (proc_stop));
} }
static int inner1_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, logfile_ctx_t *logfile_ctx, induct_ctx_t *induct_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hashconfig_t *hashconfig, hashes_t *hashes, wl_data_t *wl_data, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx) static int inner1_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, logfile_ctx_t *logfile_ctx, induct_ctx_t *induct_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx, hashconfig_t *hashconfig, hashes_t *hashes, wl_data_t *wl_data, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx)
{ {
//opencl_ctx->run_main_level1 = true; //opencl_ctx->run_main_level1 = true;
//opencl_ctx->run_main_level2 = true; //opencl_ctx->run_main_level2 = true;
@ -1365,7 +1365,7 @@ static int inner1_loop (user_options_t *user_options, user_options_extra_t *user
if (hashes->digests_saved != hashes->digests_done) log_info (""); if (hashes->digests_saved != hashes->digests_done) log_info ("");
status_display (opencl_ctx, hashconfig, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx); status_display (opencl_ctx, hwmon_ctx, hashconfig, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
log_info (""); log_info ("");
} }
@ -1373,7 +1373,7 @@ static int inner1_loop (user_options_t *user_options, user_options_extra_t *user
{ {
if (user_options->status == true) if (user_options->status == true)
{ {
status_display (opencl_ctx, hashconfig, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx); status_display (opencl_ctx, hwmon_ctx, hashconfig, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
log_info (""); log_info ("");
} }
@ -1420,7 +1420,7 @@ static int inner1_loop (user_options_t *user_options, user_options_extra_t *user
return 0; return 0;
} }
static int outer_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, folder_config_t *folder_config, logfile_ctx_t *logfile_ctx, tuning_db_t *tuning_db, induct_ctx_t *induct_ctx, outcheck_ctx_t *outcheck_ctx, outfile_ctx_t *outfile_ctx, potfile_ctx_t *potfile_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx) static int outer_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, folder_config_t *folder_config, logfile_ctx_t *logfile_ctx, tuning_db_t *tuning_db, induct_ctx_t *induct_ctx, outcheck_ctx_t *outcheck_ctx, outfile_ctx_t *outfile_ctx, potfile_ctx_t *potfile_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx)
{ {
opencl_ctx->devices_status = STATUS_INIT; opencl_ctx->devices_status = STATUS_INIT;
@ -1657,27 +1657,27 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
* Watchdog and Temperature balance * Watchdog and Temperature balance
*/ */
if (user_options->gpu_temp_disable == false && data.hm_adl == NULL && data.hm_nvml == NULL && data.hm_xnvctrl == NULL) if (hwmon_ctx->enabled == false && user_options->gpu_temp_disable == false)
{ {
log_info ("Watchdog: Hardware Monitoring Interface not found on your system"); log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
} }
if (user_options->gpu_temp_abort == 0) if (hwmon_ctx->enabled == true && user_options->gpu_temp_abort > 0)
{
log_info ("Watchdog: Temperature abort trigger disabled");
}
else
{ {
log_info ("Watchdog: Temperature abort trigger set to %uc", user_options->gpu_temp_abort); log_info ("Watchdog: Temperature abort trigger set to %uc", user_options->gpu_temp_abort);
} }
else
if (user_options->gpu_temp_retain == 0)
{ {
log_info ("Watchdog: Temperature retain trigger disabled"); log_info ("Watchdog: Temperature abort trigger disabled");
}
if (hwmon_ctx->enabled == true && user_options->gpu_temp_retain > 0)
{
log_info ("Watchdog: Temperature retain trigger set to %uc", user_options->gpu_temp_retain);
} }
else else
{ {
log_info ("Watchdog: Temperature retain trigger set to %uc", user_options->gpu_temp_retain); log_info ("Watchdog: Temperature retain trigger disabled");
} }
if (user_options->quiet == false) log_info (""); if (user_options->quiet == false) log_info ("");
@ -1822,7 +1822,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
mask_ctx->masks_pos = masks_pos; mask_ctx->masks_pos = masks_pos;
const int rc_inner1_loop = inner1_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hashconfig, hashes, wl_data, straight_ctx, combinator_ctx, mask_ctx); const int rc_inner1_loop = inner1_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, wl_data, straight_ctx, combinator_ctx, mask_ctx);
if (rc_inner1_loop == -1) return -1; if (rc_inner1_loop == -1) return -1;
@ -1831,7 +1831,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
} }
else else
{ {
const int rc_inner1_loop = inner1_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hashconfig, hashes, wl_data, straight_ctx, combinator_ctx, mask_ctx); const int rc_inner1_loop = inner1_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, wl_data, straight_ctx, combinator_ctx, mask_ctx);
if (rc_inner1_loop == -1) return -1; if (rc_inner1_loop == -1) return -1;
} }
@ -2223,7 +2223,7 @@ int main (int argc, char **argv)
data.hwmon_ctx = hwmon_ctx; data.hwmon_ctx = hwmon_ctx;
const int rc_hwmon_init = hwmon_ctx_init (hwmon_ctx, user_options); const int rc_hwmon_init = hwmon_ctx_init (hwmon_ctx, user_options, opencl_ctx);
if (rc_hwmon_init == -1) if (rc_hwmon_init == -1)
{ {
@ -2232,480 +2232,6 @@ int main (int argc, char **argv)
return -1; return -1;
} }
hm_attrs_t hm_adapters_adl[DEVICES_MAX];
hm_attrs_t hm_adapters_nvapi[DEVICES_MAX];
hm_attrs_t hm_adapters_nvml[DEVICES_MAX];
hm_attrs_t hm_adapters_xnvctrl[DEVICES_MAX];
memset (hm_adapters_adl, 0, sizeof (hm_adapters_adl));
memset (hm_adapters_nvapi, 0, sizeof (hm_adapters_nvapi));
memset (hm_adapters_nvml, 0, sizeof (hm_adapters_nvml));
memset (hm_adapters_xnvctrl, 0, sizeof (hm_adapters_xnvctrl));
if (user_options->gpu_temp_disable == false)
{
ADL_PTR *adl = (ADL_PTR *) mymalloc (sizeof (ADL_PTR));
NVAPI_PTR *nvapi = (NVAPI_PTR *) mymalloc (sizeof (NVAPI_PTR));
NVML_PTR *nvml = (NVML_PTR *) mymalloc (sizeof (NVML_PTR));
XNVCTRL_PTR *xnvctrl = (XNVCTRL_PTR *) mymalloc (sizeof (XNVCTRL_PTR));
data.hm_adl = NULL;
data.hm_nvapi = NULL;
data.hm_nvml = NULL;
data.hm_xnvctrl = NULL;
if ((opencl_ctx->need_nvml == true) && (nvml_init (nvml) == 0))
{
data.hm_nvml = nvml;
}
if (data.hm_nvml)
{
if (hm_NVML_nvmlInit (data.hm_nvml) == NVML_SUCCESS)
{
HM_ADAPTER_NVML nvmlGPUHandle[DEVICES_MAX] = { 0 };
int tmp_in = hm_get_adapter_index_nvml (nvmlGPUHandle);
int tmp_out = 0;
for (int i = 0; i < tmp_in; i++)
{
hm_adapters_nvml[tmp_out++].nvml = nvmlGPUHandle[i];
}
for (int i = 0; i < tmp_out; i++)
{
unsigned int speed;
if (hm_NVML_nvmlDeviceGetFanSpeed (data.hm_nvml, 0, hm_adapters_nvml[i].nvml, &speed) == NVML_SUCCESS) hm_adapters_nvml[i].fan_get_supported = 1;
// doesn't seem to create any advantages
//hm_NVML_nvmlDeviceSetComputeMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
//hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_GOM_ALL_ON);
}
}
}
if ((opencl_ctx->need_nvapi == true) && (nvapi_init (nvapi) == 0))
{
data.hm_nvapi = nvapi;
}
if (data.hm_nvapi)
{
if (hm_NvAPI_Initialize (data.hm_nvapi) == NVAPI_OK)
{
HM_ADAPTER_NVAPI nvGPUHandle[DEVICES_MAX] = { 0 };
int tmp_in = hm_get_adapter_index_nvapi (nvGPUHandle);
int tmp_out = 0;
for (int i = 0; i < tmp_in; i++)
{
hm_adapters_nvapi[tmp_out++].nvapi = nvGPUHandle[i];
}
}
}
if ((opencl_ctx->need_xnvctrl == true) && (xnvctrl_init (xnvctrl) == 0))
{
data.hm_xnvctrl = xnvctrl;
}
if (data.hm_xnvctrl)
{
if (hm_XNVCTRL_XOpenDisplay (data.hm_xnvctrl) == 0)
{
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if ((device_param->device_type & CL_DEVICE_TYPE_GPU) == 0) continue;
hm_adapters_xnvctrl[device_id].xnvctrl = device_id;
int speed = 0;
if (get_fan_speed_current (data.hm_xnvctrl, device_id, &speed) == 0) hm_adapters_xnvctrl[device_id].fan_get_supported = 1;
}
}
}
if ((opencl_ctx->need_adl == true) && (adl_init (adl) == 0))
{
data.hm_adl = adl;
}
if (data.hm_adl)
{
if (hm_ADL_Main_Control_Create (data.hm_adl, ADL_Main_Memory_Alloc, 0) == ADL_OK)
{
// total number of adapters
int hm_adapters_num;
if (get_adapters_num_adl (data.hm_adl, &hm_adapters_num) != 0) return -1;
// adapter info
LPAdapterInfo lpAdapterInfo = hm_get_adapter_info_adl (data.hm_adl, hm_adapters_num);
if (lpAdapterInfo == NULL) return -1;
// get a list (of ids of) valid/usable adapters
int num_adl_adapters = 0;
u32 *valid_adl_device_list = hm_get_list_valid_adl_adapters (hm_adapters_num, &num_adl_adapters, lpAdapterInfo);
if (num_adl_adapters > 0)
{
hc_thread_mutex_lock (mux_hwmon);
// hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
hm_get_adapter_index_adl (hm_adapters_adl, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
hm_get_overdrive_version (data.hm_adl, hm_adapters_adl, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
hm_check_fanspeed_control (data.hm_adl, hm_adapters_adl, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
hc_thread_mutex_unlock (mux_hwmon);
}
myfree (valid_adl_device_list);
myfree (lpAdapterInfo);
}
}
if (data.hm_adl == NULL && data.hm_nvml == NULL && data.hm_xnvctrl == NULL)
{
user_options->gpu_temp_disable = true;
}
}
/**
* User-defined GPU temp handling
*/
if (user_options->gpu_temp_disable == true)
{
user_options->gpu_temp_abort = 0;
user_options->gpu_temp_retain = 0;
}
/**
* OpenCL devices: allocate buffer for device specific information
*/
ADLOD6MemClockState *od_clock_mem_status = (ADLOD6MemClockState *) mycalloc (opencl_ctx->devices_cnt, sizeof (ADLOD6MemClockState));
int *od_power_control_status = (int *) mycalloc (opencl_ctx->devices_cnt, sizeof (int));
unsigned int *nvml_power_limit = (unsigned int *) mycalloc (opencl_ctx->devices_cnt, sizeof (unsigned int));
/**
* HM devices: copy
*/
if (user_options->gpu_temp_disable == false)
{
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if ((device_param->device_type & CL_DEVICE_TYPE_GPU) == 0) continue;
if (device_param->skipped) continue;
const uint platform_devices_id = device_param->platform_devices_id;
if (device_param->device_vendor_id == VENDOR_ID_AMD)
{
data.hm_device[device_id].adl = hm_adapters_adl[platform_devices_id].adl;
data.hm_device[device_id].nvapi = 0;
data.hm_device[device_id].nvml = 0;
data.hm_device[device_id].xnvctrl = 0;
data.hm_device[device_id].od_version = hm_adapters_adl[platform_devices_id].od_version;
data.hm_device[device_id].fan_get_supported = hm_adapters_adl[platform_devices_id].fan_get_supported;
data.hm_device[device_id].fan_set_supported = 0;
}
if (device_param->device_vendor_id == VENDOR_ID_NV)
{
data.hm_device[device_id].adl = 0;
data.hm_device[device_id].nvapi = hm_adapters_nvapi[platform_devices_id].nvapi;
data.hm_device[device_id].nvml = hm_adapters_nvml[platform_devices_id].nvml;
data.hm_device[device_id].xnvctrl = hm_adapters_xnvctrl[platform_devices_id].xnvctrl;
data.hm_device[device_id].od_version = 0;
data.hm_device[device_id].fan_get_supported = hm_adapters_nvml[platform_devices_id].fan_get_supported;
data.hm_device[device_id].fan_set_supported = 0;
}
}
}
/**
* powertune on user request
*/
if (user_options->powertune_enable == true)
{
hc_thread_mutex_lock (mux_hwmon);
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if (device_param->skipped) continue;
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
{
/**
* 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?
*/
if (data.hm_device[device_id].od_version == 6)
{
int ADL_rc;
// check powertune capabilities first, if not available then skip device
int powertune_supported = 0;
if ((ADL_rc = hm_ADL_Overdrive6_PowerControl_Caps (data.hm_adl, data.hm_device[device_id].adl, &powertune_supported)) != ADL_OK)
{
log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
return -1;
}
// first backup current value, we will restore it later
if (powertune_supported != 0)
{
// powercontrol settings
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_adl, data.hm_device[device_id].adl, &powertune)) == ADL_OK)
{
ADL_rc = hm_ADL_Overdrive_PowerControl_Get (data.hm_adl, data.hm_device[device_id].adl, &od_power_control_status[device_id]);
}
if (ADL_rc != ADL_OK)
{
log_error ("ERROR: Failed to get current ADL PowerControl settings");
return -1;
}
if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adl, powertune.iMaxValue)) != ADL_OK)
{
log_error ("ERROR: Failed to set new ADL PowerControl values");
return -1;
}
// clocks
memset (&od_clock_mem_status[device_id], 0, sizeof (ADLOD6MemClockState));
od_clock_mem_status[device_id].state.iNumberOfPerformanceLevels = 2;
if ((ADL_rc = hm_ADL_Overdrive_StateInfo_Get (data.hm_adl, data.hm_device[device_id].adl, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE, &od_clock_mem_status[device_id])) != ADL_OK)
{
log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
return -1;
}
// Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
ADLOD6Capabilities caps = {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
if ((ADL_rc = hm_ADL_Overdrive_Capabilities_Get (data.hm_adl, data.hm_device[device_id].adl, &caps)) != ADL_OK)
{
log_error ("ERROR: Failed to get ADL device capabilities");
return -1;
}
int engine_clock_max = (int) (0.6666 * caps.sEngineClockRange.iMax);
int memory_clock_max = (int) (0.6250 * caps.sMemoryClockRange.iMax);
int warning_trigger_engine = (int) (0.25 * engine_clock_max);
int warning_trigger_memory = (int) (0.25 * memory_clock_max);
int engine_clock_profile_max = od_clock_mem_status[device_id].state.aLevels[1].iEngineClock;
int memory_clock_profile_max = od_clock_mem_status[device_id].state.aLevels[1].iMemoryClock;
// warning if profile has too low max values
if ((engine_clock_max - engine_clock_profile_max) > warning_trigger_engine)
{
log_info ("WARN: The custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
}
if ((memory_clock_max - memory_clock_profile_max) > warning_trigger_memory)
{
log_info ("WARN: The custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
}
ADLOD6StateInfo *performance_state = (ADLOD6StateInfo*) mycalloc (1, sizeof (ADLOD6StateInfo) + sizeof (ADLOD6PerformanceLevel));
performance_state->iNumberOfPerformanceLevels = 2;
performance_state->aLevels[0].iEngineClock = engine_clock_profile_max;
performance_state->aLevels[1].iEngineClock = engine_clock_profile_max;
performance_state->aLevels[0].iMemoryClock = memory_clock_profile_max;
performance_state->aLevels[1].iMemoryClock = memory_clock_profile_max;
if ((ADL_rc = hm_ADL_Overdrive_State_Set (data.hm_adl, data.hm_device[device_id].adl, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
{
log_info ("ERROR: Failed to set ADL performance state");
return -1;
}
myfree (performance_state);
}
// set powertune value only
if (powertune_supported != 0)
{
// powertune set
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_adl, data.hm_device[device_id].adl, &powertune)) != ADL_OK)
{
log_error ("ERROR: Failed to get current ADL PowerControl settings");
return -1;
}
if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adl, powertune.iMaxValue)) != ADL_OK)
{
log_error ("ERROR: Failed to set new ADL PowerControl values");
return -1;
}
}
}
}
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
{
// first backup current value, we will restore it later
unsigned int limit;
bool powertune_supported = false;
if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].nvml, &limit) == NVML_SUCCESS)
{
powertune_supported = true;
}
// if backup worked, activate the maximum allowed
if (powertune_supported == true)
{
unsigned int minLimit;
unsigned int maxLimit;
if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data.hm_nvml, 0, data.hm_device[device_id].nvml, &minLimit, &maxLimit) == NVML_SUCCESS)
{
if (maxLimit > 0)
{
if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].nvml, maxLimit) == NVML_SUCCESS)
{
// now we can be sure we need to reset later
nvml_power_limit[device_id] = limit;
}
}
}
}
}
}
hc_thread_mutex_unlock (mux_hwmon);
}
/**
* Store initial fanspeed if gpu_temp_retain is enabled
*/
if (user_options->gpu_temp_disable == false)
{
if (user_options->gpu_temp_retain)
{
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if (device_param->skipped) continue;
hc_thread_mutex_lock (mux_hwmon);
if (data.hm_device[device_id].fan_get_supported == true)
{
const int fanspeed = hm_get_fanspeed_with_device_id (opencl_ctx, device_id);
const int fanpolicy = hm_get_fanpolicy_with_device_id (opencl_ctx, device_id);
// we also set it to tell the OS we take control over the fan and it's automatic controller
// if it was set to automatic. we do not control user-defined fanspeeds.
if (fanpolicy == 1)
{
data.hm_device[device_id].fan_set_supported = true;
int rc = -1;
if (device_param->device_vendor_id == VENDOR_ID_AMD)
{
rc = hm_set_fanspeed_with_device_id_adl (device_id, fanspeed, 1);
}
else if (device_param->device_vendor_id == VENDOR_ID_NV)
{
#if defined (__linux__)
rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE);
#endif
#if defined (_WIN)
rc = hm_set_fanspeed_with_device_id_nvapi (device_id, fanspeed, 1);
#endif
}
if (rc == 0)
{
data.hm_device[device_id].fan_set_supported = 1;
}
else
{
log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id + 1);
data.hm_device[device_id].fan_set_supported = 0;
}
}
else
{
data.hm_device[device_id].fan_set_supported = 0;
}
}
hc_thread_mutex_unlock (mux_hwmon);
}
}
}
/** /**
* keypress thread * keypress thread
*/ */
@ -2736,7 +2262,7 @@ int main (int argc, char **argv)
if (user_options->hash_mode_chgd == true) if (user_options->hash_mode_chgd == true)
{ {
const int rc = outer_loop (user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx); const int rc = outer_loop (user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx);
if (rc == -1) return -1; if (rc == -1) return -1;
} }
@ -2746,7 +2272,7 @@ int main (int argc, char **argv)
{ {
user_options->hash_mode = DEFAULT_BENCHMARK_ALGORITHMS_BUF[algorithm_pos]; user_options->hash_mode = DEFAULT_BENCHMARK_ALGORITHMS_BUF[algorithm_pos];
const int rc = outer_loop (user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx); const int rc = outer_loop (user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx);
if (rc == -1) return -1; if (rc == -1) return -1;
@ -2756,7 +2282,7 @@ int main (int argc, char **argv)
} }
else else
{ {
const int rc = outer_loop (user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx); const int rc = outer_loop (user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx);
if (rc == -1) return -1; if (rc == -1) return -1;
} }
@ -2777,161 +2303,6 @@ int main (int argc, char **argv)
user_options->quiet = false; user_options->quiet = false;
} }
// reset default fan speed
if (user_options->gpu_temp_disable == false)
{
if (user_options->gpu_temp_retain)
{
hc_thread_mutex_lock (mux_hwmon);
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if (device_param->skipped) continue;
if (data.hm_device[device_id].fan_set_supported == true)
{
int rc = -1;
if (device_param->device_vendor_id == VENDOR_ID_AMD)
{
rc = hm_set_fanspeed_with_device_id_adl (device_id, 100, 0);
}
else if (device_param->device_vendor_id == VENDOR_ID_NV)
{
#if defined (__linux__)
rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE);
#endif
#if defined (_WIN)
rc = hm_set_fanspeed_with_device_id_nvapi (device_id, 100, 0);
#endif
}
if (rc == -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id + 1);
}
}
hc_thread_mutex_unlock (mux_hwmon);
}
}
// reset power tuning
if (user_options->powertune_enable == true)
{
hc_thread_mutex_lock (mux_hwmon);
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if (device_param->skipped) continue;
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
{
if (data.hm_device[device_id].od_version == 6)
{
// check powertune capabilities first, if not available then skip device
int powertune_supported = 0;
if ((hm_ADL_Overdrive6_PowerControl_Caps (data.hm_adl, data.hm_device[device_id].adl, &powertune_supported)) != ADL_OK)
{
log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
return -1;
}
if (powertune_supported != 0)
{
// powercontrol settings
if ((hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adl, od_power_control_status[device_id])) != ADL_OK)
{
log_info ("ERROR: Failed to restore the ADL PowerControl values");
return -1;
}
// clocks
ADLOD6StateInfo *performance_state = (ADLOD6StateInfo*) mycalloc (1, sizeof (ADLOD6StateInfo) + sizeof (ADLOD6PerformanceLevel));
performance_state->iNumberOfPerformanceLevels = 2;
performance_state->aLevels[0].iEngineClock = od_clock_mem_status[device_id].state.aLevels[0].iEngineClock;
performance_state->aLevels[1].iEngineClock = od_clock_mem_status[device_id].state.aLevels[1].iEngineClock;
performance_state->aLevels[0].iMemoryClock = od_clock_mem_status[device_id].state.aLevels[0].iMemoryClock;
performance_state->aLevels[1].iMemoryClock = od_clock_mem_status[device_id].state.aLevels[1].iMemoryClock;
if ((hm_ADL_Overdrive_State_Set (data.hm_adl, data.hm_device[device_id].adl, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
{
log_info ("ERROR: Failed to restore ADL performance state");
return -1;
}
myfree (performance_state);
}
}
}
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
{
unsigned int power_limit = nvml_power_limit[device_id];
if (power_limit > 0)
{
hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].nvml, power_limit);
}
}
}
hc_thread_mutex_unlock (mux_hwmon);
}
if (user_options->gpu_temp_disable == false)
{
if (data.hm_nvml)
{
hm_NVML_nvmlShutdown (data.hm_nvml);
nvml_close (data.hm_nvml);
data.hm_nvml = NULL;
}
if (data.hm_nvapi)
{
hm_NvAPI_Unload (data.hm_nvapi);
nvapi_close (data.hm_nvapi);
data.hm_nvapi = NULL;
}
if (data.hm_xnvctrl)
{
hm_XNVCTRL_XCloseDisplay (data.hm_xnvctrl);
xnvctrl_close (data.hm_xnvctrl);
data.hm_xnvctrl = NULL;
}
if (data.hm_adl)
{
hm_ADL_Main_Control_Destroy (data.hm_adl);
adl_close (data.hm_adl);
data.hm_adl = NULL;
}
}
// destroy others mutex // destroy others mutex
hc_thread_mutex_delete (mux_display); hc_thread_mutex_delete (mux_display);
@ -2939,10 +2310,6 @@ int main (int argc, char **argv)
// free memory // free memory
myfree (od_clock_mem_status);
myfree (od_power_control_status);
myfree (nvml_power_limit);
debugfile_destroy (debugfile_ctx); debugfile_destroy (debugfile_ctx);
tuning_db_destroy (tuning_db); tuning_db_destroy (tuning_db);
@ -2963,9 +2330,9 @@ int main (int argc, char **argv)
user_options_extra_destroy (user_options_extra); user_options_extra_destroy (user_options_extra);
opencl_ctx_devices_destroy (opencl_ctx); hwmon_ctx_destroy (hwmon_ctx, user_options, opencl_ctx);
hwmon_ctx_destroy (hwmon_ctx); opencl_ctx_devices_destroy (opencl_ctx);
restore_ctx_destroy (restore_ctx); restore_ctx_destroy (restore_ctx);

File diff suppressed because it is too large Load Diff

View File

@ -48,6 +48,7 @@ void *thread_monitor (void *p)
combinator_ctx_t *combinator_ctx = data.combinator_ctx; combinator_ctx_t *combinator_ctx = data.combinator_ctx;
mask_ctx_t *mask_ctx = data.mask_ctx; mask_ctx_t *mask_ctx = data.mask_ctx;
opencl_ctx_t *opencl_ctx = data.opencl_ctx; opencl_ctx_t *opencl_ctx = data.opencl_ctx;
hwmon_ctx_t *hwmon_ctx = data.hwmon_ctx;
bool runtime_check = false; bool runtime_check = false;
bool remove_check = false; bool remove_check = false;
@ -127,7 +128,7 @@ void *thread_monitor (void *p)
if (device_param->device_vendor_id == VENDOR_ID_NV) if (device_param->device_vendor_id == VENDOR_ID_NV)
{ {
if (data.hm_nvapi) if (hwmon_ctx->hm_nvapi)
{ {
NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info; NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info;
NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status; NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status;
@ -138,11 +139,11 @@ void *thread_monitor (void *p)
perfPolicies_info.version = MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1, 1); perfPolicies_info.version = MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1, 1);
perfPolicies_status.version = MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1, 1); perfPolicies_status.version = MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1, 1);
hm_NvAPI_GPU_GetPerfPoliciesInfo (data.hm_nvapi, data.hm_device[device_id].nvapi, &perfPolicies_info); hm_NvAPI_GPU_GetPerfPoliciesInfo (hwmon_ctx->hm_nvapi, hwmon_ctx->hm_device[device_id].nvapi, &perfPolicies_info);
perfPolicies_status.info_value = perfPolicies_info.info_value; perfPolicies_status.info_value = perfPolicies_info.info_value;
hm_NvAPI_GPU_GetPerfPoliciesStatus (data.hm_nvapi, data.hm_device[device_id].nvapi, &perfPolicies_status); hm_NvAPI_GPU_GetPerfPoliciesStatus (hwmon_ctx->hm_nvapi, hwmon_ctx->hm_device[device_id].nvapi, &perfPolicies_status);
if (perfPolicies_status.throttle & 2) if (perfPolicies_status.throttle & 2)
{ {
@ -193,7 +194,7 @@ void *thread_monitor (void *p)
if ((opencl_ctx->devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) continue; if ((opencl_ctx->devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) continue;
const int temperature = hm_get_temperature_with_device_id (opencl_ctx, device_id); const int temperature = hm_get_temperature_with_device_id (hwmon_ctx, opencl_ctx, device_id);
if (temperature > (int) user_options->gpu_temp_abort) if (temperature > (int) user_options->gpu_temp_abort)
{ {
@ -208,7 +209,7 @@ void *thread_monitor (void *p)
if (gpu_temp_retain) if (gpu_temp_retain)
{ {
if (data.hm_device[device_id].fan_set_supported == 1) if (hwmon_ctx->hm_device[device_id].fan_set_supported == 1)
{ {
int temp_cur = temperature; int temp_cur = temperature;
@ -230,7 +231,7 @@ void *thread_monitor (void *p)
if (abs (fan_diff_required) >= temp_threshold) if (abs (fan_diff_required) >= temp_threshold)
{ {
const int fan_speed_cur = hm_get_fanspeed_with_device_id (opencl_ctx, device_id); const int fan_speed_cur = hm_get_fanspeed_with_device_id (hwmon_ctx, opencl_ctx, device_id);
int fan_speed_level = fan_speed_cur; int fan_speed_level = fan_speed_cur;
@ -250,16 +251,16 @@ void *thread_monitor (void *p)
{ {
if (device_param->device_vendor_id == VENDOR_ID_AMD) if (device_param->device_vendor_id == VENDOR_ID_AMD)
{ {
hm_set_fanspeed_with_device_id_adl (device_id, fan_speed_new, 1); hm_set_fanspeed_with_device_id_adl (hwmon_ctx, device_id, fan_speed_new, 1);
} }
else if (device_param->device_vendor_id == VENDOR_ID_NV) else if (device_param->device_vendor_id == VENDOR_ID_NV)
{ {
#if defined (_WIN) #if defined (_WIN)
hm_set_fanspeed_with_device_id_nvapi (device_id, fan_speed_new, 1); hm_set_fanspeed_with_device_id_nvapi (hwmon_ctx, device_id, fan_speed_new, 1);
#endif #endif
#if defined (__linux__) #if defined (__linux__)
hm_set_fanspeed_with_device_id_xnvctrl (device_id, fan_speed_new); hm_set_fanspeed_with_device_id_xnvctrl (hwmon_ctx, device_id, fan_speed_new);
#endif #endif
} }
@ -347,7 +348,7 @@ void *thread_monitor (void *p)
if (user_options->quiet == false) log_info (""); if (user_options->quiet == false) log_info ("");
status_display (opencl_ctx, hashconfig, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx); status_display (opencl_ctx, hwmon_ctx, hashconfig, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
if (user_options->quiet == false) log_info (""); if (user_options->quiet == false) log_info ("");

View File

@ -40,8 +40,6 @@
extern hc_global_data_t data; extern hc_global_data_t data;
extern hc_thread_mutex_t mux_hwmon;
extern const int comptime; extern const int comptime;
static const u32 full01 = 0x01010101; static const u32 full01 = 0x01010101;
@ -2262,13 +2260,16 @@ int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *use
{ {
char *format = " Device ID #%u\n Type : %s\n Vendor ID : %u\n Vendor : %s\n Name : %s\n Processor(s) : %u\n Clock : %u\n Memory : %lu/%lu MB allocatable\n OpenCL Version : %s\n\n"; char *format = " Device ID #%u\n Type : %s\n Vendor ID : %u\n Vendor : %s\n Name : %s\n Processor(s) : %u\n Clock : %u\n Memory : %lu/%lu MB allocatable\n OpenCL Version : %s\n\n";
fprintf(stdout, format, device_id + 1, fprintf (stdout, format, device_id + 1,
((device_type & CL_DEVICE_TYPE_CPU) ? "CPU" : ((device_type & CL_DEVICE_TYPE_GPU) ? "GPU" : "Accelerator")), ((device_type & CL_DEVICE_TYPE_CPU) ? "CPU" : ((device_type & CL_DEVICE_TYPE_GPU) ? "GPU" : "Accelerator")),
device_vendor_id, device_vendor, device_vendor_id,
device_name, device_processors, device_vendor,
device_maxclock_frequency, device_name,
device_maxmem_alloc/1024/1024, device_global_mem/1024/1024, device_processors,
device_opencl_version); device_maxclock_frequency,
device_maxmem_alloc / 1024 / 1024,
device_global_mem / 1024 / 1024,
device_opencl_version);
} }
myfree (device_opencl_version); myfree (device_opencl_version);

View File

@ -164,7 +164,7 @@ double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_en
return exec_ms_sum / exec_ms_cnt; return exec_ms_sum / exec_ms_cnt;
} }
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx) void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx)
{ {
if (opencl_ctx->devices_status == STATUS_INIT) if (opencl_ctx->devices_status == STATUS_INIT)
{ {
@ -297,7 +297,7 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *
if (device_param->skipped) continue; if (device_param->skipped) continue;
int temp = hm_get_temperature_with_device_id (opencl_ctx, device_id); int temp = hm_get_temperature_with_device_id (hwmon_ctx, opencl_ctx, device_id);
fprintf (out, "%d\t", temp); fprintf (out, "%d\t", temp);
} }
@ -313,7 +313,7 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *
fflush (out); fflush (out);
} }
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx) void status_display (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx)
{ {
if (opencl_ctx->devices_status == STATUS_INIT) if (opencl_ctx->devices_status == STATUS_INIT)
{ {
@ -327,7 +327,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
if (user_options->machine_readable == true) if (user_options->machine_readable == true)
{ {
status_display_machine_readable (opencl_ctx, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx); status_display_machine_readable (opencl_ctx, hwmon_ctx, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
return; return;
} }
@ -1026,13 +1026,13 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
if (device_param->skipped) continue; if (device_param->skipped) continue;
const int num_temperature = hm_get_temperature_with_device_id (opencl_ctx, device_id); const int num_temperature = hm_get_temperature_with_device_id (hwmon_ctx, opencl_ctx, device_id);
const int num_fanspeed = hm_get_fanspeed_with_device_id (opencl_ctx, device_id); const int num_fanspeed = hm_get_fanspeed_with_device_id (hwmon_ctx, opencl_ctx, device_id);
const int num_utilization = hm_get_utilization_with_device_id (opencl_ctx, device_id); const int num_utilization = hm_get_utilization_with_device_id (hwmon_ctx, opencl_ctx, device_id);
const int num_corespeed = hm_get_corespeed_with_device_id (opencl_ctx, device_id); const int num_corespeed = hm_get_corespeed_with_device_id (hwmon_ctx, opencl_ctx, device_id);
const int num_memoryspeed = hm_get_memoryspeed_with_device_id (opencl_ctx, device_id); const int num_memoryspeed = hm_get_memoryspeed_with_device_id (hwmon_ctx, opencl_ctx, device_id);
const int num_buslanes = hm_get_buslanes_with_device_id (opencl_ctx, device_id); const int num_buslanes = hm_get_buslanes_with_device_id (hwmon_ctx, opencl_ctx, device_id);
const int num_throttle = hm_get_throttle_with_device_id (opencl_ctx, device_id); const int num_throttle = hm_get_throttle_with_device_id (hwmon_ctx, opencl_ctx, device_id);
char output_buf[256] = { 0 }; char output_buf[256] = { 0 };

View File

@ -71,6 +71,7 @@ void *thread_keypress (void *p)
straight_ctx_t *straight_ctx = data.straight_ctx; straight_ctx_t *straight_ctx = data.straight_ctx;
combinator_ctx_t *combinator_ctx = data.combinator_ctx; combinator_ctx_t *combinator_ctx = data.combinator_ctx;
mask_ctx_t *mask_ctx = data.mask_ctx; mask_ctx_t *mask_ctx = data.mask_ctx;
hwmon_ctx_t *hwmon_ctx = data.hwmon_ctx;
const bool quiet = user_options->quiet; const bool quiet = user_options->quiet;
@ -101,7 +102,7 @@ void *thread_keypress (void *p)
log_info (""); log_info ("");
status_display (opencl_ctx, hashconfig, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx); status_display (opencl_ctx, hwmon_ctx, hashconfig, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
log_info (""); log_info ("");

View File

@ -720,6 +720,12 @@ int user_options_sanity (user_options_t *user_options, restore_ctx_t *restore_ct
return -1; return -1;
} }
if (user_options->gpu_temp_disable == true)
{
user_options->gpu_temp_abort = 0;
user_options->gpu_temp_retain = 0;
}
if ((user_options->gpu_temp_abort != 0) && (user_options->gpu_temp_retain != 0)) if ((user_options->gpu_temp_abort != 0) && (user_options->gpu_temp_retain != 0))
{ {
if (user_options->gpu_temp_abort < user_options->gpu_temp_retain) if (user_options->gpu_temp_abort < user_options->gpu_temp_retain)