Refactor devices_status to have better thread control

This commit is contained in:
jsteube
2016-09-19 15:52:01 +02:00
parent cecf7473a6
commit 9daf139fef
14 changed files with 229 additions and 271 deletions
+26
View File
@@ -43,6 +43,32 @@ typedef enum vendor_id
} 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 writeProgramBin (char *dst, u8 *binary, size_t binary_size);
-2
View File
@@ -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 check_checkpoint (opencl_ctx_t *opencl_ctx);
void stop_at_checkpoint (opencl_ctx_t *opencl_ctx);
#endif // _RESTORE_H
-16
View File
@@ -13,22 +13,6 @@
#define STATUS_TIMER 10
#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);
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes);
+2 -2
View File
@@ -62,12 +62,12 @@ void hc_signal (void (callback) (int));
#endif
void mycracked (opencl_ctx_t *opencl_ctx);
void myabort (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 ResumeThreads (opencl_ctx_t *opencl_ctx);
void bypass (opencl_ctx_t *opencl_ctx);
#endif // _THREAD_H
+6 -2
View File
@@ -493,6 +493,12 @@ typedef struct
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 opencl_platforms_filter;
@@ -940,8 +946,6 @@ typedef struct
restore_data_t *rd;
u64 checkpoint_cur_words; // used for the "stop at next checkpoint" feature
/**
* status, timer
*/