Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/evidence/MAX-INTEROP/G2/tools/run_matrix.sh # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / evidence / MAX-INTEROP / G2 / tools / run_matrix.sh` 74 lines · 3153 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # Gate-2 cubin load matrix: C/libcuda oracle (CUDApp cubin_probe) vs MAX 3 # DeviceExternalFunction probe, same images, same ABI (16x16x8 matmul). 4 # Verification tool only. Run inside an authorized window: 5 # spark-window run ~/handoffs/max-g2/run_matrix.sh 6 # Load-only first; an image is launched only if both loaders accept it. 7 set -u 8 HERE=$(cd "$(dirname "$0")" && pwd) 9 CPROBE=${CPROBE:-$HERE/cubin_probe} # CUDApp#202 build, sha256 `627b0e9c`… 10 MPROBE=${MPROBE:-$HERE/max_cubin_probe} 11 MATRIX=${MATRIX:-$HERE/variants/MATRIX.tsv} 12 M=16 K=16 N=8 13 14 if [ -z "${SPARK_WINDOW:-}" ] || [ -z "${SPARK_WINDOW_DIR:-}" ]; then 15 echo "refused: SPARK_WINDOW/SPARK_WINDOW_DIR not set; run via spark-window run" >&2 16 exit 3 17 fi 18 OUT=$SPARK_WINDOW_DIR/max-g2 19 mkdir -p "$OUT" 20 LOG=$OUT/raw.log 21 SUM=$OUT/results.tsv 22 23 # MAX: no pooled device memory manager (shared chip with resident servers), 24 # synchronous mode, log every function load. 25 export MODULAR_DEVICE_CONTEXT_MEMORY_MANAGER_SIZE=0 26 export MODULAR_DEVICE_CONTEXT_MEMORY_MANAGER_ONLY=false 27 export MODULAR_DEVICE_CONTEXT_SYNC_MODE=1 28 export MODULAR_DEVICE_CONTEXT_LOG_LOAD_FUNCTION=1 29 30 { 31 echo "# window=$SPARK_WINDOW start=$(date -u +%FT%TZ) host=$(hostname)" 32 echo "# driver: $(head -n1 /proc/driver/nvidia/version 2>/dev/null)" 33 echo "# MemAvailable: $(awk '/MemAvailable/{print $2" kB"}' /proc/meminfo)" 34 sha256sum "$CPROBE" "$MPROBE" "$MATRIX" "$0" 35 } >"$LOG" 2>&1 36 37 printf 'name\tfn\tmode\texpect\tsha_ok\tc_load\tc_run\tmax_load\tmax_run\n' >"$SUM" 38 39 step() { # label cmd... ; echo rc 40 local label=$1; shift 41 { echo "### $label: $*"; "$@"; echo "### rc=$?"; } >>"$LOG" 2>&1 42 tail -n1 "$LOG" | sed 's/### rc=//' 43 } 44 45 tail -n +2 "$MATRIX" | while IFS=$'\t' read -r name fn mode expect sha isolates; do 46 img=$HERE/variants/$name.cubin 47 got=$(sha256sum "$img" | cut -d' ' -f1) 48 ok=yes; [ "$got" = "$sha" ] || ok=NO 49 echo "## $name fn=$fn mode=$mode expect=[$expect] sha=$got ok=$ok isolates=[$isolates]" >>"$LOG" 50 cl=- cr=- ml=- mr=- 51 if [ "$ok" != yes ]; then 52 echo "## SKIP $name: sha mismatch" >>"$LOG" 53 elif [ "$mode" = reject ]; then 54 cl=$(step "$name C expect-reject" "$CPROBE" --expect-reject "$img" "$fn" $M $K $N) 55 ml=$(step "$name MAX reject" "$MPROBE" "$img" "$fn" reject) 56 elif [ "$mode" = load ]; then 57 # A kernel whose ABI is not the probe's 16x16x8 matmul: container and 58 # entry acceptance only, never launched. 59 cl=$(step "$name C load-only" "$CPROBE" --load-only "$img" "$fn" $M $K $N) 60 ml=$(step "$name MAX loadonly" "$MPROBE" "$img" "$fn" loadonly) 61 else 62 cl=$(step "$name C load-only" "$CPROBE" --load-only "$img" "$fn" $M $K $N) 63 ml=$(step "$name MAX loadonly" "$MPROBE" "$img" "$fn" loadonly) 64 if [ "$cl" = 0 ] && [ "$ml" = 0 ]; then 65 cr=$(step "$name C run" "$CPROBE" "$img" "$fn" $M $K $N) 66 mr=$(step "$name MAX run" "$MPROBE" "$img" "$fn" run) 67 fi 68 fi 69 printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "$name" "$fn" "$mode" "$expect" "$ok" "$cl" "$cr" "$ml" "$mr" >>"$SUM" 70 done 71 72 echo "# end=$(date -u +%FT%TZ) MemAvailable: $(awk '/MemAvailable/{print $2" kB"}' /proc/meminfo)" >>"$LOG" 73 cat "$SUM" 74 echo "raw: $LOG"