Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Keep machine paths out of the benchmark scripts (issue #625)

Nguyen Xuan An6d6e83a49a42
diff --git a/bench/reference/gpu-compare.mjs b/bench/reference/gpu-compare.mjs
index 62940047..59b6bff8 100644
--- a/bench/reference/gpu-compare.mjs
+++ b/bench/reference/gpu-compare.mjs
@@ -1,7 +1,7 @@
// Draws reference scenes with the path tracer on the CPU and on the GPU, same seed, and writes the images and timings.
// node bench/reference/gpu-compare.mjs <output directory> <scene id>,<scene id> [--samples 64] [--backend cpu|gpu|webgpu|both]
// [--width 960] [--height 540] [--bounces 8] [--no-denoise] [--threads 8]
-// Files are <scene>-pathtracer-<backend>.png and timings.json. Run it through bash ~/.agents/tools/gpu-lock.sh: the GPU
+// Files are <scene>-pathtracer-<backend>.png and timings.json. Run it through the GPU lock script (gpu-lock.sh): the GPU
// backend takes the whole GPU for seconds at a time.
import { mkdir, readFile, writeFile } from 'node:fs/promises';
import { constants, setPriority } from 'node:os';
diff --git a/bench/webgpu-tracer/compare.sh b/bench/webgpu-tracer/compare.sh
index 4926e245..d2c1f41a 100644
--- a/bench/webgpu-tracer/compare.sh
+++ b/bench/webgpu-tracer/compare.sh
@@ -3,10 +3,11 @@
# The first pair runs in fresh Chrome profiles (cold shader caches), the later pairs reuse them (warm).
# bash bench/webgpu-tracer/compare.sh <output directory>
set -u
+GPU_LOCK="${GPU_LOCK:-gpu-lock.sh}" # path of the machine GPU lock script
OUT="${1:?output directory}"
rm -rf "$OUT/profile-webgl" "$OUT/profile-wavefront" "$OUT/profile-megakernel"
for RUN in 1 2 3; do
for VARIANT in wavefront megakernel webgl; do
- bash ~/.agents/tools/gpu-lock.sh node bench/webgpu-tracer/run.mjs "$OUT" "$VARIANT" --label "run$RUN" 2>&1 | cut -c1-1500
+ bash "$GPU_LOCK" node bench/webgpu-tracer/run.mjs "$OUT" "$VARIANT" --label "run$RUN" 2>&1 | cut -c1-1500
done
done
diff --git a/bench/webgpu-tracer/run.mjs b/bench/webgpu-tracer/run.mjs
index 601ae27a..390a0bb9 100644
--- a/bench/webgpu-tracer/run.mjs
+++ b/bench/webgpu-tracer/run.mjs
@@ -1,5 +1,5 @@
// One timed trace of the demo room with one backend, in a headless Chrome whose profile persists per backend (so the first
-// run in a fresh profile is the cold compile and later runs are warm). Run it through bash ~/.agents/tools/gpu-lock.sh.
+// run in a fresh profile is the cold compile and later runs are warm). Run it through the GPU lock script (gpu-lock.sh).
// node bench/webgpu-tracer/run.mjs <output directory> <webgl|wavefront|megakernel> [--samples 64] [--width 1920] [--height 1080] [--label run1] [--sort on|off]
// Writes <variant>-<label>.png and <variant>-<label>.json; the profile lives in <output directory>/profile-<variant>.
import { mkdir, readFile, writeFile } from 'node:fs/promises';