Skip to content

Commit

Permalink
calculating neural network evaluation time and logging a message if t…
Browse files Browse the repository at this point in the history
…ime > 1s

adressing issue LeelaChessZero#1768
  • Loading branch information
KarlKfoury authored Aug 31, 2024
1 parent e9b7745 commit 3871405
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/mcts/search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,16 @@ 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::cout << "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 3871405

Please sign in to comment.