#!/usr/bin/env bash # Build the roofline microbenchmarks in WSL (never on the server): fat binaries for sm_86 (laptop RTX 3080) and sm_120 (RTX 5090). # tools/microbench/build.sh [OUTDIR] default OUTDIR=$HOME/roofline-bin set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" out="${1:-$HOME/roofline-bin}" nvcc="${NVCC:-$HOME/cuda-toolkits/13.2.2/bin/nvcc}" gen="-gencode arch=compute_86,code=sm_86 -gencode arch=compute_120,code=sm_120" mkdir -p "$out" cd "$here" for f in mb_h2d mb_h2d2 mb_dram_pcie mb_lat; do "$nvcc" -O3 -std=c++17 $gen -Xcompiler -pthread -Xcompiler -Wall "$f.cu" -o "$out/$f" done "$nvcc" -O3 -std=c++17 $gen -Xcompiler -pthread mb_gpu.cu -lcublas -o "$out/mb_gpu" g++ -O3 -std=c++17 -Wall -pthread mb_dram.cpp -o "$out/mb_dram" ls -la "$out" sha256sum "$out"/mb_* > "$out/SHA256SUMS"