From 4d2be9073e20e5c5457618cc6e8db373c89c5565 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Thu, 4 Feb 2016 15:07:38 +0100 Subject: [PATCH] Consolidate hardware monitoring interface status on startup --- src/ext_ADL.c | 4 +- src/ext_nvapi.c | 4 +- src/ext_nvml.c | 4 +- src/oclHashcat.c | 224 +++++++++++++++++++++++++---------------------- 4 files changed, 123 insertions(+), 113 deletions(-) diff --git a/src/ext_ADL.c b/src/ext_ADL.c index 3b29bd4de..9d27634d6 100644 --- a/src/ext_ADL.c +++ b/src/ext_ADL.c @@ -22,8 +22,8 @@ int adl_init (ADL_PTR *adl) if (!adl->lib) { - if (data.quiet == 0) - log_info ("WARNING: load ADL library failed, proceed without ADL HWMon enabled."); + //if (data.quiet == 0) + // log_info ("WARNING: load ADL library failed, proceed without ADL HWMon enabled."); return (-1); } diff --git a/src/ext_nvapi.c b/src/ext_nvapi.c index 0d808db5f..f239b5b8f 100644 --- a/src/ext_nvapi.c +++ b/src/ext_nvapi.c @@ -21,8 +21,8 @@ int nvapi_init (NVAPI_PTR *nvapi) if (!nvapi->lib) { - if (data.quiet == 0) - log_info ("WARNING: load NVAPI library failed, proceed without NVAPI HWMon enabled."); + //if (data.quiet == 0) + // log_info ("WARNING: load NVAPI library failed, proceed without NVAPI HWMon enabled."); return (-1); } diff --git a/src/ext_nvml.c b/src/ext_nvml.c index 9d194f6af..4eb02ebba 100644 --- a/src/ext_nvml.c +++ b/src/ext_nvml.c @@ -17,8 +17,8 @@ int nvml_init (NVML_PTR *nvml) if (!nvml->lib) { - if (data.quiet == 0) - log_info ("WARNING: load NVML library failed, proceed without NVML HWMon enabled."); + //if (data.quiet == 0) + // log_info ("WARNING: load NVML library failed, proceed without NVML HWMon enabled."); return (-1); } diff --git a/src/oclHashcat.c b/src/oclHashcat.c index 0b5eef06c..f3d4663f3 100644 --- a/src/oclHashcat.c +++ b/src/oclHashcat.c @@ -13000,113 +13000,6 @@ int main (int argc, char **argv) log_info (""); } - /** - * OpenCL devices: allocate buffer for device specific information - */ - - #ifdef HAVE_HWMON - int *temp_retain_fanspeed_value = (int *) mycalloc (devices_cnt, sizeof (int)); - - #ifdef HAVE_ADL - ADLOD6MemClockState *od_clock_mem_status = (ADLOD6MemClockState *) mycalloc (devices_cnt, sizeof (ADLOD6MemClockState)); - - int *od_power_control_status = (int *) mycalloc (devices_cnt, sizeof (int)); - #endif // ADL - #endif - - /** - * enable custom signal handler(s) - */ - - if (benchmark == 0) - { - hc_signal (sigHandler_default); - } - else - { - hc_signal (sigHandler_benchmark); - } - - /** - * User-defined GPU temp handling - */ - - #ifdef HAVE_HWMON - if (gpu_temp_disable == 1) - { - gpu_temp_abort = 0; - gpu_temp_retain = 0; - } - - if ((gpu_temp_abort != 0) && (gpu_temp_retain != 0)) - { - if (gpu_temp_abort < gpu_temp_retain) - { - log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain."); - - return (-1); - } - } - - data.gpu_temp_disable = gpu_temp_disable; - data.gpu_temp_abort = gpu_temp_abort; - data.gpu_temp_retain = gpu_temp_retain; - #endif - - /** - * inform the user - */ - - if (data.quiet == 0) - { - log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig, digests_cnt, salts_cnt); - - log_info ("Bitmaps: %u bits, %u entries, 0x%08x mask, %u bytes, %u/%u rotates", bitmap_bits, bitmap_nums, bitmap_mask, bitmap_size, bitmap_shift1, bitmap_shift2); - - if (attack_mode == ATTACK_MODE_STRAIGHT) - { - log_info ("Rules: %u", kernel_rules_cnt); - } - - if (opti_type) - { - log_info ("Applicable Optimizers:"); - - for (uint i = 0; i < 32; i++) - { - const uint opti_bit = 1u << i; - - if (opti_type & opti_bit) log_info ("* %s", stroptitype (opti_bit)); - } - } - - /** - * Watchdog and Temperature balance - */ - - #ifdef HAVE_HWMON - if (gpu_temp_abort == 0) - { - log_info ("Watchdog: Temperature abort trigger disabled"); - } - else - { - log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort); - } - - if (gpu_temp_retain == 0) - { - log_info ("Watchdog: Temperature retain trigger disabled"); - } - else - { - log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain); - } - #endif - } - - if (data.quiet == 0) log_info (""); - /** * HM devices: init */ @@ -13233,8 +13126,125 @@ int main (int argc, char **argv) } } #endif // HAVE_ADL + + if (data.hm_amd == NULL && data.hm_nv == NULL) + { + gpu_temp_disable = 1; + } } + /** + * OpenCL devices: allocate buffer for device specific information + */ + + #ifdef HAVE_HWMON + int *temp_retain_fanspeed_value = (int *) mycalloc (devices_cnt, sizeof (int)); + + #ifdef HAVE_ADL + ADLOD6MemClockState *od_clock_mem_status = (ADLOD6MemClockState *) mycalloc (devices_cnt, sizeof (ADLOD6MemClockState)); + + int *od_power_control_status = (int *) mycalloc (devices_cnt, sizeof (int)); + #endif // ADL + #endif + + /** + * enable custom signal handler(s) + */ + + if (benchmark == 0) + { + hc_signal (sigHandler_default); + } + else + { + hc_signal (sigHandler_benchmark); + } + + /** + * User-defined GPU temp handling + */ + + #ifdef HAVE_HWMON + if (gpu_temp_disable == 1) + { + gpu_temp_abort = 0; + gpu_temp_retain = 0; + } + + if ((gpu_temp_abort != 0) && (gpu_temp_retain != 0)) + { + if (gpu_temp_abort < gpu_temp_retain) + { + log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain."); + + return (-1); + } + } + + data.gpu_temp_disable = gpu_temp_disable; + data.gpu_temp_abort = gpu_temp_abort; + data.gpu_temp_retain = gpu_temp_retain; + #endif + + /** + * inform the user + */ + + if (data.quiet == 0) + { + log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig, digests_cnt, salts_cnt); + + log_info ("Bitmaps: %u bits, %u entries, 0x%08x mask, %u bytes, %u/%u rotates", bitmap_bits, bitmap_nums, bitmap_mask, bitmap_size, bitmap_shift1, bitmap_shift2); + + if (attack_mode == ATTACK_MODE_STRAIGHT) + { + log_info ("Rules: %u", kernel_rules_cnt); + } + + if (opti_type) + { + log_info ("Applicable Optimizers:"); + + for (uint i = 0; i < 32; i++) + { + const uint opti_bit = 1u << i; + + if (opti_type & opti_bit) log_info ("* %s", stroptitype (opti_bit)); + } + } + + /** + * Watchdog and Temperature balance + */ + + #ifdef HAVE_HWMON + if (gpu_temp_disable == 0 && data.hm_amd == NULL && data.hm_nv == NULL) + { + log_info ("Watchdog: Hardware Monitoring Interface not found on your system"); + } + + if (gpu_temp_abort == 0) + { + log_info ("Watchdog: Temperature abort trigger disabled"); + } + else + { + log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort); + } + + if (gpu_temp_retain == 0) + { + log_info ("Watchdog: Temperature retain trigger disabled"); + } + else + { + log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain); + } + #endif + } + + if (data.quiet == 0) log_info (""); + /** * HM devices: copy */