1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Introduce depth limited benchmarking

Also print some more info.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2008-11-22 11:02:05 +01:00
parent bac4da70c9
commit 1867785231
3 changed files with 27 additions and 10 deletions

View file

@ -71,8 +71,8 @@ void benchmark(const std::string& commandLine) {
std::istringstream csVal(commandLine); std::istringstream csVal(commandLine);
std::istringstream csStr(commandLine); std::istringstream csStr(commandLine);
std::string ttSize, threads, fileName; std::string ttSize, threads, fileName, timeOrDepth;
int val, secsPerPos; int val, secsPerPos, maxDepth = 0;
csStr >> ttSize; csStr >> ttSize;
csVal >> val; csVal >> val;
@ -97,6 +97,15 @@ void benchmark(const std::string& commandLine) {
csVal >> secsPerPos; csVal >> secsPerPos;
csVal >> fileName; csVal >> fileName;
csVal >> timeOrDepth;
if (timeOrDepth == "time")
secsPerPos *= 1000;
else
{
maxDepth = secsPerPos;
secsPerPos = 0;
}
std::vector<std::string> positions; std::vector<std::string> positions;
@ -121,12 +130,18 @@ void benchmark(const std::string& commandLine) {
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
positions.push_back(std::string(BenchmarkPositions[i])); positions.push_back(std::string(BenchmarkPositions[i]));
int startTime = get_system_time();
std::vector<std::string>::iterator it; std::vector<std::string>::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}; Move moves[1] = {MOVE_NONE};
int dummy[2] = {0, 0}; int dummy[2] = {0, 0};
Position pos(*it); 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;
} }

View file

@ -71,16 +71,18 @@ int main(int argc, char *argv[]) {
// Process command line arguments // Process command line arguments
if (argc >= 2 && string(argv[1]) == "bench") if (argc >= 2 && string(argv[1]) == "bench")
{ {
if (argc < 4 || argc > 6) if (argc < 4 || argc > 7)
{ {
std::cout << "Usage: glaurung bench <hash size> <threads> " std::cout << "Usage: glaurung bench <hash size> <threads> "
<< "[time = 60s] [fen positions file = default] " << "[time = 60s] [fen positions file = default] "
<< "[time or depth limited = time]"
<< std::endl; << std::endl;
exit(0); exit(0);
} }
string time = argc > 4 ? argv[4] : "60"; string time = argc > 4 ? argv[4] : "60";
string fen = argc > 5 ? argv[5] : "default"; 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; return 0;
} }

View file

@ -431,7 +431,7 @@ void think(const Position &pos, bool infinite, bool ponder, int side_to_move,
if (!movesToGo) // Sudden death time control if (!movesToGo) // Sudden death time control
{ {
if (increment) if (myIncrement)
{ {
MaxSearchTime = myTime / 30 + myIncrement; MaxSearchTime = myTime / 30 + myIncrement;
AbsoluteMaxSearchTime = Max(myTime / 4, myIncrement - 100); AbsoluteMaxSearchTime = Max(myTime / 4, myIncrement - 100);