Fix some races in learning

declare a few variables atomic.

Other races remain...
This commit is contained in:
Joost VandeVondele
2020-09-18 23:06:45 +02:00
committed by nodchip
parent e8472b5fbe
commit 61bc8d12d3
+3 -3
View File
@@ -695,14 +695,14 @@ namespace Learner
uint64_t last_done; uint64_t last_done;
// If total_read exceeds this value, update_weights() and calculate mse. // If total_read exceeds this value, update_weights() and calculate mse.
uint64_t next_update_weights; std::atomic<uint64_t> next_update_weights;
uint64_t save_count; uint64_t save_count;
// Do not shuffle when reading the phase. // Do not shuffle when reading the phase.
bool no_shuffle; bool no_shuffle;
bool stop_flag; std::atomic<bool> stop_flag;
vector<Key> hash; vector<Key> hash;
@@ -785,7 +785,7 @@ namespace Learner
// Mini batch size size. Be sure to set it on the side that uses this class. // Mini batch size size. Be sure to set it on the side that uses this class.
uint64_t mini_batch_size = LEARN_MINI_BATCH_SIZE; uint64_t mini_batch_size = LEARN_MINI_BATCH_SIZE;
bool stop_flag; std::atomic<bool> stop_flag;
// Discount rate // Discount rate
double discount_rate; double discount_rate;