Skip to content

Commit 2f9b559

Browse files
committed
Run benchmark helper scripts via Docker containers
1 parent 90250c1 commit 2f9b559

4 files changed

Lines changed: 38 additions & 10 deletions

File tree

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ docker run --rm --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix
2424
docker run --rm --gpus all vk-bench --headless --frames 300 --out results.json
2525
```
2626

27+
28+
Scripts default to Docker image `vk-bench`. Override with `VK_BENCH_IMAGE=<image>` if needed.
29+
2730
### Bench all 3 scenes
2831

2932
```bash
30-
scripts/run_bench.sh results
33+
scripts/run_bench.sh results # runs inside Docker image vk-bench
3134
```
3235

3336
## Example results
@@ -51,14 +54,15 @@ scripts/run_bench.sh results
5154
## Nsight steps (exact command)
5255

5356
```bash
54-
scripts/nsight_capture.sh results/nsight_capture
57+
scripts/nsight_capture.sh results/nsight_capture # profiles docker run
5558
```
5659

5760
Or directly:
5861

5962
```bash
6063
nsys profile --trace=vulkan,nvtx,cuda --output results/nsight_capture \
61-
vk-bench --headless --scene million-tris --warmup 20 --frames 120 --out results/nsight_capture.json
64+
docker run --rm --gpus all -v "$(pwd)/results:/results" vk-bench \
65+
--headless --scene million-tris --warmup 20 --frames 120 --out /results/nsight_capture.json
6266
```
6367

6468
![Nsight capture screenshot](docs/nsight-capture.svg)

scripts/collect_system_info.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4+
IMAGE="${VK_BENCH_IMAGE:-vk-bench}"
45
OUT="${1:-results/system_info.txt}"
56
mkdir -p "$(dirname "$OUT")"
67

8+
if ! command -v docker >/dev/null 2>&1; then
9+
echo "docker is required for scripts/collect_system_info.sh" >&2
10+
exit 1
11+
fi
12+
713
{
814
echo "== Date =="
915
date -Iseconds
1016
echo
1117
echo "== uname =="
1218
uname -a
1319
echo
14-
echo "== nvidia-smi =="
20+
echo "== nvidia-smi (host) =="
1521
nvidia-smi || true
1622
echo
17-
echo "== vulkaninfo --summary =="
18-
vulkaninfo --summary || true
23+
echo "== vulkaninfo --summary (container) =="
24+
docker run --rm --gpus all "$IMAGE" vulkaninfo --summary || true
1925
} > "$OUT"
2026

2127
echo "Wrote $OUT"

scripts/nsight_capture.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4+
IMAGE="${VK_BENCH_IMAGE:-vk-bench}"
45
OUT="${1:-results/nsight_capture}"
56
mkdir -p "$(dirname "$OUT")"
67

8+
if ! command -v docker >/dev/null 2>&1; then
9+
echo "docker is required for scripts/nsight_capture.sh" >&2
10+
exit 1
11+
fi
12+
713
if ! command -v nsys >/dev/null 2>&1; then
8-
echo "nsys not found. Install NVIDIA Nsight Systems to use this script." >&2
14+
echo "nsys not found on host. Install NVIDIA Nsight Systems to use this script." >&2
915
exit 1
1016
fi
1117

1218
nsys profile \
1319
--trace=vulkan,nvtx,cuda \
1420
--output "$OUT" \
15-
vk-bench --headless --scene million-tris --warmup 20 --frames 120 --vsync 0 --out "${OUT}.json"
21+
docker run --rm --gpus all \
22+
-v "$(pwd)/results:/results" \
23+
"$IMAGE" \
24+
--headless --scene million-tris --warmup 20 --frames 120 --vsync 0 --out /results/nsight_capture.json
1625

1726
echo "Capture written to ${OUT}.qdrep (or .nsys-rep depending on version)."

scripts/run_bench.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4+
IMAGE="${VK_BENCH_IMAGE:-vk-bench}"
45
RESULT_DIR="${1:-results}"
56
mkdir -p "$RESULT_DIR"
67

8+
if ! command -v docker >/dev/null 2>&1; then
9+
echo "docker is required for scripts/run_bench.sh" >&2
10+
exit 1
11+
fi
12+
713
for scene in triangle million-tris compute-copy; do
8-
echo "Running scene: $scene"
9-
vk-bench --headless --scene "$scene" --warmup 30 --frames 300 --vsync 0 --out "$RESULT_DIR/${scene}.json"
14+
echo "Running scene in Docker: $scene"
15+
docker run --rm --gpus all \
16+
-v "$(pwd)/$RESULT_DIR:/results" \
17+
"$IMAGE" \
18+
--headless --scene "$scene" --warmup 30 --frames 300 --vsync 0 --out "/results/${scene}.json"
1019
done
1120

1221
echo "Saved benchmark outputs to $RESULT_DIR"

0 commit comments

Comments
 (0)