diff --git a/drama/src/rev-mc.c b/drama/src/rev-mc.c index dd462de..b8c795c 100644 --- a/drama/src/rev-mc.c +++ b/drama/src/rev-mc.c @@ -342,6 +342,7 @@ find_row_mask(std::vector &sets, fprintf(stderr, "worker_step: %ld\n", step); std::atomic cnt{0}; + std::atomic progress{0}; for (int i = 0; i < thread_num; ++i) { workers.emplace_back([&] { while (!found) { @@ -359,8 +360,8 @@ find_row_mask(std::vector &sets, for (int i = std::min(step_count, step); 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\n", - cnt.load(std::memory_order_relaxed), step_count, g_cur_pos.load()); + fprintf(stderr, "cnt : %ld, step_count: %5ld, cur_pos: %5ld progress: %ld\n", + cnt.load(std::memory_order_relaxed), step_count, g_cur_pos.load(), progress.load()); } } @@ -383,7 +384,7 @@ find_row_mask(std::vector &sets, } } - for (int i = 0; i < step && cur_mask < last_mask && !found.load(std::memory_order_relaxed); ++i) { + for (int i = step * 10; 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)) { @@ -393,6 +394,7 @@ find_row_mask(std::vector &sets, } } } + progress.fetch_add(step * 10); } }); }