From 1845acf65fb42e3a3f008e5ac27a94ff4c209e1d Mon Sep 17 00:00:00 2001 From: tqcq Date: Sat, 26 Oct 2024 09:43:53 +0000 Subject: [PATCH] feat: min step --- drama/src/rev-mc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drama/src/rev-mc.c b/drama/src/rev-mc.c index 2e3bfc8..81cb8be 100644 --- a/drama/src/rev-mc.c +++ b/drama/src/rev-mc.c @@ -332,7 +332,7 @@ find_row_mask(std::vector &sets, if (thread_num > 4) { thread_num -= 4; } fprintf(stderr, "thread_num: %d\n", thread_num); - uint64_t step = 1000000; + uint64_t step = 1000; std::atomic cur_pos{0}; std::atomic base_pos{0}; // for (uint64_t i = row_mask; i < last_mask; ++step) { i = next_bit_permutation(i); } @@ -354,7 +354,7 @@ find_row_mask(std::vector &sets, step_count = cur_pos - base_pos; my_pos = cur_pos.fetch_add(1); } - while (cur_mask < last_mask && step_count > 0) { + while (cur_mask < last_mask && step_count > 0 && !found.load(std::memory_order_relaxed)) { --step_count; for (int i = 0; i < step && cur_mask < last_mask; ++i) { cur_mask = next_bit_permutation(cur_mask);