Qwen3-0.6B inference (12 KB), bare-metal bootable OS (22 KB), and from-scratch Mini-GPT trainer with live Braille TUI (32 KB) in 100% pure x86-64 NASM assembly. Zero C, zero libc, zero dependencies.
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")/.."
STATE_DIR="$PWD/runs/.swarm-models"
if [[ ! -d "$STATE_DIR" ]]; then
echo "No swarm model state dir at $STATE_DIR"
exit 0
fi
for gpu in 0 1 2 3; do
pid_file="$STATE_DIR/gpu${gpu}.pid"
if [[ ! -f "$pid_file" ]]; then
continue
fi
pid=$(cat "$pid_file" 2>/dev/null || true)
if [[ -n "$pid" ]] && kill -0 "$pid" 2>/dev/null; then
echo "[gpu${gpu}] stopping server process group (pid=${pid})..."
kill -TERM -- "-${pid}" 2>/dev/null || kill -TERM "$pid" 2>/dev/null || true
fi
done
for gpu in 0 1 2 3; do
pid_file="$STATE_DIR/gpu${gpu}.pid"
[[ -f "$pid_file" ]] || continue
pid=$(cat "$pid_file" 2>/dev/null || true)
if [[ -n "$pid" ]]; then
for ((i=0; i<100; i++)); do
kill -0 "$pid" 2>/dev/null || break
sleep 0.1
done
if kill -0 "$pid" 2>/dev/null; then
echo "[gpu${gpu}] force-killing pid=${pid}"
kill -KILL -- "-${pid}" 2>/dev/null || kill -KILL "$pid" 2>/dev/null || true
fi
fi
rm -f "$pid_file"
done
echo "Swarm inference servers stopped."
nvidia-smi --query-gpu=index,name,memory.used,memory.total --format=csv