|
1 | | -""" |
2 | 1 | """Hardware benchmark script for CI runners. |
3 | 2 | Compares CPU and GPU performance to diagnose slowdowns. |
4 | 3 | Works on both CPU-only (GitHub Actions) and GPU (RunsOn) runners. |
@@ -204,7 +203,7 @@ def matmul(a, b): |
204 | 203 | C = matmul(A, B).block_until_ready() |
205 | 204 | elapsed = time.perf_counter() - start |
206 | 205 | print(f"Matrix multiply compiled ({n}x{n}): {elapsed:.3f} seconds") |
207 | | - results["matmul_3000x3000_compiled"] = elapsed) |
| 206 | + results["matmul_3000x3000_compiled"] = elapsed |
208 | 207 |
|
209 | 208 | # Element-wise GPU benchmark |
210 | 209 | x = jax.random.normal(key, (50_000_000,)) |
@@ -235,7 +234,7 @@ def elementwise_ops(x): |
235 | 234 | RESULTS["benchmarks"]["jax"] = {"error": str(e)} |
236 | 235 | except Exception as e: |
237 | 236 | print(f"JAX benchmark failed: {e}") |
238 | | - RESULTS["benchmarks"]["jax"] = {"error": str(e)}) |
| 237 | + RESULTS["benchmarks"]["jax"] = {"error": str(e)} |
239 | 238 |
|
240 | 239 | def benchmark_numba(): |
241 | 240 | """Numba CPU benchmark.""" |
@@ -268,7 +267,7 @@ def numba_sum(n): |
268 | 267 | result = numba_sum(10_000_000) |
269 | 268 | elapsed = time.perf_counter() - start |
270 | 269 | print(f"Integer sum compiled (10M): {elapsed:.3f} seconds") |
271 | | - results["integer_sum_10M_compiled"] = elapsed) |
| 270 | + results["integer_sum_10M_compiled"] = elapsed |
272 | 271 |
|
273 | 272 | @numba.jit(nopython=True, parallel=True) |
274 | 273 | def numba_parallel_sum(arr): |
@@ -301,7 +300,7 @@ def numba_parallel_sum(arr): |
301 | 300 | RESULTS["benchmarks"]["numba"] = {"error": str(e)} |
302 | 301 | except Exception as e: |
303 | 302 | print(f"Numba benchmark failed: {e}") |
304 | | - RESULTS["benchmarks"]["numba"] = {"error": str(e)}) |
| 303 | + RESULTS["benchmarks"]["numba"] = {"error": str(e)} |
305 | 304 |
|
306 | 305 | if __name__ == "__main__": |
307 | 306 | print("\n" + "=" * 60) |
|
0 commit comments