X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fbenchmark.cpp;h=27517f4fb8e5559d3832a7a3928411182467063a;hb=5c81602d14539f8259a715477315e28b5de7cb54;hp=9b1b40091d48e2d623d617e989ee777059fcd0a4;hpb=c97104e8540b72ee2c6c9c13d3773d2c0f9ec32f;p=stockfish diff --git a/src/benchmark.cpp b/src/benchmark.cpp index 9b1b4009..27517f4f 100644 --- a/src/benchmark.cpp +++ b/src/benchmark.cpp @@ -1,7 +1,7 @@ /* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) - Copyright (C) 2008 Marco Costalba + Copyright (C) 2008-2009 Marco Costalba Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -79,15 +79,14 @@ void benchmark(const std::string& commandLine) { if (val < 4 || val > 1024) { std::cerr << "The hash table size must be between 4 and 1024" << std::endl; - exit(EXIT_FAILURE); + Application::exit_with_failure(); } csStr >> threads; csVal >> val; if (val < 1 || val > THREAD_MAX) { - std::cerr << "The number of threads must be between 1 and " << THREAD_MAX - << std::endl; - exit(EXIT_FAILURE); + std::cerr << "The number of threads must be between 1 and " << THREAD_MAX << std::endl; + Application::exit_with_failure(); } set_option_value("Hash", ttSize); set_option_value("Threads", threads); @@ -115,9 +114,8 @@ void benchmark(const std::string& commandLine) { std::ifstream fenFile(fileName.c_str()); if (!fenFile.is_open()) { - std::cerr << "Unable to open positions file " << fileName - << std::endl; - exit(EXIT_FAILURE); + std::cerr << "Unable to open positions file " << fileName << std::endl; + Application::exit_with_failure(); } std::string pos; while (fenFile.good()) @@ -141,7 +139,8 @@ void benchmark(const std::string& commandLine) { int dummy[2] = {0, 0}; Position pos(*it); std::cout << "\nProcessing position " << cnt << '/' << positions.size() << std::endl << std::endl; - think(pos, true, false, 0, dummy, dummy, 0, maxDepth, maxNodes, secsPerPos, moves); + if (!think(pos, true, false, 0, dummy, dummy, 0, maxDepth, maxNodes, secsPerPos, moves)) + break; totalNodes += nodes_searched(); } std::cout << "\nProcessing time (ms) " << get_system_time() - startTime << std::endl