Do away with queueing work separately at the start and let each thread grab its own work as soon as it's ready.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/main.c b/main.c
index babadfb..257c756 100644
--- a/main.c
+++ b/main.c
@@ -2509,7 +2509,7 @@ static void *miner_thread(void *userdata)
/* Try to cycle approximately 5 times before each log update */
const unsigned long cycle = opt_log_interval / 5 ? : 1;
int request_interval;
- bool requested = true;
+ bool requested = false;
uint32_t hash_div = 1;
double hash_divfloat = 1.0;
@@ -2815,7 +2815,7 @@ static void *gpuminer_thread(void *userdata)
/* Request the next work item at 2/3 of the scantime */
unsigned const int request_interval = opt_scantime * 2 / 3 ? : 1;
unsigned const long request_nonce = MAXTHREADS / 3 * 2;
- bool requested = true;
+ bool requested = false;
uint32_t total_hashes = 0, hash_div = 1;
switch (chosen_kernel) {
@@ -3840,14 +3840,6 @@ int main (int argc, char *argv[])
if (thr_info_create(thr, NULL, watchdog_thread, NULL))
quit(1, "wakeup thread create failed");
- /* Now that everything's ready put enough work in the queue */
- for (i = 0; i < mining_threads; i++) {
- if (unlikely(!queue_request()))
- quit(1, "Failed to queue_request in main");
- if (!opt_quiet && active_device(i))
- print_status(i);
- }
-
/* Create curses input thread for keyboard input */
input_thr_id = mining_threads + 4;
thr = &thr_info[input_thr_id];