From 06b39dc3d50f313257031ec20b37b07e5b648ea2 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Mon, 12 Nov 2018 20:45:05 +0100 Subject: [PATCH] Startup: Show OpenCL runtime initialization message (per device) --- docs/changes.txt | 1 + include/types.h | 2 ++ src/main.c | 25 ++++++++++++++++++++++++- src/opencl.c | 4 ++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index fb8fa4778..30f555b89 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -57,6 +57,7 @@ - Hardware Monitor: Renamed --gpu-temp-disable to --hwmon-disable - Memory: Limit maximum host memory to allocate depending on bitness - Memory: Reduced default maximum bitmap size from 24 to 18 and give a notice to use --bitmap-max to restore +- Startup: Show OpenCL runtime initialization message (per device) - Tests: Added hash-mode 11700 (Streebog-256) - Tests: Added hash-mode 11750 (HMAC-Streebog-256 (key = $pass), big-endian) - Tests: Added hash-mode 11760 (HMAC-Streebog-256 (key = $salt), big-endian) diff --git a/include/types.h b/include/types.h index 8fc302ab1..75c6a20ca 100644 --- a/include/types.h +++ b/include/types.h @@ -125,6 +125,8 @@ typedef enum event_identifier EVENT_MONITOR_NOINPUT_ABORT = 0x00000088, EVENT_OPENCL_SESSION_POST = 0x00000090, EVENT_OPENCL_SESSION_PRE = 0x00000091, + EVENT_OPENCL_DEVICE_INIT_POST = 0x00000092, + EVENT_OPENCL_DEVICE_INIT_PRE = 0x00000093, EVENT_OUTERLOOP_FINISHED = 0x000000a0, EVENT_OUTERLOOP_MAINSCREEN = 0x000000a1, EVENT_OUTERLOOP_STARTING = 0x000000a2, diff --git a/src/main.c b/src/main.c index 28effdfc3..4db13d089 100644 --- a/src/main.c +++ b/src/main.c @@ -541,7 +541,6 @@ static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, } event_log_info (hashcat_ctx, NULL); - } static void main_opencl_session_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) @@ -562,6 +561,28 @@ static void main_opencl_session_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, M event_log_info_nn (hashcat_ctx, "Initialized device kernels and memory..."); } +static void main_opencl_device_init_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) +{ + const user_options_t *user_options = hashcat_ctx->user_options; + + if (user_options->quiet == true) return; + + const u32 *device_id = (const u32 *) buf; + + event_log_info_nn (hashcat_ctx, "Initializing OpenCL runtime for device #%u...", *device_id + 1); +} + +static void main_opencl_device_init_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) +{ + const user_options_t *user_options = hashcat_ctx->user_options; + + if (user_options->quiet == true) return; + + const u32 *device_id = (const u32 *) buf; + + event_log_info_nn (hashcat_ctx, "Initialized OpenCL runtime for device #%u...", *device_id + 1); +} + static void main_bitmap_init_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) { const user_options_t *user_options = hashcat_ctx->user_options; @@ -997,6 +1018,8 @@ static void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, co case EVENT_MONITOR_NOINPUT_ABORT: main_monitor_noinput_abort (hashcat_ctx, buf, len); break; case EVENT_OPENCL_SESSION_POST: main_opencl_session_post (hashcat_ctx, buf, len); break; case EVENT_OPENCL_SESSION_PRE: main_opencl_session_pre (hashcat_ctx, buf, len); break; + case EVENT_OPENCL_DEVICE_INIT_POST: main_opencl_device_init_post (hashcat_ctx, buf, len); break; + case EVENT_OPENCL_DEVICE_INIT_PRE: main_opencl_device_init_pre (hashcat_ctx, buf, len); break; case EVENT_OUTERLOOP_FINISHED: main_outerloop_finished (hashcat_ctx, buf, len); break; case EVENT_OUTERLOOP_MAINSCREEN: main_outerloop_mainscreen (hashcat_ctx, buf, len); break; case EVENT_OUTERLOOP_STARTING: main_outerloop_starting (hashcat_ctx, buf, len); break; diff --git a/src/opencl.c b/src/opencl.c index bca02a920..d51dd1fcc 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -4279,6 +4279,8 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) if (device_param->skipped == true) continue; + EVENT_DATA (EVENT_OPENCL_DEVICE_INIT_PRE, &device_id, sizeof (u32)); + bool skipped_temp = false; #if defined (__APPLE__) @@ -6762,6 +6764,8 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_decompress, 2, sizeof (cl_mem), device_param->kernel_params_decompress[2]); if (CL_rc == -1) return -1; hardware_power_all += device_param->hardware_power; + + EVENT_DATA (EVENT_OPENCL_DEVICE_INIT_POST, &device_id, sizeof (u32)); } // Prevent exit from benchmark mode if all devices are skipped due to unstable hash-modes (macOS)