Initial local AI stack

This commit is contained in:
avi
2026-04-20 13:13:41 -05:00
commit 8a9a120d1f
4 changed files with 146 additions and 0 deletions

31
scripts/probe.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail
BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
mkdir -p "$BASE_DIR/generated"
THREADS="$(nproc)"
RAM_GB="$(free -g | awk '/^Mem:/{print $2}')"
CPU_MODEL="$(lscpu | awk -F: '/Model name/{gsub(/^[ \t]+/, "", $2); print $2; exit}')"
GPU_VENDOR="none"
GPU_VRAM_GB="0"
if command -v nvidia-smi >/dev/null 2>&1; then
GPU_VENDOR="nvidia"
GPU_VRAM_GB="$(nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits | head -n1 | awk '{printf "%.0f", $1/1024}')"
elif command -v rocm-smi >/dev/null 2>&1; then
GPU_VENDOR="amd"
fi
cat > "$BASE_DIR/generated/machine-profile.json" <<JSON
{
"cpu_model": "${CPU_MODEL}",
"threads": ${THREADS},
"ram_gb": ${RAM_GB},
"gpu_vendor": "${GPU_VENDOR}",
"gpu_vram_gb": ${GPU_VRAM_GB}
}
JSON
cat "$BASE_DIR/generated/machine-profile.json"