openaccel-lab
aien-dev/openaccel-lab
Brought by drakestapleton
openaccel-lab / runners / cuda / run_all.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # runners/cuda/run_all.sh OUT.jsonl [oal-matrix options...] |
| 4 | # Run the CUDA entrant of every workload and control on the GPU of this machine and write |
| 5 | # oal-result/1 lines to OUT.jsonl. Needs nvcc, nvidia-smi and one NVIDIA GPU; the lab never runs |
| 6 | # this on CI. The records carry the GPU name, compute capability and driver in machine.runner and |
| 7 | # the label below, so the board can tell them from CPU rows. |
| 8 | # Exit: oal-matrix's status (0 when every line was written), 2 on a usage error, 4 without a GPU. |
| 9 | # INTERIM host glue (POSIX sh). Successor: an Omega runner script once omega-mv has one. |
| 10 | set -eu |
| 11 | [ $# -ge 1 ] || { echo "usage: run_all.sh OUT.jsonl [oal-matrix options]" >&2; exit 2; } |
| 12 | out=$1; shift |
| 13 | here=$(cd "$(dirname "$0")/../.." && pwd) |
| 14 | q=$(nvidia-smi --query-gpu=name,compute_cap,driver_version --format=csv,noheader 2>/dev/null | sed -n 1p) || true |
| 15 | [ -n "$q" ] || { echo "run_all.sh: no NVIDIA GPU visible" >&2; exit 4; } |
| 16 | name=$(echo "$q" | cut -d, -f1 | sed 's/^ *//;s/ *$//') |
| 17 | cc=$(echo "$q" | cut -d, -f2 | tr -d ' .') |
| 18 | drv=$(echo "$q" | cut -d, -f3 | tr -d ' ') |
| 19 | export OAL_CUDA_RUN=1 |
| 20 | export OAL_CUDA_ARCH="${OAL_CUDA_ARCH:-sm_$cc}" |
| 21 | export OAL_RUNNER_LABEL="${OAL_RUNNER_LABEL:-$name sm_$cc driver $drv}" |
| 22 | export OAL_TIMING_LABEL="${OAL_TIMING_LABEL:-GPU: launch + cudaDeviceSynchronize, host steady_clock, per repeat}" |
| 23 | export OAL_EVIDENCE="${OAL_EVIDENCE:-QUALIFIED-on-$name candidate: GPU run, driver $drv, $(date -u +%Y-%m-%dT%H:%MZ)}" |
| 24 | echo "run_all.sh: $OAL_RUNNER_LABEL arch $OAL_CUDA_ARCH" >&2 |
| 25 | exec python3 "$here/bin/oal-matrix" --backends cuda --controls "$@" > "$out" |