feat(tooling): run-atlas-naming.sh — overnight batch naming launcher (#833)

Wraps gemma_naming.py with the validated overnight recipe: gfx1201
ROCm binary path, distrobox reach-build for libhipblas at runtime,
timestamped log under .tmp/.

Preflight checks: binary exists and is executable, model present,
reach-build container exists, binary strings contains gfx1201 kernels.
Fails fast on any missing prerequisite so a broken build can't waste
an overnight window. Script takes no arguments; anything passed is
rejected so a stray --help can't accidentally launch the pipeline.

Estimate ~4-6 h for ~26k features across 2394 bodies at 74 t/s on an
RX 9070. Safe to interrupt and resume — preserved path skips
already-named bodies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-15 23:15:52 +02:00
co-authored by Claude Opus 4.6
parent c089557d65
commit bcff9f724b
+77
View File
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
# Run the full Gemma 2 batch naming pipeline across every markers.json
# in wiki/star-systems. Uses the gfx1201 ROCm binary via distrobox.
#
# Safe to interrupt and resume: the pipeline preserves bodies that
# already have non-empty name fields, so re-running picks up where it
# left off. A crash loses at most the current body's in-progress work.
#
# Wall time on an RX 9070 is roughly 4-6 h for the ~26k features in
# 2394 bodies. Run with `nohup` and tail the log file:
#
# nohup tooling/planet-gen/run-atlas-naming.sh > /tmp/atlas.out 2>&1 &
# tail -f .tmp/atlas-naming-*.log
set -euo pipefail
# No arguments accepted — everything is hardcoded for the overnight
# run. Guard against typos/--help slipping through to gemma_naming.py
# and starting a real run when the caller expected a help screen.
if [[ $# -gt 0 ]]; then
echo "usage: $0" >&2
echo " (no arguments; edit this script to change binary/model/container)" >&2
exit 2
fi
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
cd "$REPO_ROOT"
LOG_DIR="$REPO_ROOT/.tmp"
mkdir -p "$LOG_DIR"
STAMP="$(date +%Y%m%d-%H%M%S)"
LOG="$LOG_DIR/atlas-naming-$STAMP.log"
BIN="$HOME/Projects/settled-reach/binaries/sr-voice-rocm"
MODEL="/var/mnt/data/projects/settled-reach/main/server/models/gemma2.gguf"
DISTROBOX_NAME="reach-build"
if [[ ! -x "$BIN" ]]; then
echo "error: sr-voice binary not found at $BIN" >&2
echo " build with --features rocm inside $DISTROBOX_NAME" >&2
exit 1
fi
if [[ ! -f "$MODEL" ]]; then
echo "error: Gemma 2 model not found at $MODEL" >&2
exit 1
fi
if ! distrobox list 2>/dev/null | grep -q "^[[:xdigit:]]\+ *| *$DISTROBOX_NAME "; then
echo "error: distrobox container '$DISTROBOX_NAME' not found" >&2
exit 1
fi
# Sanity-check the binary is compiled for the host GPU. The llama.cpp
# HIP kernels embed their target architecture as substrings like
# "amdgcn-amd-amdhsa--gfx1201". If gfx1201 is missing and e.g. only
# gfx906 is present, the build shipped kernels for a different arch
# and every inference will crash with "invalid device function".
if ! strings "$BIN" 2>/dev/null | grep -qw gfx1201; then
echo "error: $BIN does not contain gfx1201 kernels" >&2
echo " expected target for AMD Radeon RX 9070 (Navi 48)" >&2
echo " rebuild with CMAKE_HIP_ARCHITECTURES=gfx1201 inside $DISTROBOX_NAME" >&2
exit 1
fi
echo "atlas naming run starting"
echo " bin: $BIN"
echo " model: $MODEL"
echo " distrobox: $DISTROBOX_NAME"
echo " log: $LOG"
echo " bodies: ~2394 (resume-safe — already-named skipped)"
echo " estimate: ~4-6 h on an RX 9070"
echo
exec python3 tooling/planet-gen/gemma_naming.py \
--sr-voice "$BIN" \
--model "$MODEL" \
--distrobox "$DISTROBOX_NAME" \
--log "$LOG"