X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbenchmark.cpp;h=9b1b40091d48e2d623d617e989ee777059fcd0a4;hb=412d68fe4f3e32b3314141a861554e18940ff556;hp=4c2ba7472703a3c88979678c30a78361d8b51e76;hpb=18677852315b960132b0e8daa220c83b1c3c17cd;p=stockfish
diff --git a/src/benchmark.cpp b/src/benchmark.cpp
index 4c2ba747..9b1b4009 100644
--- a/src/benchmark.cpp
+++ b/src/benchmark.cpp
@@ -7,12 +7,12 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
Stockfish is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
@@ -53,7 +53,7 @@ const std::string BenchmarkPositions[] = {
"4k2r/1pb2ppp/1p2p3/1R1p4/3P4/2r1PN2/P4PPP/1R4K1 b - 3 22",
"3q2k1/pb3p1p/4pbp1/2r5/PpN2N2/1P2P2P/5PP1/Q2R2K1 b - - 4 26"
};
-
+
////
//// Functions
@@ -71,8 +71,8 @@ void benchmark(const std::string& commandLine) {
std::istringstream csVal(commandLine);
std::istringstream csStr(commandLine);
- std::string ttSize, threads, fileName, timeOrDepth;
- int val, secsPerPos, maxDepth = 0;
+ std::string ttSize, threads, fileName, limitType;
+ int val, secsPerPos, maxDepth, maxNodes;
csStr >> ttSize;
csVal >> val;
@@ -88,27 +88,28 @@ void benchmark(const std::string& commandLine) {
std::cerr << "The number of threads must be between 1 and " << THREAD_MAX
<< std::endl;
exit(EXIT_FAILURE);
- }
+ }
set_option_value("Hash", ttSize);
set_option_value("Threads", threads);
set_option_value("OwnBook", "false");
set_option_value("Use Search Log", "true");
set_option_value("Search Log Filename", "bench.txt");
- csVal >> secsPerPos;
+ csVal >> val;
csVal >> fileName;
- csVal >> timeOrDepth;
+ csVal >> limitType;
- if (timeOrDepth == "time")
- secsPerPos *= 1000;
+ secsPerPos = maxDepth = maxNodes = 0;
+
+ if (limitType == "time")
+ secsPerPos = val * 1000;
+ else if (limitType == "depth")
+ maxDepth = val;
else
- {
- maxDepth = secsPerPos;
- secsPerPos = 0;
- }
+ maxNodes = val;
std::vector positions;
-
+
if (fileName != "default")
{
std::ifstream fenFile(fileName.c_str());
@@ -117,7 +118,7 @@ void benchmark(const std::string& commandLine) {
std::cerr << "Unable to open positions file " << fileName
<< std::endl;
exit(EXIT_FAILURE);
- }
+ }
std::string pos;
while (fenFile.good())
{
@@ -133,15 +134,18 @@ void benchmark(const std::string& commandLine) {
int startTime = get_system_time();
std::vector::iterator it;
int cnt = 1;
+ int64_t totalNodes = 0;
for (it = positions.begin(); it != positions.end(); ++it, ++cnt)
{
Move moves[1] = {MOVE_NONE};
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, 0, secsPerPos, moves);
+ think(pos, true, false, 0, dummy, dummy, 0, maxDepth, maxNodes, secsPerPos, moves);
+ totalNodes += nodes_searched();
}
- std::cout << "\n\nBenchmarking finished. Processing time (ms) " << get_system_time() - startTime
- << std::endl << "Press any key to exit\n";
+ std::cout << "\nProcessing time (ms) " << get_system_time() - startTime << std::endl
+ << "Nodes searched " << totalNodes << std::endl
+ << "Press any key to exit" << std::endl;
std::cin >> fileName;
}