Skip to content

Commit

Permalink
calculating time elapsed from start to end of nn eval + logging if ti…
Browse files Browse the repository at this point in the history
…me > 1s

fixing issue LeelaChessZero#1768
  • Loading branch information
KarlKfoury authored Aug 30, 2024
1 parent b12e68b commit 4045a1c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/mcts/search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,15 @@ int SearchWorker::PrefetchIntoCache(Node* node, int budget, bool is_odd_depth) {

// 4. Run NN computation.
// ~~~~~~~~~~~~~~~~~~~~~~
void SearchWorker::RunNNComputation() { computation_->ComputeBlocking(); }
void SearchWorker::RunNNComputation() {
auto start_time = std::chrono::high_resolution_clock::now();
computation_->ComputeBlocking();
auto end_time = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = end_time - start_time;
if (elapsed.count() > 1.0) {
std::cerr << "Warning: Computation took " << elapsed.count() << " seconds, which is longer than expected." << std::endl;
}
}

// 5. Retrieve NN computations (and terminal values) into nodes.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 4045a1c

Please sign in to comment.