]> git.sesse.net Git - stockfish/blobdiff - src/benchmark.cpp
Detach search arguments from UI thread
[stockfish] / src / benchmark.cpp
index 95dd88ac01fad7b525eb65a90d3e0cce1ab40e54..ee1128043f32f9b94f20f1722f2df55bc074ae5b 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "position.h"
 #include "search.h"
+#include "thread.h"
 #include "ucioption.h"
 
 using namespace std;
@@ -58,8 +59,9 @@ static const string Defaults[] = {
 
 void benchmark(int argc, char* argv[]) {
 
+  std::vector<Move> searchMoves(1, MOVE_NONE);
   vector<string> fenList;
-  SearchLimits limits;
+  Search::LimitsType limits;
   int64_t totalNodes;
   int time;
 
@@ -110,14 +112,13 @@ void benchmark(int argc, char* argv[]) {
 
   for (size_t i = 0; i < fenList.size(); i++)
   {
-      Move moves[] = { MOVE_NONE };
       Position pos(fenList[i], false, 0);
 
       cerr << "\nBench position: " << i + 1 << '/' << fenList.size() << endl;
 
       if (valType == "perft")
       {
-          int64_t cnt = perft(pos, limits.maxDepth * ONE_PLY);
+          int64_t cnt = Search::perft(pos, limits.maxDepth * ONE_PLY);
 
           cerr << "\nPerft " << limits.maxDepth
                << " nodes counted: " << cnt << endl;
@@ -126,10 +127,8 @@ void benchmark(int argc, char* argv[]) {
       }
       else
       {
-          if (!think(pos, limits, moves))
-              break;
-
-          totalNodes += pos.nodes_searched();
+          Threads.start_thinking(pos, limits, searchMoves, false);
+          totalNodes += Search::RootPosition.nodes_searched();
       }
   }