From: Marco Costalba Date: Sat, 22 Nov 2008 10:02:05 +0000 (+0100) Subject: Introduce depth limited benchmarking X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=18677852315b960132b0e8daa220c83b1c3c17cd;ds=sidebyside Introduce depth limited benchmarking Also print some more info. Signed-off-by: Marco Costalba --- diff --git a/src/benchmark.cpp b/src/benchmark.cpp index 5102b369..4c2ba747 100644 --- a/src/benchmark.cpp +++ b/src/benchmark.cpp @@ -71,8 +71,8 @@ void benchmark(const std::string& commandLine) { std::istringstream csVal(commandLine); std::istringstream csStr(commandLine); - std::string ttSize, threads, fileName; - int val, secsPerPos; + std::string ttSize, threads, fileName, timeOrDepth; + int val, secsPerPos, maxDepth = 0; csStr >> ttSize; csVal >> val; @@ -97,6 +97,15 @@ void benchmark(const std::string& commandLine) { csVal >> secsPerPos; csVal >> fileName; + csVal >> timeOrDepth; + + if (timeOrDepth == "time") + secsPerPos *= 1000; + else + { + maxDepth = secsPerPos; + secsPerPos = 0; + } std::vector positions; @@ -121,12 +130,18 @@ void benchmark(const std::string& commandLine) { for (int i = 0; i < 16; i++) positions.push_back(std::string(BenchmarkPositions[i])); + int startTime = get_system_time(); std::vector::iterator it; - for (it = positions.begin(); it != positions.end(); ++it) + int cnt = 1; + for (it = positions.begin(); it != positions.end(); ++it, ++cnt) { - Move moves[1] = {MOVE_NONE}; - int dummy[2] = {0, 0}; + Move moves[1] = {MOVE_NONE}; + int dummy[2] = {0, 0}; Position pos(*it); - think(pos, true, false, 0, dummy, dummy, 0, 0, 0, secsPerPos * 1000, moves); + std::cout << "\nProcessing position " << cnt << '/' << positions.size() << std::endl << std::endl; + think(pos, true, false, 0, dummy, dummy, 0, maxDepth, 0, secsPerPos, moves); } + std::cout << "\n\nBenchmarking finished. Processing time (ms) " << get_system_time() - startTime + << std::endl << "Press any key to exit\n"; + std::cin >> fileName; } diff --git a/src/main.cpp b/src/main.cpp index 9d2e1ef2..89ca9e8e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -71,16 +71,18 @@ int main(int argc, char *argv[]) { // Process command line arguments if (argc >= 2 && string(argv[1]) == "bench") { - if (argc < 4 || argc > 6) + if (argc < 4 || argc > 7) { std::cout << "Usage: glaurung bench " - << "[time = 60s] [fen positions file = default]" + << "[time = 60s] [fen positions file = default] " + << "[time or depth limited = time]" << std::endl; exit(0); } string time = argc > 4 ? argv[4] : "60"; string fen = argc > 5 ? argv[5] : "default"; - benchmark(string(argv[2]) + " " + string(argv[3]) + " " + time + " " + fen); + string dt = argc > 6 ? argv[6] : "time"; + benchmark(string(argv[2]) + " " + string(argv[3]) + " " + time + " " + fen + " " + dt); return 0; } diff --git a/src/search.cpp b/src/search.cpp index c463ec39..3f4ad24c 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -431,7 +431,7 @@ void think(const Position &pos, bool infinite, bool ponder, int side_to_move, if (!movesToGo) // Sudden death time control { - if (increment) + if (myIncrement) { MaxSearchTime = myTime / 30 + myIncrement; AbsoluteMaxSearchTime = Max(myTime / 4, myIncrement - 100);