Skip to content

Commit

Permalink
bench for signature as warmup
Browse files Browse the repository at this point in the history
  • Loading branch information
ppigazzini committed Mar 9, 2025
1 parent 0d2c3db commit 7bc3a49
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 12 additions & 13 deletions worker/games.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,7 @@ def run_parallel_benches(engine, concurrency, threads, hash_size, depth):


def get_bench_nps(engine, games_concurrency, threads, hash_size):
_depth, depth = 10, 13
print("Warmup for bench...")
results = run_parallel_benches(
engine, games_concurrency, threads, hash_size, _depth
)
print(f"...done in {results[0][0]:.2f}ms")
depth = 13
print("Running bench...")
results = run_parallel_benches(engine, games_concurrency, threads, hash_size, depth)

Expand Down Expand Up @@ -482,15 +477,15 @@ def get_bench_nps(engine, games_concurrency, threads, hash_size):
return mean_nps


def verify_signature(engine, signature):
def verify_signature(engine, signature, concurrency):
hash_size, threads, depth = 16, 1, 13
print("Computing engine signature...")
bench_time, bench_nodes = run_single_bench(engine, hash_size, threads, depth)
print(f"...done in {bench_time:.2f}ms")
if int(bench_nodes) != int(signature):
results = run_parallel_benches(engine, concurrency, threads, hash_size, depth)
print(f"...done in {results[0][0]:.2f}ms")
if int(results[0][1]) != int(signature):
message = (
f"Wrong bench in {engine.name}, "
f"user expected: {signature} but worker got: {int(bench_nodes)}"
f"user expected: {signature} but worker got: {int(results[0][1])}"
)
raise RunException(message)

Expand Down Expand Up @@ -1481,7 +1476,9 @@ def create_environment():
run_errors = []
try:
cpu_features = get_cpu_features(base_engine)
verify_signature(base_engine, run["args"]["base_signature"])
verify_signature(
base_engine, run["args"]["base_signature"], games_concurrency * threads
)
base_nps = get_bench_nps(base_engine, games_concurrency, threads, base_hash)
except RunException as e:
run_errors.append(str(e))
Expand All @@ -1494,7 +1491,9 @@ def create_environment():
):
try:
_ = get_cpu_features(new_engine)
verify_signature(new_engine, run["args"]["new_signature"])
verify_signature(
new_engine, run["args"]["new_signature"], games_concurrency * threads
)
_ = get_bench_nps(new_engine, games_concurrency, threads, new_hash)
except RunException as e:
run_errors.append(str(e))
Expand Down
2 changes: 1 addition & 1 deletion worker/sri.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"__version": 268, "updater.py": "PLWj7cnPP4rG8g5R5bJV0Za4kZpuRxbpcpebyFByXeFDUtfat/gfBn/0kJBMOY/m", "worker.py": "EIVTZsH4tTkjuaE4XCFD9AfGaq4zNUnBW0STxp5qhQMxA/bGa8/ZAu35pOW8y8Ai", "games.py": "Bm1x+MQBTx9B0Sqq1d2aIoRmUFesjVb9jz79Hncp+bp0g5VJUgvggrk53Nd+yRi8"}
{"__version": 268, "updater.py": "PLWj7cnPP4rG8g5R5bJV0Za4kZpuRxbpcpebyFByXeFDUtfat/gfBn/0kJBMOY/m", "worker.py": "EIVTZsH4tTkjuaE4XCFD9AfGaq4zNUnBW0STxp5qhQMxA/bGa8/ZAu35pOW8y8Ai", "games.py": "imH47Cz9Eus2pTprURxWbezg63I+tyxGodc67fgeT95l03vMgZEp9/XIhtzWeB2o"}

0 comments on commit 7bc3a49

Please sign in to comment.