mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-22 22:58:30 +00:00
Refactor devices_status to have better thread control
This commit is contained in:
parent
cecf7473a6
commit
9daf139fef
@ -43,6 +43,32 @@ typedef enum vendor_id
|
|||||||
|
|
||||||
} vendor_id_t;
|
} vendor_id_t;
|
||||||
|
|
||||||
|
typedef enum status_rc
|
||||||
|
{
|
||||||
|
STATUS_INIT = 0,
|
||||||
|
STATUS_AUTOTUNE = 1,
|
||||||
|
STATUS_RUNNING = 2,
|
||||||
|
STATUS_PAUSED = 3,
|
||||||
|
STATUS_EXHAUSTED = 4,
|
||||||
|
STATUS_CRACKED = 5,
|
||||||
|
STATUS_ABORTED = 6,
|
||||||
|
STATUS_QUIT = 7,
|
||||||
|
STATUS_BYPASS = 8,
|
||||||
|
|
||||||
|
} status_rc_t;
|
||||||
|
|
||||||
|
static const char ST_0000[] = "Initializing";
|
||||||
|
static const char ST_0001[] = "Autotuning";
|
||||||
|
static const char ST_0002[] = "Running";
|
||||||
|
static const char ST_0003[] = "Paused";
|
||||||
|
static const char ST_0004[] = "Exhausted";
|
||||||
|
static const char ST_0005[] = "Cracked";
|
||||||
|
static const char ST_0006[] = "Aborted";
|
||||||
|
static const char ST_0007[] = "Quit";
|
||||||
|
static const char ST_0008[] = "Bypass";
|
||||||
|
|
||||||
|
char *strstatus (const uint devices_status);
|
||||||
|
|
||||||
void load_kernel (const char *kernel_file, int num_devices, size_t *kernel_lengths, const u8 **kernel_sources);
|
void load_kernel (const char *kernel_file, int num_devices, size_t *kernel_lengths, const u8 **kernel_sources);
|
||||||
void writeProgramBin (char *dst, u8 *binary, size_t binary_size);
|
void writeProgramBin (char *dst, u8 *binary, size_t binary_size);
|
||||||
|
|
||||||
|
@ -41,8 +41,6 @@ void write_restore (opencl_ctx_t *opencl_ctx, const char *new_restore_file, rest
|
|||||||
|
|
||||||
void cycle_restore (opencl_ctx_t *opencl_ctx);
|
void cycle_restore (opencl_ctx_t *opencl_ctx);
|
||||||
|
|
||||||
void check_checkpoint (opencl_ctx_t *opencl_ctx);
|
|
||||||
|
|
||||||
void stop_at_checkpoint (opencl_ctx_t *opencl_ctx);
|
void stop_at_checkpoint (opencl_ctx_t *opencl_ctx);
|
||||||
|
|
||||||
#endif // _RESTORE_H
|
#endif // _RESTORE_H
|
||||||
|
@ -13,22 +13,6 @@
|
|||||||
#define STATUS_TIMER 10
|
#define STATUS_TIMER 10
|
||||||
#define MACHINE_READABLE 0
|
#define MACHINE_READABLE 0
|
||||||
|
|
||||||
typedef enum status_rc
|
|
||||||
{
|
|
||||||
STATUS_STARTING = 0,
|
|
||||||
STATUS_INIT = 1,
|
|
||||||
STATUS_RUNNING = 2,
|
|
||||||
STATUS_PAUSED = 3,
|
|
||||||
STATUS_EXHAUSTED = 4,
|
|
||||||
STATUS_CRACKED = 5,
|
|
||||||
STATUS_ABORTED = 6,
|
|
||||||
STATUS_QUIT = 7,
|
|
||||||
STATUS_BYPASS = 8,
|
|
||||||
STATUS_STOP_AT_CHECKPOINT = 9,
|
|
||||||
STATUS_AUTOTUNE = 10
|
|
||||||
|
|
||||||
} status_rc_t;
|
|
||||||
|
|
||||||
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);
|
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes);
|
||||||
|
@ -62,12 +62,12 @@ void hc_signal (void (callback) (int));
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void mycracked (opencl_ctx_t *opencl_ctx);
|
||||||
void myabort (opencl_ctx_t *opencl_ctx);
|
void myabort (opencl_ctx_t *opencl_ctx);
|
||||||
void myquit (opencl_ctx_t *opencl_ctx);
|
void myquit (opencl_ctx_t *opencl_ctx);
|
||||||
|
void bypass (opencl_ctx_t *opencl_ctx);
|
||||||
|
|
||||||
void SuspendThreads (opencl_ctx_t *opencl_ctx);
|
void SuspendThreads (opencl_ctx_t *opencl_ctx);
|
||||||
void ResumeThreads (opencl_ctx_t *opencl_ctx);
|
void ResumeThreads (opencl_ctx_t *opencl_ctx);
|
||||||
|
|
||||||
void bypass (opencl_ctx_t *opencl_ctx);
|
|
||||||
|
|
||||||
#endif // _THREAD_H
|
#endif // _THREAD_H
|
||||||
|
@ -493,6 +493,12 @@ typedef struct
|
|||||||
|
|
||||||
hc_device_param_t *devices_param;
|
hc_device_param_t *devices_param;
|
||||||
|
|
||||||
|
bool run_main_level1;
|
||||||
|
bool run_main_level2;
|
||||||
|
bool run_main_level3;
|
||||||
|
bool run_thread_level1;
|
||||||
|
bool run_thread_level2;
|
||||||
|
|
||||||
u32 devices_status;
|
u32 devices_status;
|
||||||
|
|
||||||
u32 opencl_platforms_filter;
|
u32 opencl_platforms_filter;
|
||||||
@ -940,8 +946,6 @@ typedef struct
|
|||||||
|
|
||||||
restore_data_t *rd;
|
restore_data_t *rd;
|
||||||
|
|
||||||
u64 checkpoint_cur_words; // used for the "stop at next checkpoint" feature
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* status, timer
|
* status, timer
|
||||||
*/
|
*/
|
||||||
|
@ -128,7 +128,7 @@ void *thread_calc_stdin (void *p)
|
|||||||
|
|
||||||
const uint attack_kern = data.attack_kern;
|
const uint attack_kern = data.attack_kern;
|
||||||
|
|
||||||
while ((opencl_ctx->devices_status != STATUS_CRACKED) && (opencl_ctx->devices_status != STATUS_ABORTED) && (opencl_ctx->devices_status != STATUS_QUIT))
|
while (opencl_ctx->run_thread_level1 == true)
|
||||||
{
|
{
|
||||||
hc_thread_mutex_lock (mux_dispatcher);
|
hc_thread_mutex_lock (mux_dispatcher);
|
||||||
|
|
||||||
@ -198,18 +198,12 @@ void *thread_calc_stdin (void *p)
|
|||||||
|
|
||||||
words_cur++;
|
words_cur++;
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
while (opencl_ctx->run_thread_level1 == false) break;
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hc_thread_mutex_unlock (mux_dispatcher);
|
hc_thread_mutex_unlock (mux_dispatcher);
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
while (opencl_ctx->run_thread_level1 == false) break;
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
|
|
||||||
|
|
||||||
// flush
|
// flush
|
||||||
|
|
||||||
@ -261,7 +255,7 @@ void *thread_calc (void *p)
|
|||||||
|
|
||||||
if (attack_mode == ATTACK_MODE_BF)
|
if (attack_mode == ATTACK_MODE_BF)
|
||||||
{
|
{
|
||||||
while ((opencl_ctx->devices_status != STATUS_CRACKED) && (opencl_ctx->devices_status != STATUS_ABORTED) && (opencl_ctx->devices_status != STATUS_QUIT))
|
while (opencl_ctx->run_thread_level1 == true)
|
||||||
{
|
{
|
||||||
const uint work = get_work (device_param, -1u);
|
const uint work = get_work (device_param, -1u);
|
||||||
|
|
||||||
@ -288,12 +282,7 @@ void *thread_calc (void *p)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint (opencl_ctx);
|
if (opencl_ctx->run_thread_level1 == false) break;
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
|
|
||||||
|
|
||||||
if (data.benchmark == 1) break;
|
if (data.benchmark == 1) break;
|
||||||
|
|
||||||
@ -373,7 +362,7 @@ void *thread_calc (void *p)
|
|||||||
|
|
||||||
u64 words_cur = 0;
|
u64 words_cur = 0;
|
||||||
|
|
||||||
while ((opencl_ctx->devices_status != STATUS_CRACKED) && (opencl_ctx->devices_status != STATUS_ABORTED) && (opencl_ctx->devices_status != STATUS_QUIT))
|
while (opencl_ctx->run_thread_level1 == true)
|
||||||
{
|
{
|
||||||
u64 words_off = 0;
|
u64 words_off = 0;
|
||||||
u64 words_fin = 0;
|
u64 words_fin = 0;
|
||||||
@ -463,28 +452,13 @@ void *thread_calc (void *p)
|
|||||||
|
|
||||||
pw_add (device_param, (u8 *) line_buf, line_len);
|
pw_add (device_param, (u8 *) line_buf, line_len);
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint (opencl_ctx);
|
if (opencl_ctx->run_thread_level1 == false) break;
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint (opencl_ctx);
|
if (opencl_ctx->run_thread_level1 == false) break;
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint (opencl_ctx);
|
if (opencl_ctx->run_thread_level1 == false) break;
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// flush
|
// flush
|
||||||
@ -513,12 +487,7 @@ void *thread_calc (void *p)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint (opencl_ctx);
|
if (opencl_ctx->run_thread_level1 == false) break;
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
|
|
||||||
|
|
||||||
if (words_fin == 0) break;
|
if (words_fin == 0) break;
|
||||||
|
|
||||||
|
@ -568,7 +568,7 @@ int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, ha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hashes->salts_done == hashes->salts_cnt) opencl_ctx->devices_status = STATUS_CRACKED;
|
if (hashes->salts_done == hashes->salts_cnt) mycracked (opencl_ctx);
|
||||||
|
|
||||||
check_hash (opencl_ctx, device_param, &cracked[i]);
|
check_hash (opencl_ctx, device_param, &cracked[i]);
|
||||||
}
|
}
|
||||||
@ -1422,7 +1422,7 @@ int hashes_init_stage2 (hashes_t *hashes, const hashconfig_t *hashconfig, opencl
|
|||||||
salts_done++;
|
salts_done++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (salts_done == salts_cnt) opencl_ctx->devices_status = STATUS_CRACKED;
|
if (salts_done == salts_cnt) mycracked (opencl_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
myfree (hashes->digests_buf);
|
myfree (hashes->digests_buf);
|
||||||
|
132
src/hashcat.c
132
src/hashcat.c
@ -847,13 +847,13 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (opencl_info)
|
if (opencl_info)
|
||||||
{
|
{
|
||||||
quiet = 1;
|
quiet = 1;
|
||||||
gpu_temp_disable = 1;
|
gpu_temp_disable = 1;
|
||||||
potfile_disable = 1;
|
potfile_disable = 1;
|
||||||
restore_disable = 1;
|
restore_disable = 1;
|
||||||
markov_disable = 1;
|
markov_disable = 1;
|
||||||
logfile_disable = 1;
|
logfile_disable = 1;
|
||||||
stdout_flag = 1;
|
//stdout_flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1304,6 +1304,13 @@ int main (int argc, char **argv)
|
|||||||
opencl_vector_width = 1;
|
opencl_vector_width = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opencl_info == true)
|
||||||
|
{
|
||||||
|
opencl_platforms = NULL;
|
||||||
|
opencl_devices = NULL;
|
||||||
|
opencl_device_types = mystrdup ("1,2,3");
|
||||||
|
}
|
||||||
|
|
||||||
if (remove_timer_chgd == 1)
|
if (remove_timer_chgd == 1)
|
||||||
{
|
{
|
||||||
if (remove == 0)
|
if (remove == 0)
|
||||||
@ -1584,7 +1591,6 @@ int main (int argc, char **argv)
|
|||||||
data.veracrypt_pim = veracrypt_pim;
|
data.veracrypt_pim = veracrypt_pim;
|
||||||
data.scrypt_tmto = scrypt_tmto;
|
data.scrypt_tmto = scrypt_tmto;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cpu affinity
|
* cpu affinity
|
||||||
*/
|
*/
|
||||||
@ -1716,16 +1722,12 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
data.opencl_ctx = opencl_ctx;
|
data.opencl_ctx = opencl_ctx;
|
||||||
|
|
||||||
if (opencl_info)
|
const int rc_opencl_init = opencl_ctx_init (opencl_ctx, opencl_platforms, opencl_devices, opencl_device_types, opencl_vector_width, opencl_vector_width_chgd, nvidia_spin_damp, nvidia_spin_damp_chgd, workload_profile, kernel_accel, kernel_accel_chgd, kernel_loops, kernel_loops_chgd, keyspace, stdout_flag);
|
||||||
{
|
|
||||||
opencl_platforms = NULL;
|
|
||||||
opencl_devices = NULL;
|
|
||||||
opencl_device_types = strdup("1,2,3");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opencl_ctx_init (opencl_ctx, opencl_platforms, opencl_devices, opencl_device_types, opencl_vector_width, opencl_vector_width_chgd, nvidia_spin_damp, nvidia_spin_damp_chgd, workload_profile, kernel_accel, kernel_accel_chgd, kernel_loops, kernel_loops_chgd, keyspace, stdout_flag) != 0)
|
if (rc_opencl_init == -1)
|
||||||
{
|
{
|
||||||
log_error ("ERROR: opencl_ctx_init() failed.");
|
log_error ("ERROR: opencl_ctx_init() failed");
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1829,6 +1831,14 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
for (algorithm_pos = 0; algorithm_pos < algorithm_max; algorithm_pos++)
|
for (algorithm_pos = 0; algorithm_pos < algorithm_max; algorithm_pos++)
|
||||||
{
|
{
|
||||||
|
opencl_ctx->devices_status = STATUS_INIT;
|
||||||
|
|
||||||
|
//opencl_ctx->run_main_level1 = true;
|
||||||
|
opencl_ctx->run_main_level2 = true;
|
||||||
|
opencl_ctx->run_main_level3 = true;
|
||||||
|
opencl_ctx->run_thread_level1 = true;
|
||||||
|
opencl_ctx->run_thread_level2 = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
|
* We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
|
||||||
* the following algos are skipped entirely
|
* the following algos are skipped entirely
|
||||||
@ -1982,7 +1992,6 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
hashconfig_general_defaults (hashconfig, hashes, optional_param1);
|
hashconfig_general_defaults (hashconfig, hashes, optional_param1);
|
||||||
|
|
||||||
|
|
||||||
if (hashes->salts_cnt == 1)
|
if (hashes->salts_cnt == 1)
|
||||||
hashconfig->opti_type |= OPTI_TYPE_SINGLE_SALT;
|
hashconfig->opti_type |= OPTI_TYPE_SINGLE_SALT;
|
||||||
|
|
||||||
@ -3866,11 +3875,6 @@ int main (int argc, char **argv)
|
|||||||
* status and monitor threads
|
* status and monitor threads
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((opencl_ctx->devices_status != STATUS_BYPASS) && (opencl_ctx->devices_status != STATUS_CRACKED) && (opencl_ctx->devices_status != STATUS_ABORTED) && (opencl_ctx->devices_status != STATUS_QUIT))
|
|
||||||
{
|
|
||||||
opencl_ctx->devices_status = STATUS_STARTING;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint inner_threads_cnt = 0;
|
uint inner_threads_cnt = 0;
|
||||||
|
|
||||||
hc_thread_t *inner_threads = (hc_thread_t *) mycalloc (10, sizeof (hc_thread_t));
|
hc_thread_t *inner_threads = (hc_thread_t *) mycalloc (10, sizeof (hc_thread_t));
|
||||||
@ -3891,9 +3895,9 @@ int main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
if (data.outfile_check_directory != NULL)
|
if (data.outfile_check_directory != NULL)
|
||||||
{
|
{
|
||||||
if ((hashconfig->hash_mode != 5200) &&
|
if ((hashconfig->hash_mode != 5200) &&
|
||||||
!((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299)) &&
|
!((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299)) &&
|
||||||
!((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode <= 13799)) &&
|
!((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode <= 13799)) &&
|
||||||
(hashconfig->hash_mode != 9000))
|
(hashconfig->hash_mode != 9000))
|
||||||
{
|
{
|
||||||
hc_thread_create (inner_threads[inner_threads_cnt], thread_outfile_remove, NULL);
|
hc_thread_create (inner_threads[inner_threads_cnt], thread_outfile_remove, NULL);
|
||||||
@ -3940,9 +3944,11 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
for (uint maskpos = rd->maskpos; maskpos < maskcnt; maskpos++)
|
for (uint maskpos = rd->maskpos; maskpos < maskcnt; maskpos++)
|
||||||
{
|
{
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) continue;
|
//opencl_ctx->run_main_level1 = true;
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) continue;
|
//opencl_ctx->run_main_level2 = true;
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) continue;
|
opencl_ctx->run_main_level3 = true;
|
||||||
|
opencl_ctx->run_thread_level1 = true;
|
||||||
|
opencl_ctx->run_thread_level2 = true;
|
||||||
|
|
||||||
if (maskpos > rd->maskpos)
|
if (maskpos > rd->maskpos)
|
||||||
{
|
{
|
||||||
@ -4244,9 +4250,13 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
for (uint dictpos = rd->dictpos; dictpos < dictcnt; dictpos++)
|
for (uint dictpos = rd->dictpos; dictpos < dictcnt; dictpos++)
|
||||||
{
|
{
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) continue;
|
if (opencl_ctx->run_main_level3 == false) break;
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) continue;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) continue;
|
//opencl_ctx->run_main_level1 = true;
|
||||||
|
//opencl_ctx->run_main_level2 = true;
|
||||||
|
//opencl_ctx->run_main_level3 = true;
|
||||||
|
opencl_ctx->run_thread_level1 = true;
|
||||||
|
opencl_ctx->run_thread_level2 = true;
|
||||||
|
|
||||||
rd->dictpos = dictpos;
|
rd->dictpos = dictpos;
|
||||||
|
|
||||||
@ -4256,11 +4266,6 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
logfile_sub_msg ("START");
|
logfile_sub_msg ("START");
|
||||||
|
|
||||||
if ((opencl_ctx->devices_status != STATUS_BYPASS) && (opencl_ctx->devices_status != STATUS_CRACKED) && (opencl_ctx->devices_status != STATUS_ABORTED) && (opencl_ctx->devices_status != STATUS_QUIT))
|
|
||||||
{
|
|
||||||
opencl_ctx->devices_status = STATUS_INIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset (data.words_progress_done, 0, hashes->salts_cnt * sizeof (u64));
|
memset (data.words_progress_done, 0, hashes->salts_cnt * sizeof (u64));
|
||||||
memset (data.words_progress_rejected, 0, hashes->salts_cnt * sizeof (u64));
|
memset (data.words_progress_rejected, 0, hashes->salts_cnt * sizeof (u64));
|
||||||
memset (data.words_progress_restored, 0, hashes->salts_cnt * sizeof (u64));
|
memset (data.words_progress_restored, 0, hashes->salts_cnt * sizeof (u64));
|
||||||
@ -4819,10 +4824,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
hc_thread_t *c_threads = (hc_thread_t *) mycalloc (opencl_ctx->devices_cnt, sizeof (hc_thread_t));
|
hc_thread_t *c_threads = (hc_thread_t *) mycalloc (opencl_ctx->devices_cnt, sizeof (hc_thread_t));
|
||||||
|
|
||||||
if ((opencl_ctx->devices_status != STATUS_BYPASS) && (opencl_ctx->devices_status != STATUS_CRACKED) && (opencl_ctx->devices_status != STATUS_ABORTED) && (opencl_ctx->devices_status != STATUS_QUIT))
|
opencl_ctx->devices_status = STATUS_AUTOTUNE;
|
||||||
{
|
|
||||||
opencl_ctx->devices_status = STATUS_AUTOTUNE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||||
{
|
{
|
||||||
@ -4876,10 +4878,7 @@ int main (int argc, char **argv)
|
|||||||
* create cracker threads
|
* create cracker threads
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((opencl_ctx->devices_status != STATUS_BYPASS) && (opencl_ctx->devices_status != STATUS_CRACKED) && (opencl_ctx->devices_status != STATUS_ABORTED) && (opencl_ctx->devices_status != STATUS_QUIT))
|
opencl_ctx->devices_status = STATUS_RUNNING;
|
||||||
{
|
|
||||||
opencl_ctx->devices_status = STATUS_RUNNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (initial_restore_done == 0)
|
if (initial_restore_done == 0)
|
||||||
{
|
{
|
||||||
@ -4929,7 +4928,10 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
local_free (c_threads);
|
local_free (c_threads);
|
||||||
|
|
||||||
if ((opencl_ctx->devices_status != STATUS_BYPASS) && (opencl_ctx->devices_status != STATUS_CRACKED) && (opencl_ctx->devices_status != STATUS_ABORTED) && (opencl_ctx->devices_status != STATUS_QUIT))
|
if ((opencl_ctx->devices_status != STATUS_CRACKED)
|
||||||
|
&& (opencl_ctx->devices_status != STATUS_ABORTED)
|
||||||
|
&& (opencl_ctx->devices_status != STATUS_QUIT)
|
||||||
|
&& (opencl_ctx->devices_status != STATUS_BYPASS))
|
||||||
{
|
{
|
||||||
opencl_ctx->devices_status = STATUS_EXHAUSTED;
|
opencl_ctx->devices_status = STATUS_EXHAUSTED;
|
||||||
}
|
}
|
||||||
@ -5015,33 +5017,12 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
global_free (subid);
|
global_free (subid);
|
||||||
|
|
||||||
// from this point we handle bypass as running
|
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS)
|
|
||||||
{
|
|
||||||
opencl_ctx->devices_status = STATUS_RUNNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
// and overwrite benchmark aborts as well
|
|
||||||
|
|
||||||
if (data.benchmark == 1)
|
|
||||||
{
|
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED)
|
|
||||||
{
|
|
||||||
opencl_ctx->devices_status = STATUS_RUNNING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// finalize task
|
// finalize task
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
if (opencl_ctx->run_main_level3 == false) break;
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
if (opencl_ctx->run_main_level2 == false) break;
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// problems could occur if already at startup everything was cracked (because of .pot file reading etc), we must set some variables here to avoid NULL pointers
|
// problems could occur if already at startup everything was cracked (because of .pot file reading etc), we must set some variables here to avoid NULL pointers
|
||||||
@ -5288,6 +5269,8 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif // HAVE_HWMON
|
#endif // HAVE_HWMON
|
||||||
|
|
||||||
|
if (opencl_ctx->run_main_level1 == false) break;
|
||||||
|
|
||||||
// free memory
|
// free memory
|
||||||
|
|
||||||
opencl_session_destroy (opencl_ctx);
|
opencl_session_destroy (opencl_ctx);
|
||||||
@ -5329,8 +5312,6 @@ int main (int argc, char **argv)
|
|||||||
local_free (nvml_power_limit);
|
local_free (nvml_power_limit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
opencl_ctx_devices_destroy (opencl_ctx);
|
|
||||||
|
|
||||||
global_free (kernel_rules_buf);
|
global_free (kernel_rules_buf);
|
||||||
|
|
||||||
global_free (root_css_buf);
|
global_free (root_css_buf);
|
||||||
@ -5341,8 +5322,6 @@ int main (int argc, char **argv)
|
|||||||
global_free (words_progress_done);
|
global_free (words_progress_done);
|
||||||
global_free (words_progress_rejected);
|
global_free (words_progress_rejected);
|
||||||
global_free (words_progress_restored);
|
global_free (words_progress_restored);
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait for outer threads
|
// wait for outer threads
|
||||||
@ -5443,11 +5422,10 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
u32 rc_final = -1;
|
u32 rc_final = -1;
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) rc_final = 2;
|
if (opencl_ctx->devices_status == STATUS_ABORTED) rc_final = 2;
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) rc_final = 2;
|
if (opencl_ctx->devices_status == STATUS_QUIT) rc_final = 2;
|
||||||
if (opencl_ctx->devices_status == STATUS_STOP_AT_CHECKPOINT) rc_final = 2;
|
if (opencl_ctx->devices_status == STATUS_EXHAUSTED) rc_final = 1;
|
||||||
if (opencl_ctx->devices_status == STATUS_EXHAUSTED) rc_final = 1;
|
if (opencl_ctx->devices_status == STATUS_CRACKED) rc_final = 0;
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) rc_final = 0;
|
|
||||||
|
|
||||||
opencl_ctx_destroy (opencl_ctx);
|
opencl_ctx_destroy (opencl_ctx);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void *thread_monitor (void *p)
|
|||||||
{
|
{
|
||||||
hc_sleep (sleep_time);
|
hc_sleep (sleep_time);
|
||||||
|
|
||||||
if (opencl_ctx->devices_status != STATUS_RUNNING) continue;
|
if (opencl_ctx->devices_status == STATUS_INIT) continue;
|
||||||
|
|
||||||
#if defined (HAVE_HWMON)
|
#if defined (HAVE_HWMON)
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ void *thread_monitor (void *p)
|
|||||||
{
|
{
|
||||||
log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id + 1);
|
log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id + 1);
|
||||||
|
|
||||||
if (opencl_ctx->devices_status != STATUS_QUIT) myabort (opencl_ctx);
|
myabort (opencl_ctx);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -321,7 +321,7 @@ void *thread_monitor (void *p)
|
|||||||
if (data.quiet == 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
|
if (data.quiet == 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opencl_ctx->devices_status != STATUS_QUIT) myabort (opencl_ctx);
|
myabort (opencl_ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
86
src/opencl.c
86
src/opencl.c
@ -17,6 +17,7 @@
|
|||||||
#include "cpu_md5.h"
|
#include "cpu_md5.h"
|
||||||
#include "interface.h"
|
#include "interface.h"
|
||||||
#include "tuningdb.h"
|
#include "tuningdb.h"
|
||||||
|
#include "thread.h"
|
||||||
#include "opencl.h"
|
#include "opencl.h"
|
||||||
#include "hwmon.h"
|
#include "hwmon.h"
|
||||||
#include "restore.h"
|
#include "restore.h"
|
||||||
@ -45,6 +46,24 @@ extern hc_thread_mutex_t mux_hwmon;
|
|||||||
|
|
||||||
extern const int comptime;
|
extern const int comptime;
|
||||||
|
|
||||||
|
char *strstatus (const uint devices_status)
|
||||||
|
{
|
||||||
|
switch (devices_status)
|
||||||
|
{
|
||||||
|
case STATUS_INIT: return ((char *) ST_0000);
|
||||||
|
case STATUS_AUTOTUNE: return ((char *) ST_0001);
|
||||||
|
case STATUS_RUNNING: return ((char *) ST_0002);
|
||||||
|
case STATUS_PAUSED: return ((char *) ST_0003);
|
||||||
|
case STATUS_EXHAUSTED: return ((char *) ST_0004);
|
||||||
|
case STATUS_CRACKED: return ((char *) ST_0005);
|
||||||
|
case STATUS_ABORTED: return ((char *) ST_0006);
|
||||||
|
case STATUS_QUIT: return ((char *) ST_0007);
|
||||||
|
case STATUS_BYPASS: return ((char *) ST_0008);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((char *) "Uninitialized! Bug!");
|
||||||
|
}
|
||||||
|
|
||||||
static uint setup_opencl_platforms_filter (const char *opencl_platforms)
|
static uint setup_opencl_platforms_filter (const char *opencl_platforms)
|
||||||
{
|
{
|
||||||
uint opencl_platforms_filter = 0;
|
uint opencl_platforms_filter = 0;
|
||||||
@ -318,10 +337,7 @@ int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, ha
|
|||||||
|
|
||||||
run_kernel (KERN_RUN_2, opencl_ctx, device_param, pws_cnt, true, slow_iteration, hashconfig);
|
run_kernel (KERN_RUN_2, opencl_ctx, device_param, pws_cnt, true, slow_iteration, hashconfig);
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
while (opencl_ctx->run_thread_level2 == false) break;
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* speed
|
* speed
|
||||||
@ -343,7 +359,7 @@ int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, ha
|
|||||||
|
|
||||||
if (data.benchmark == 1)
|
if (data.benchmark == 1)
|
||||||
{
|
{
|
||||||
if (speed_ms > 4096) opencl_ctx->devices_status = STATUS_ABORTED;
|
if (speed_ms > 4096) myabort (opencl_ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -979,31 +995,12 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
|
|||||||
+ device_param->kernel_params_mp_l_buf32[5];
|
+ device_param->kernel_params_mp_l_buf32[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
// iteration type
|
|
||||||
|
|
||||||
uint innerloop_step = 0;
|
|
||||||
uint innerloop_cnt = 0;
|
|
||||||
|
|
||||||
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) innerloop_step = device_param->kernel_loops;
|
|
||||||
else innerloop_step = 1;
|
|
||||||
|
|
||||||
if (data.attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = data.kernel_rules_cnt;
|
|
||||||
else if (data.attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = data.combs_cnt;
|
|
||||||
else if (data.attack_kern == ATTACK_KERN_BF) innerloop_cnt = data.bfs_cnt;
|
|
||||||
|
|
||||||
// loop start: most outer loop = salt iteration, then innerloops (if multi)
|
// loop start: most outer loop = salt iteration, then innerloops (if multi)
|
||||||
|
|
||||||
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
||||||
{
|
{
|
||||||
while (opencl_ctx->devices_status == STATUS_PAUSED) hc_sleep (1);
|
while (opencl_ctx->devices_status == STATUS_PAUSED) hc_sleep (1);
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint (opencl_ctx);
|
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
|
|
||||||
|
|
||||||
salt_t *salt_buf = &hashes->salts_buf[salt_pos];
|
salt_t *salt_buf = &hashes->salts_buf[salt_pos];
|
||||||
|
|
||||||
device_param->kernel_params_buf32[27] = salt_pos;
|
device_param->kernel_params_buf32[27] = salt_pos;
|
||||||
@ -1017,19 +1014,24 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
|
|||||||
rewind (combs_fp);
|
rewind (combs_fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// iteration type
|
||||||
|
|
||||||
|
uint innerloop_step = 0;
|
||||||
|
uint innerloop_cnt = 0;
|
||||||
|
|
||||||
|
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) innerloop_step = device_param->kernel_loops;
|
||||||
|
else innerloop_step = 1;
|
||||||
|
|
||||||
|
if (data.attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = data.kernel_rules_cnt;
|
||||||
|
else if (data.attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = data.combs_cnt;
|
||||||
|
else if (data.attack_kern == ATTACK_KERN_BF) innerloop_cnt = data.bfs_cnt;
|
||||||
|
|
||||||
// innerloops
|
// innerloops
|
||||||
|
|
||||||
for (uint innerloop_pos = 0; innerloop_pos < innerloop_cnt; innerloop_pos += innerloop_step)
|
for (uint innerloop_pos = 0; innerloop_pos < innerloop_cnt; innerloop_pos += innerloop_step)
|
||||||
{
|
{
|
||||||
while (opencl_ctx->devices_status == STATUS_PAUSED) hc_sleep (1);
|
while (opencl_ctx->devices_status == STATUS_PAUSED) hc_sleep (1);
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint (opencl_ctx);
|
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
|
|
||||||
|
|
||||||
uint fast_iteration = 0;
|
uint fast_iteration = 0;
|
||||||
|
|
||||||
uint innerloop_left = innerloop_cnt - innerloop_pos;
|
uint innerloop_left = innerloop_cnt - innerloop_pos;
|
||||||
@ -1236,13 +1238,6 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
|
|||||||
|
|
||||||
if (rc == -1) return -1;
|
if (rc == -1) return -1;
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint (opencl_ctx);
|
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) break;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* result
|
* result
|
||||||
*/
|
*/
|
||||||
@ -1296,7 +1291,11 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (data.benchmark == 1) break;
|
if (data.benchmark == 1) break;
|
||||||
|
|
||||||
|
if (opencl_ctx->run_thread_level2 == false) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opencl_ctx->run_thread_level2 == false) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
device_param->speed_pos = speed_pos;
|
device_param->speed_pos = speed_pos;
|
||||||
@ -1315,6 +1314,12 @@ int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const char *opencl_platforms, con
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opencl_ctx->devices_status = STATUS_INIT;
|
||||||
|
opencl_ctx->run_main_level1 = true;
|
||||||
|
opencl_ctx->run_main_level2 = true;
|
||||||
|
opencl_ctx->run_main_level3 = true;
|
||||||
|
opencl_ctx->run_thread_level1 = true;
|
||||||
|
opencl_ctx->run_thread_level2 = true;
|
||||||
opencl_ctx->opencl_vector_width_chgd = opencl_vector_width_chgd;
|
opencl_ctx->opencl_vector_width_chgd = opencl_vector_width_chgd;
|
||||||
opencl_ctx->opencl_vector_width = opencl_vector_width;
|
opencl_ctx->opencl_vector_width = opencl_vector_width;
|
||||||
opencl_ctx->nvidia_spin_damp_chgd = nvidia_spin_damp_chgd;
|
opencl_ctx->nvidia_spin_damp_chgd = nvidia_spin_damp_chgd;
|
||||||
@ -1519,8 +1524,9 @@ int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashc
|
|||||||
|
|
||||||
u32 devices_active = 0;
|
u32 devices_active = 0;
|
||||||
|
|
||||||
if (opencl_info) {
|
if (opencl_info)
|
||||||
fprintf(stdout, "OpenCL Info:\n");
|
{
|
||||||
|
fprintf (stdout, "OpenCL Info:\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint platform_id = 0; platform_id < platforms_cnt; platform_id++)
|
for (uint platform_id = 0; platform_id < platforms_cnt; platform_id++)
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "status.h"
|
#include "status.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
#include "thread.h"
|
||||||
#include "outfile_check.h"
|
#include "outfile_check.h"
|
||||||
|
|
||||||
extern hc_global_data_t data;
|
extern hc_global_data_t data;
|
||||||
@ -280,7 +281,7 @@ void *thread_outfile_remove (void *p)
|
|||||||
|
|
||||||
hashes->salts_done++;
|
hashes->salts_done++;
|
||||||
|
|
||||||
if (hashes->salts_done == hashes->salts_cnt) opencl_ctx->devices_status = STATUS_CRACKED;
|
if (hashes->salts_done == hashes->salts_cnt) mycracked (opencl_ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,25 +303,8 @@ void cycle_restore (opencl_ctx_t *opencl_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_checkpoint (opencl_ctx_t *opencl_ctx)
|
|
||||||
{
|
|
||||||
// if (data.restore_disable == 1) break; (this is already implied by previous checks)
|
|
||||||
|
|
||||||
u64 words_cur = get_lowest_words_done (opencl_ctx);
|
|
||||||
|
|
||||||
if (words_cur != data.checkpoint_cur_words)
|
|
||||||
{
|
|
||||||
myabort (opencl_ctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void stop_at_checkpoint (opencl_ctx_t *opencl_ctx)
|
void stop_at_checkpoint (opencl_ctx_t *opencl_ctx)
|
||||||
{
|
{
|
||||||
if (opencl_ctx->devices_status != STATUS_STOP_AT_CHECKPOINT)
|
|
||||||
{
|
|
||||||
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this feature only makes sense if --restore-disable was not specified
|
// this feature only makes sense if --restore-disable was not specified
|
||||||
|
|
||||||
if (data.restore_disable == 1)
|
if (data.restore_disable == 1)
|
||||||
@ -331,25 +314,25 @@ void stop_at_checkpoint (opencl_ctx_t *opencl_ctx)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if monitoring of Restore Point updates should be enabled or disabled
|
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
||||||
|
|
||||||
if (opencl_ctx->devices_status != STATUS_STOP_AT_CHECKPOINT)
|
if ((opencl_ctx->run_thread_level1 == true) && (opencl_ctx->run_thread_level2 == true))
|
||||||
{
|
{
|
||||||
opencl_ctx->devices_status = STATUS_STOP_AT_CHECKPOINT;
|
opencl_ctx->run_main_level1 = false;
|
||||||
|
opencl_ctx->run_main_level2 = false;
|
||||||
// save the current restore point value
|
opencl_ctx->run_main_level3 = false;
|
||||||
|
opencl_ctx->run_thread_level1 = false;
|
||||||
data.checkpoint_cur_words = get_lowest_words_done (opencl_ctx);
|
opencl_ctx->run_thread_level2 = true;
|
||||||
|
|
||||||
log_info ("Checkpoint enabled: Will quit at next Restore Point update");
|
log_info ("Checkpoint enabled: Will quit at next Restore Point update");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
opencl_ctx->devices_status = STATUS_RUNNING;
|
opencl_ctx->run_main_level1 = true;
|
||||||
|
opencl_ctx->run_main_level2 = true;
|
||||||
// reset the global value for checkpoint checks
|
opencl_ctx->run_main_level3 = true;
|
||||||
|
opencl_ctx->run_thread_level1 = true;
|
||||||
data.checkpoint_cur_words = 0;
|
opencl_ctx->run_thread_level2 = true;
|
||||||
|
|
||||||
log_info ("Checkpoint disabled: Restore Point updates will no longer be monitored");
|
log_info ("Checkpoint disabled: Restore Point updates will no longer be monitored");
|
||||||
}
|
}
|
||||||
|
70
src/status.c
70
src/status.c
@ -30,18 +30,6 @@
|
|||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
|
|
||||||
static const char ST_0000[] = "Initializing";
|
|
||||||
static const char ST_0001[] = "Starting";
|
|
||||||
static const char ST_0002[] = "Running";
|
|
||||||
static const char ST_0003[] = "Paused";
|
|
||||||
static const char ST_0004[] = "Exhausted";
|
|
||||||
static const char ST_0005[] = "Cracked";
|
|
||||||
static const char ST_0006[] = "Aborted";
|
|
||||||
static const char ST_0007[] = "Quit";
|
|
||||||
static const char ST_0008[] = "Bypass";
|
|
||||||
static const char ST_0009[] = "Running (stop at checkpoint)";
|
|
||||||
static const char ST_0010[] = "Autotuning";
|
|
||||||
|
|
||||||
extern hc_global_data_t data;
|
extern hc_global_data_t data;
|
||||||
extern hc_thread_mutex_t mux_hwmon;
|
extern hc_thread_mutex_t mux_hwmon;
|
||||||
|
|
||||||
@ -123,26 +111,6 @@ static void format_speed_display (double val, char *buf, size_t len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *strstatus (const uint devices_status)
|
|
||||||
{
|
|
||||||
switch (devices_status)
|
|
||||||
{
|
|
||||||
case STATUS_INIT: return ((char *) ST_0000);
|
|
||||||
case STATUS_STARTING: return ((char *) ST_0001);
|
|
||||||
case STATUS_RUNNING: return ((char *) ST_0002);
|
|
||||||
case STATUS_PAUSED: return ((char *) ST_0003);
|
|
||||||
case STATUS_EXHAUSTED: return ((char *) ST_0004);
|
|
||||||
case STATUS_CRACKED: return ((char *) ST_0005);
|
|
||||||
case STATUS_ABORTED: return ((char *) ST_0006);
|
|
||||||
case STATUS_QUIT: return ((char *) ST_0007);
|
|
||||||
case STATUS_BYPASS: return ((char *) ST_0008);
|
|
||||||
case STATUS_STOP_AT_CHECKPOINT: return ((char *) ST_0009);
|
|
||||||
case STATUS_AUTOTUNE: return ((char *) ST_0010);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((char *) "Unknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
int exec_pos = (int) device_param->exec_pos - last_num_entries;
|
int exec_pos = (int) device_param->exec_pos - last_num_entries;
|
||||||
@ -172,10 +140,12 @@ double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_en
|
|||||||
|
|
||||||
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes)
|
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes)
|
||||||
{
|
{
|
||||||
if (opencl_ctx->devices_status == STATUS_INIT) return;
|
if (opencl_ctx->devices_status == STATUS_INIT)
|
||||||
if (opencl_ctx->devices_status == STATUS_STARTING) return;
|
{
|
||||||
|
log_error ("ERROR: status view is not available during initialization phase");
|
||||||
|
|
||||||
if (hashes == NULL) return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FILE *out = stdout;
|
FILE *out = stdout;
|
||||||
|
|
||||||
@ -321,11 +291,12 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *
|
|||||||
|
|
||||||
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes)
|
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes)
|
||||||
{
|
{
|
||||||
if (opencl_ctx->devices_status == STATUS_INIT) return;
|
if (opencl_ctx->devices_status == STATUS_INIT)
|
||||||
if (opencl_ctx->devices_status == STATUS_STARTING) return;
|
{
|
||||||
|
log_error ("ERROR: status view is not available during initialization phase");
|
||||||
|
|
||||||
if (hashconfig == NULL) return;
|
return;
|
||||||
if (hashes == NULL) return;
|
}
|
||||||
|
|
||||||
// in this case some required buffers are free'd, ascii_digest() would run into segfault
|
// in this case some required buffers are free'd, ascii_digest() would run into segfault
|
||||||
if (data.shutdown_inner == 1) return;
|
if (data.shutdown_inner == 1) return;
|
||||||
@ -1063,10 +1034,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
|
|||||||
|
|
||||||
#if defined (HAVE_HWMON)
|
#if defined (HAVE_HWMON)
|
||||||
|
|
||||||
if (opencl_ctx->devices_status == STATUS_EXHAUSTED) return;
|
if (opencl_ctx->run_main_level1 == false) return;
|
||||||
if (opencl_ctx->devices_status == STATUS_CRACKED) return;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_ABORTED) return;
|
|
||||||
if (opencl_ctx->devices_status == STATUS_QUIT) return;
|
|
||||||
|
|
||||||
if (data.gpu_temp_disable == 0)
|
if (data.gpu_temp_disable == 0)
|
||||||
{
|
{
|
||||||
@ -1157,10 +1125,12 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
|
|||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
if (opencl_ctx->devices_status == STATUS_INIT) return;
|
if (opencl_ctx->devices_status == STATUS_INIT)
|
||||||
if (opencl_ctx->devices_status == STATUS_STARTING) return;
|
{
|
||||||
|
log_error ("ERROR: status view is not available during initialization phase");
|
||||||
|
|
||||||
if (hashconfig == NULL) return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
u64 speed_cnt[DEVICES_MAX] = { 0 };
|
u64 speed_cnt[DEVICES_MAX] = { 0 };
|
||||||
double speed_ms[DEVICES_MAX] = { 0 };
|
double speed_ms[DEVICES_MAX] = { 0 };
|
||||||
@ -1203,10 +1173,12 @@ void status_benchmark_automate (opencl_ctx_t *opencl_ctx, const hashconfig_t *ha
|
|||||||
|
|
||||||
void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig)
|
void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig)
|
||||||
{
|
{
|
||||||
if (opencl_ctx->devices_status == STATUS_INIT) return;
|
if (opencl_ctx->devices_status == STATUS_INIT)
|
||||||
if (opencl_ctx->devices_status == STATUS_STARTING) return;
|
{
|
||||||
|
log_error ("ERROR: status view is not available during initialization phase");
|
||||||
|
|
||||||
if (hashconfig == NULL) return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.shutdown_inner == 1) return;
|
if (data.shutdown_inner == 1) return;
|
||||||
|
|
||||||
|
51
src/thread.c
51
src/thread.c
@ -140,14 +140,58 @@ void hc_signal (void (callback) (int))
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void mycracked (opencl_ctx_t *opencl_ctx)
|
||||||
|
{
|
||||||
|
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
||||||
|
|
||||||
|
opencl_ctx->devices_status = STATUS_CRACKED;
|
||||||
|
|
||||||
|
opencl_ctx->run_main_level1 = false;
|
||||||
|
opencl_ctx->run_main_level2 = false;
|
||||||
|
opencl_ctx->run_main_level3 = false;
|
||||||
|
opencl_ctx->run_thread_level1 = false;
|
||||||
|
opencl_ctx->run_thread_level2 = false;
|
||||||
|
}
|
||||||
|
|
||||||
void myabort (opencl_ctx_t *opencl_ctx)
|
void myabort (opencl_ctx_t *opencl_ctx)
|
||||||
{
|
{
|
||||||
|
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
||||||
|
|
||||||
opencl_ctx->devices_status = STATUS_ABORTED;
|
opencl_ctx->devices_status = STATUS_ABORTED;
|
||||||
|
|
||||||
|
opencl_ctx->run_main_level1 = false;
|
||||||
|
opencl_ctx->run_main_level2 = false;
|
||||||
|
opencl_ctx->run_main_level3 = false;
|
||||||
|
opencl_ctx->run_thread_level1 = false;
|
||||||
|
opencl_ctx->run_thread_level2 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void myquit (opencl_ctx_t *opencl_ctx)
|
void myquit (opencl_ctx_t *opencl_ctx)
|
||||||
{
|
{
|
||||||
|
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
||||||
|
|
||||||
opencl_ctx->devices_status = STATUS_QUIT;
|
opencl_ctx->devices_status = STATUS_QUIT;
|
||||||
|
|
||||||
|
opencl_ctx->run_main_level1 = false;
|
||||||
|
opencl_ctx->run_main_level2 = false;
|
||||||
|
opencl_ctx->run_main_level3 = false;
|
||||||
|
opencl_ctx->run_thread_level1 = false;
|
||||||
|
opencl_ctx->run_thread_level2 = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bypass (opencl_ctx_t *opencl_ctx)
|
||||||
|
{
|
||||||
|
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
||||||
|
|
||||||
|
opencl_ctx->devices_status = STATUS_BYPASS;
|
||||||
|
|
||||||
|
opencl_ctx->run_main_level1 = true;
|
||||||
|
opencl_ctx->run_main_level2 = true;
|
||||||
|
opencl_ctx->run_main_level3 = true;
|
||||||
|
opencl_ctx->run_thread_level1 = false;
|
||||||
|
opencl_ctx->run_thread_level2 = false;
|
||||||
|
|
||||||
|
log_info ("Next dictionary / mask in queue selected, bypassing current one");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SuspendThreads (opencl_ctx_t *opencl_ctx)
|
void SuspendThreads (opencl_ctx_t *opencl_ctx)
|
||||||
@ -175,10 +219,3 @@ void ResumeThreads (opencl_ctx_t *opencl_ctx)
|
|||||||
|
|
||||||
log_info ("Resumed");
|
log_info ("Resumed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void bypass (opencl_ctx_t *opencl_ctx)
|
|
||||||
{
|
|
||||||
opencl_ctx->devices_status = STATUS_BYPASS;
|
|
||||||
|
|
||||||
log_info ("Next dictionary / mask in queue selected, bypassing current one");
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user