Source files / scripts · raw
gpu-setup.sh
#!/usr/bin/env bash # Boot-time GPU setup: persistence mode, power limit, ECC check. # Run by tersler-gpu.service; safe to run by hand (as root). set -euo pipefail # shellcheck source=lib.sh source "$(dirname "$(readlink -f "$0")")/lib.sh" jr_load_config jr_nvsmi -pm 1 >/dev/null mapfile -t idx < <(jr_nvsmi --query-gpu=index --format=csv,noheader) for i in "${idx[@]}"; do jr_nvsmi -i "$i" -pl "$GPU_POWER_LIMIT" >/dev/null ecc=$(jr_nvsmi -i "$i" --query-gpu=ecc.mode.current,ecc.mode.pending --format=csv,noheader | tr -d ' ') if [[ $GPU_ENABLE_ECC == 1 && $ecc == Disabled,Disabled ]]; then jr_nvsmi -i "$i" -e 1 >/dev/null jr_warn "GPU $i: ECC was off, enabled; takes effect after the next reboot" fi done jr_nvsmi --query-gpu=index,name,power.limit,ecc.mode.current,pcie.link.width.current,temperature.gpu --format=csv