From 78eae463a09d2e364a99015693a5e6c8a8632354 Mon Sep 17 00:00:00 2001 From: germ3n Date: Thu, 17 Jul 2025 20:17:26 +0100 Subject: [PATCH] improve error handling in tig-benchmarker @run_tig_runtime --- tig-benchmarker/slave/main.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/tig-benchmarker/slave/main.py b/tig-benchmarker/slave/main.py index 1646c97c..313bfd89 100644 --- a/tig-benchmarker/slave/main.py +++ b/tig-benchmarker/slave/main.py @@ -80,15 +80,16 @@ def run_tig_runtime(nonce, batch, so_path, ptx_path, results_dir): while True: ret = process.poll() if ret is not None: - # exit codes: - # 0 - success - # 82 - cuda out of memory - # 83 - host out of memory - # 84 - runtime error - # 85 - no solution - # 86 - invalid solution - # 87 - out of fuel - if (ret == 84 or ret == 87) and not os.path.exists(output_file): + exit_codes = { + 0: "success", + 82: "cuda out of memory", + 83: "host out of memory", + 84: "runtime error", + 85: "no solution", + 86: "invalid solution", + 87: "out of fuel", + } + if (ret != 0 and ret in exit_codes) and not os.path.exists(output_file): with open(output_file, "w") as f: json.dump(dict( nonce=nonce, @@ -98,8 +99,11 @@ def run_tig_runtime(nonce, batch, so_path, ptx_path, results_dir): cpu_arch=CPU_ARCH ), f) - if ret not in {0, 84, 85, 86, 87}: - logger.error(f"batch {batch['id']}, nonce {nonce} failed with exit code {ret}: {process.stderr.read().decode()}") + if ret != 0: + if ret not in exit_codes: + logger.error(f"batch {batch['id']}, nonce {nonce} failed with exit code {ret}: {process.stderr.read().decode()}") + else: + logger.error(f"batch {batch['id']}, nonce {nonce} failed with exit code {ret}: {exit_codes[ret]}") break