fix: error
This commit is contained in:
parent
6cbbb133c1
commit
c99dba25d2
@ -332,7 +332,7 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
if (cpu == 0 && thread_num > 4) { thread_num -= 4; }
|
||||
fprintf(stderr, "thread_num: %d\n", thread_num);
|
||||
|
||||
uint64_t step = 1000;
|
||||
uint64_t step = 1000 * 10;
|
||||
std::atomic<uint64_t> g_cur_pos{0};
|
||||
std::atomic<uint64_t> g_base_pos{0};
|
||||
// for (uint64_t i = row_mask; i < last_mask; ++step) { i = next_bit_permutation(i); }
|
||||
@ -354,10 +354,10 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
if (row_mask >= last_mask || found) { break; }
|
||||
cur_mask = row_mask;
|
||||
step_count = g_cur_pos - g_base_pos;
|
||||
my_pos = g_cur_pos.fetch_add(step * 10);
|
||||
my_pos = g_cur_pos.fetch_add(step);
|
||||
}
|
||||
while (cur_mask < last_mask && step_count > 0 && !found.load(std::memory_order_relaxed)) {
|
||||
for (int i = std::min(step_count, step); i > 0 && cur_mask < last_mask; --i) {
|
||||
for (int i = std::min(step_count, step / 10); i > 0 && cur_mask < last_mask; --i) {
|
||||
cur_mask = next_bit_permutation(cur_mask);
|
||||
if (cnt.fetch_add(1) % 10000000 == 0) {
|
||||
fprintf(stderr, "cnt : %ld, step_count: %5ld, cur_pos: %5ld progress: %ld\n",
|
||||
@ -375,16 +375,16 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
g_base_pos = my_pos;
|
||||
row_mask = cur_mask;
|
||||
}
|
||||
} else if (g_base_pos.load(std::memory_order_relaxed) < g_cur_pos.load(std::memory_order_relaxed)) {
|
||||
} else if (g_base_pos.load(std::memory_order_relaxed) < my_pos) {
|
||||
std::lock_guard<std::mutex> _(lock);
|
||||
if (g_base_pos < g_cur_pos) {
|
||||
cur_mask = row_mask;
|
||||
my_pos = g_base_pos;
|
||||
if (g_base_pos <= my_pos) {
|
||||
cur_mask = row_mask;
|
||||
step_count = my_pos - g_base_pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = step * 10; i > 0 && cur_mask < last_mask && !found.load(std::memory_order_relaxed); --i) {
|
||||
for (int i = step; i > 0 && cur_mask < last_mask && !found.load(std::memory_order_relaxed); --i) {
|
||||
if (resolve(cur_mask)) {
|
||||
bool expected = false;
|
||||
if (found.compare_exchange_strong(expected, true)) {
|
||||
@ -394,7 +394,7 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
}
|
||||
}
|
||||
}
|
||||
progress.fetch_add(step * 10);
|
||||
progress.fetch_add(step);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user