interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

branch main Branches Tags History

CUDApp / tools / c4_streams_chip.sh

48 lines · 2116 bytes Raw Blame History
1#!/bin/sh
2# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3# C4 streams on a GB10 (docs/OMEGA.md row C4): N fresh processes of build/gpu_streams_test, the test as imported from
4# omega-mv, unchanged. Each run is a fresh session, fresh channels and fresh subcontexts, and does: calibration, overlap
5# medians of 5 in both barrier modes, the serial red check, the event with the wait (both barrier modes) and the
6# control without the wait. N runs give N overlap ratios per barrier mode (the distribution) and N red/green pairs.
7#
8# make build/gpu_streams_test (outside the lock)
9# tools/c4_streams_chip.sh OUTDIR [N] (takes /tmp/aien-gb10.lock itself, one hold for the set)
10#
11# Writes OUTDIR/run-NN.log (load average before, exit code after) and OUTDIR/summary.txt. Exit 0 only when all N passed.
12set -eu
13OUT=${1:?usage: tools/c4_streams_chip.sh OUTDIR [N]}
14N=${2-10}
15case "$N" in
16 ''|*[!0-9]*) echo 'N must be a positive decimal integer' >&2; exit 2 ;;
17esac
18[ "$N" -gt 0 ] 2>/dev/null || {
19 echo 'N must be a positive decimal integer in the shell integer range' >&2
20 exit 2
21}
22BIN=${BIN:-build/gpu_streams_test}
23LOCK=${LOCK:-/tmp/aien-gb10.lock}
24[ -x "$BIN" ] || { echo "NOT_RUN: $BIN is not built" >&2; exit 2; }
25mkdir -p "$OUT"
26{
27 echo "bin $(sha256sum "$BIN")"
28 echo "driver $(cat /sys/module/nvidia/version 2>/dev/null || echo unknown)"
29 echo "start $(date -u +%Y-%m-%dT%H:%M:%SZ)"
30} > "$OUT/summary.txt"
31
32exec 9>"$LOCK"
33flock -w 900 9 || { echo "NOT_RUN: GB10 lock busy for 900 s" >&2; exit 2; }
34i=1
35while [ "$i" -le "$N" ]; do
36 log="$OUT/run-$(printf %02d "$i").log"
37 echo "loadavg $(cat /proc/loadavg)" > "$log"
38 rc=0
39 timeout 120 "$BIN" >> "$log" 2>&1 || rc=$?
40 echo "exit $rc" >> "$log"
41 echo "run $i exit $rc $(grep -E '^C4 streams chip' "$log" || echo 'no verdict')" >> "$OUT/summary.txt"
42 i=$((i + 1))
43done
44flock -u 9
45echo "end $(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$OUT/summary.txt"
46pass=$(grep -c '^run .* exit 0 C4 streams chip: PASS' "$OUT/summary.txt" || true)
47echo "runs passing: $pass of $N" | tee -a "$OUT/summary.txt"
48[ "$pass" -eq "$N" ]