#!/usr/bin/env bash # Run the whole model-free roofline suite once. Used by the holder job scripts (server) and by run_laptop.sh. # run_all.sh BINDIR [GGUF_FILE_FOR_REGISTERED_MAPPING] [suite...] suite: lat gpu h2d h2d2 dram mix (default: all, in that order) # Prints MemAvailable and GPU clocks around each program; refuses to start below the 15 GiB reserve (see mb_common.h). set -uo pipefail bin="${1:?bindir}"; file="${2:-}"; shift 2 2>/dev/null || shift $# suites=("$@"); [ ${#suites[@]} -eq 0 ] && suites=(lat gpu h2d h2d2 dram mix) export LD_LIBRARY_PATH="$HOME/cuda-toolkits/13.2.2/lib64:${LD_LIBRARY_PATH:-}" avail() { awk '/MemAvailable/{printf "%d", $2/1048576}' /proc/meminfo; } echo "# $(date -u +%FT%TZ) host=$(hostname) kernel=$(uname -r) MemAvailable_GiB=$(avail)" nvidia-smi --query-gpu=name,driver_version,pcie.link.gen.max,pcie.link.width.max,clocks.max.sm,clocks.max.mem,power.limit --format=csv,noheader sha256sum "$bin"/mb_* 2>/dev/null | grep -v SHA256SUMS snap() { nvidia-smi --query-gpu=pcie.link.gen.current,pcie.link.width.current,clocks.sm,clocks.mem,temperature.gpu,power.draw --format=csv,noheader; } for s in "${suites[@]}"; do echo "=== suite $s $(date -u +%FT%TZ) MemAvailable_GiB=$(avail)" case $s in lat) "$bin/mb_lat" ;; gpu) "$bin/mb_gpu" ;; h2d) if [ -n "$file" ]; then "$bin/mb_h2d" --file "$file"; else "$bin/mb_h2d"; fi ;; h2d2) "$bin/mb_h2d2" ;; dram) "$bin/mb_dram" ;; mix) "$bin/mb_dram_pcie" ;; esac echo "rc=$? gpu_state_after: $(snap)" done echo "# done $(date -u +%FT%TZ) MemAvailable_GiB=$(avail)"