Add a standardized benchmark command speedtest.

`speedtest [threads] [hash_MiB] [time_s]`. `threads` default to system concurrency. `hash_MiB` defaults to `threads*128`. `time_s` defaults to 150.

Intended to be used with default parameters, as a stable hardware benchmark.

Example:
```
C:\dev\stockfish-master\src>stockfish.exe speedtest
Stockfish dev-20240928-nogit by the Stockfish developers (see AUTHORS file)
info string Using 16 threads
Warmup position 3/3
Position 258/258
===========================
Version                    : Stockfish dev-20240928-nogit
Compiled by                : g++ (GNUC) 13.2.0 on MinGW64
Compilation architecture   : x86-64-vnni256
Compilation settings       : 64bit VNNI BMI2 AVX2 SSE41 SSSE3 SSE2 POPCNT
Compiler __VERSION__ macro : 13.2.0
Large pages                : yes
User invocation            : speedtest
Filled invocation          : speedtest 16 2048 150
Available processors       : 0-15
Thread count               : 16
Thread binding             : none
TT size [MiB]              : 2048
Hash max, avg [per mille]  :
    single search          : 40, 21
    single game            : 631, 428
Total nodes searched       : 2099917842
Total search time [s]      : 153.937
Nodes/second               : 13641410
```

-------------------------------

Small unrelated tweaks:
 - Network verification output is now handled as a callback.
 - TT hashfull queries allow specifying maximum entry age.

closes https://github.com/official-stockfish/Stockfish/pull/5354

No functional change
This commit is contained in:
Tomasz Sobczyk
2024-06-04 17:23:56 +02:00
committed by Joost VandeVondele
parent aff1f67997
commit 3ac75cd27d
15 changed files with 663 additions and 52 deletions
+5 -3
View File
@@ -28,6 +28,7 @@
#include <iosfwd>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#define stringify2(x) #x
@@ -35,6 +36,7 @@
namespace Stockfish {
std::string engine_version_info();
std::string engine_info(bool to_uci = false);
std::string compiler_info();
@@ -79,8 +81,8 @@ inline TimePoint now() {
.count();
}
inline std::vector<std::string> split(const std::string& s, const std::string& delimiter) {
std::vector<std::string> res;
inline std::vector<std::string_view> split(std::string_view s, std::string_view delimiter) {
std::vector<std::string_view> res;
if (s.empty())
return res;
@@ -102,7 +104,7 @@ inline std::vector<std::string> split(const std::string& s, const std::string& d
}
void remove_whitespace(std::string& s);
bool is_whitespace(const std::string& s);
bool is_whitespace(std::string_view s);
enum SyncCout {
IO_LOCK,