Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Take the job queue command from GPU_LOCK in the tier scripts (Part of #904)

Nguyen Xuan An7304065bd423
diff --git a/bench/tiers/render-references.sh b/bench/tiers/render-references.sh
index 7a47ca57..be228e27 100644
--- a/bench/tiers/render-references.sh
+++ b/bench/tiers/render-references.sh
@@ -6,7 +6,7 @@ set -u
WORK_DIRECTORY="$1"
SCENE_LIST="${2:-lit-interior,spot-area,light-linking,metal,glass,outdoor-hdri}"
BLENDER_BIN="${BLENDER_BIN:-C:/Program Files/Blender Foundation/Blender 5.3/blender.exe}"
-GPU_LOCK="$HOME/.agents/tools/gpu-lock.sh"
+GPU_LOCK="${GPU_LOCK:-}" # set to a job queue command, for example GPU_LOCK="bash path/to/gpu-lock.sh", to share the card
REFERENCE_SAMPLES="${REFERENCE_SAMPLES:-4096}"
mkdir -p "$WORK_DIRECTORY/reference"
IFS=',' read -ra SCENES <<< "$SCENE_LIST"
@@ -16,7 +16,7 @@ for SCENE in "${SCENES[@]}"; do
echo "skip $SCENE"
continue
fi
- GPU_LOCK_WEIGHT=heavy bash "$GPU_LOCK" "$BLENDER_BIN" -b --factory-startup --python bench/cycles-parity/render-cycles.py -- \
+ GPU_LOCK_WEIGHT=heavy $GPU_LOCK "$BLENDER_BIN" -b --factory-startup --python bench/cycles-parity/render-cycles.py -- \
"$WORK_DIRECTORY/scenes/$SCENE.json" "$PREFIX" --samples "$REFERENCE_SAMPLES" --bounces 8 --seed 1 > "$WORK_DIRECTORY/reference/$SCENE.log" 2>&1
echo "done $SCENE exit $?"
done
diff --git a/bench/tiers/run-cook-seeds.sh b/bench/tiers/run-cook-seeds.sh
index 82ca81ba..d7434e95 100644
--- a/bench/tiers/run-cook-seeds.sh
+++ b/bench/tiers/run-cook-seeds.sh
@@ -6,11 +6,11 @@ set -u
WORK_DIRECTORY="$1"
SCENE="${2:-lit-interior}"
LAST_SEED="${3:-8}"
-GPU_LOCK="$HOME/.agents/tools/gpu-lock.sh"
+GPU_LOCK="${GPU_LOCK:-}" # set to a job queue command, for example GPU_LOCK="bash path/to/gpu-lock.sh", to share the card
for seed in $(seq 2 "$LAST_SEED"); do
for backend in gpu webgpu; do
[ -f "$WORK_DIRECTORY/final-$SCENE/$SCENE-cook-$backend-s256-seed$seed.json" ] && continue
- bash "$GPU_LOCK" node bench/tiers/run-cook.mjs "$WORK_DIRECTORY/final-$SCENE" "$SCENE" --backend "$backend" --samples 256 --repetitions 1 --seed "$seed" 2>&1 | tail -1
+ $GPU_LOCK node bench/tiers/run-cook.mjs "$WORK_DIRECTORY/final-$SCENE" "$SCENE" --backend "$backend" --samples 256 --repetitions 1 --seed "$seed" 2>&1 | tail -1
done
done
echo "seeds done"
diff --git a/bench/tiers/run-cook.mjs b/bench/tiers/run-cook.mjs
index 16699fc4..2d1cfe57 100644
--- a/bench/tiers/run-cook.mjs
+++ b/bench/tiers/run-cook.mjs
@@ -1,5 +1,5 @@
// Cook (the path tracer) with the cpu, gpu (WebGL2) and webgpu backends on a reference scene, at a ladder of sample counts, in headless Chrome.
-// [bash ~/.agents/tools/gpu-lock.sh] node bench/tiers/run-cook.mjs <output directory> <scene> --backend cpu|gpu|webgpu --samples 16,64,256 [--repetitions 3] [--width 960] [--height 540] [--threads 8]
+// [${GPU_LOCK}] node bench/tiers/run-cook.mjs <output directory> <scene> --backend cpu|gpu|webgpu --samples 16,64,256 [--repetitions 3] [--width 960] [--height 540] [--threads 8]
// Files: <scene>-cook-<backend>-s<samples>-r<n>.npy (linear RGB float32, rows from the top, as the Cycles script writes) and .json (the tracer's report,
// wall time, and the card memory polled around the trace). Settings: 8 bounces, seed 1, no denoiser, fireflyClamp 1e9, noiseThreshold 0.
import { execFile } from 'node:child_process';
diff --git a/bench/tiers/run-eevee.sh b/bench/tiers/run-eevee.sh
index c8cf495c..53600bd1 100644
--- a/bench/tiers/run-eevee.sh
+++ b/bench/tiers/run-eevee.sh
@@ -9,7 +9,7 @@ WIDTH="${3:-960}"
REPETITIONS="${4:-3}"
HEIGHT=$((WIDTH * 9 / 16))
BLENDER_BIN="${BLENDER_BIN:-C:/Program Files/Blender Foundation/Blender 5.3/blender.exe}"
-GPU_LOCK="$HOME/.agents/tools/gpu-lock.sh"
+GPU_LOCK="${GPU_LOCK:-}" # set to a job queue command, for example GPU_LOCK="bash path/to/gpu-lock.sh", to share the card
mkdir -p "$WORK_DIRECTORY/eevee"
IFS=',' read -ra SCENES <<< "$SCENE_LIST"
for repetition in $(seq 1 "$REPETITIONS"); do
@@ -18,7 +18,7 @@ for repetition in $(seq 1 "$REPETITIONS"); do
for preset in $PRESETS; do
prefix="$WORK_DIRECTORY/eevee/$scene-$preset-$WIDTH-r$repetition"
[ -f "$prefix.metrics.json" ] && continue
- bash "$GPU_LOCK" uv run --no-project --with psutil python bench/cycles-parity/measure-gpu-run.py "$prefix.metrics.json" -- \
+ $GPU_LOCK uv run --no-project --with psutil python bench/cycles-parity/measure-gpu-run.py "$prefix.metrics.json" -- \
"$BLENDER_BIN" -b --factory-startup --python bench/tiers/render-eevee.py -- "$WORK_DIRECTORY/scenes/$scene.json" "$prefix" \
--preset "$preset" --width "$WIDTH" --height "$HEIGHT" --frames 10 2>&1 | grep "EEVEE_TIMING" | cut -c1-160
done
diff --git a/bench/tiers/run-final-tier.sh b/bench/tiers/run-final-tier.sh
index fdbfd80a..bf86002f 100644
--- a/bench/tiers/run-final-tier.sh
+++ b/bench/tiers/run-final-tier.sh
@@ -8,7 +8,7 @@ WORK_DIRECTORY="$1"
SCENE="${2:-lit-interior}"
REPETITIONS="${3:-3}"
BLENDER_BIN="${BLENDER_BIN:-C:/Program Files/Blender Foundation/Blender 5.3/blender.exe}"
-GPU_LOCK="$HOME/.agents/tools/gpu-lock.sh"
+GPU_LOCK="${GPU_LOCK:-}" # set to a job queue command, for example GPU_LOCK="bash path/to/gpu-lock.sh", to share the card
SCENE_JSON="$WORK_DIRECTORY/scenes/$SCENE.json"
LADDER_DIRECTORY="$WORK_DIRECTORY/final-$SCENE"
mkdir -p "$LADDER_DIRECTORY"
@@ -16,14 +16,14 @@ mkdir -p "$LADDER_DIRECTORY"
run_cook() {
local backend="$1" samples="$2" repetition="$3"
[ -f "$LADDER_DIRECTORY/$SCENE-cook-$backend-s$samples-r$repetition.json" ] && return
- bash "$GPU_LOCK" node bench/tiers/run-cook.mjs "$LADDER_DIRECTORY" "$SCENE" --backend "$backend" --samples "$samples" --repetitions 1 --first-repetition "$repetition" 2>&1 | grep -v "^$" | tail -2
+ $GPU_LOCK node bench/tiers/run-cook.mjs "$LADDER_DIRECTORY" "$SCENE" --backend "$backend" --samples "$samples" --repetitions 1 --first-repetition "$repetition" 2>&1 | grep -v "^$" | tail -2
}
run_measured() {
local prefix="$1"
shift
[ -f "$prefix.metrics.json" ] && return
- bash "$GPU_LOCK" uv run --no-project --with psutil python bench/cycles-parity/measure-gpu-run.py "$prefix.metrics.json" -- "$@" 2>&1 | tail -1 | cut -c1-200
+ $GPU_LOCK uv run --no-project --with psutil python bench/cycles-parity/measure-gpu-run.py "$prefix.metrics.json" -- "$@" 2>&1 | tail -1 | cut -c1-200
}
run_native() {
diff --git a/bench/tiers/run-glaze.mjs b/bench/tiers/run-glaze.mjs
index 3a2c404b..e05fddb1 100644
--- a/bench/tiers/run-glaze.mjs
+++ b/bench/tiers/run-glaze.mjs
@@ -1,5 +1,5 @@
// Draws reference scenes with the Glaze tiers (draft, realtime) in headless Chrome on the GPU and records frame times, memory and PNGs.
-// [bash ~/.agents/tools/gpu-lock.sh] node bench/tiers/run-glaze.mjs <output directory> <scene,scene> [--width 960] [--height 540] [--repetitions 3] [--frames 10] [--tiers draft,realtime]
+// [${GPU_LOCK}] node bench/tiers/run-glaze.mjs <output directory> <scene,scene> [--width 960] [--height 540] [--repetitions 3] [--frames 10] [--tiers draft,realtime]
// Each repetition runs every scene and tier once on a fresh page, in an order that alternates between repetitions.
// Files: <scene>-<tier>-r<n>.png and glaze.json. The card's memory is polled with nvidia-smi around each draw (card wide, so it includes other jobs).
import { execFile } from 'node:child_process';
diff --git a/bench/tiers/run-settle.mjs b/bench/tiers/run-settle.mjs
index e3fa7c66..7dd418b9 100644
--- a/bench/tiers/run-settle.mjs
+++ b/bench/tiers/run-settle.mjs
@@ -1,6 +1,6 @@
// The experimental real-time path tracer (src/path-tracer-realtime*.js, not reachable from MCP) at rest: median frame time and checkpoints of the
// accumulated picture, to find how long it takes to get under a FLIP bound. This is not the realtime-high tier (#902), which does not exist yet.
-// [bash ~/.agents/tools/gpu-lock.sh] node bench/tiers/run-settle.mjs <output directory> <scene> --backend gpu|webgpu [--width 1920] [--height 1080] [--bounces 2] [--frames 256]
+// [${GPU_LOCK}] node bench/tiers/run-settle.mjs <output directory> <scene> --backend gpu|webgpu [--width 1920] [--height 1080] [--bounces 2] [--frames 256]
// Files: <scene>-<backend>-<width>.json and <scene>-<backend>-<width>-f<frame>.png, scored by score-tiers.py settle.
import { execFile } from 'node:child_process';
import { mkdir, writeFile } from 'node:fs/promises';