Skip to content

Commit

Permalink
verify refactor / tune
Browse files Browse the repository at this point in the history
  • Loading branch information
madMAx43v3r committed Apr 3, 2024
1 parent 06aa6c3 commit 23bd896
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pos/verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,19 @@ compute(const std::vector<uint32_t>& X_values, std::vector<uint32_t>* X_out, con
}
const auto X_set = std::set<uint32_t>(X_values.begin(), X_values.end());

const bool use_threads = (xbits > 6);
const bool use_threads = (xbits >= 6);

if(use_threads) {
std::lock_guard<std::mutex> lock(g_mutex);
if(!g_threads) {
const auto cpu_threads = std::thread::hardware_concurrency();
const auto num_threads = cpu_threads > 0 ? cpu_threads : 16;
g_threads = std::make_shared<vnx::ThreadPool>(num_threads, 1024);
vnx::log_info() << "Using " << num_threads << " CPU threads (for proof compute)";
vnx::log_info() << "Using " << num_threads << " CPU threads for proof compute";
}
}
const uint32_t kmask = ((uint64_t(1) << ksize) - 1);
const uint32_t num_entries_1 = X_set.size() << xbits;
const uint64_t num_entries_1 = X_set.size() << xbits;

std::mutex mutex;
std::vector<int64_t> jobs;
Expand All @@ -116,7 +116,7 @@ compute(const std::vector<uint32_t>& X_values, std::vector<uint32_t>* X_out, con
M_tmp.reserve(num_entries_1);
entries.reserve(num_entries_1);

for(const auto X : std::set<uint32_t>(X_set.begin(), X_set.end()))
for(const auto X : X_set)
{
if(use_threads) {
const auto job = g_threads->add_task(
Expand Down

0 comments on commit 23bd896

Please sign in to comment.