File size: 5,129 Bytes
158258b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | #!/bin/bash
# Which machine am I on, and what can I do here?
#
# bash scripts/whichserver.sh # verdict + capability summary
# bash scripts/whichserver.sh --id # just the name: aws | babel | unknown
#
# This repo runs on two machines that share one git remote and have very
# different capabilities. Getting them confused wastes hours: planning a
# Claude Code sweep on babel (no SDK, no gateway) or a quick debug loop on
# aws (every GPU request queues behind a full cluster) both fail late rather
# than immediately.
#
# Hostname is NOT a usable signal. A Claude Code session runs inside a
# sandbox pod whose hostname is `claude-sandbox-pod` on aws regardless of the
# host underneath it. The checks below use things the sandbox inherits:
# the Slurm cluster name, the storage layout, and which binaries exist.
set -uo pipefail
score_aws=0
score_babel=0
ev_aws=()
ev_babel=()
note() { if [[ $1 == aws ]]; then score_aws=$((score_aws+$2)); ev_aws+=("$3"); else score_babel=$((score_babel+$2)); ev_babel+=("$3"); fi; }
# --- Slurm identity: the single most reliable signal on either machine ----
cluster="$(sacctmgr -n -P show cluster format=Cluster 2>/dev/null | head -1)"
parts="$(sinfo -h -o '%P' 2>/dev/null | tr -d '*' | sort -u | tr '\n' ' ')"
[[ $cluster == *wearables-aws* ]] && note aws 3 "slurm cluster = $cluster"
[[ $cluster == *babel* ]] && note babel 3 "slurm cluster = $cluster"
[[ $parts == *h100* && $parts != *preempt* ]] && note aws 2 "partitions: $parts"
[[ $parts == *preempt* || $parts == *general* ]] && note babel 2 "partitions: $parts"
# --- storage layout -------------------------------------------------------
[[ -d /lustre-storage/fsx_2/user/jiaruiliu ]] && note aws 2 "/lustre-storage/fsx_2/user/jiaruiliu exists"
[[ -d /data/group_data ]] && note babel 2 "/data/group_data exists (CMU group storage)"
[[ $HOME == /home/jiaruiliu ]] && note aws 1 "HOME=$HOME"
[[ $HOME == /home/jiaruil5 ]] && note babel 1 "HOME=$HOME"
# --- tooling that only one side has --------------------------------------
command -v x2pagentd >/dev/null 2>&1 && note aws 2 "x2pagentd present (Meta model gateway)"
verdict=unknown
(( score_aws > score_babel && score_aws >= 3 )) && verdict=aws
(( score_babel > score_aws && score_babel >= 3 )) && verdict=babel
if [[ ${1:-} == --id ]]; then echo "$verdict"; exit 0; fi
echo "=============================================================="
echo " server: ${verdict^^} (aws score $score_aws / babel score $score_babel)"
echo "=============================================================="
for e in "${ev_aws[@]}"; do echo " [aws] $e"; done
for e in "${ev_babel[@]}"; do echo " [babel] $e"; done
echo
case $verdict in
aws)
cat <<'TXT'
CAN DO here (aws)
- Abundant H100s via Slurm. QOS `ar-ai-research-interns` is NOT preemptible
(128-GPU group cap); `midpri` IS preemptible and will restart 10h jobs
from zero. Use the former for anything long.
- Claude Code SDK and Codex SDK, both installed, reaching the model
providers through the x2pagentd gateway. This is what the agent sweeps run on.
- Meta model gateway (x2pagentd). No direct OpenAI/Anthropic billing is used.
- Apptainer containers -- on COMPUTE NODES only, not here in the sandbox pod.
- Compute nodes reach the public internet directly (verified 2026-10-22 by
fetching cl100k_base from Azure blob storage in a batch job).
CANNOT DO here (aws)
- No internet from this sandbox pod or the login node. `curl` returns 000.
Anything that needs to download: submit a tiny batch job instead.
- The PostTrainBench agent sandbox is deliberately `--network=none`. That is
the experimental design, not a defect -- do not "fix" it.
- No GPU on the login/sandbox pod itself; `nvidia-smi` is absent. All GPU
work goes through sbatch.
- No OpenAI API: `.env` OPENAI_API_KEY is empty and api.openai.com is
unreachable. The two LLM-graded benchmarks use a local vLLM judge instead.
TXT
;;
babel)
cat <<'TXT'
CAN DO here (babel)
- Internet access directly from the shell -- downloads, pip, HF pulls.
- Small GPUs, good for debugging a script before it goes to aws.
- Read and edit the repo; everything that is CPU-only or small-scale.
CANNOT DO here (babel)
- No Meta model gateway / MetaGen keys.
- No Claude Code SDK and no Codex SDK, so NO agent sweeps can run here.
- No PostTrainBench data, HF cache, or results tree -- those live on aws
under /lustre-storage/fsx_2/user/jiaruiliu/ptb-data.
Plan any agent run, any 10-hour cell, and any full sweep for aws.
TXT
;;
*)
cat <<'TXT'
Could not identify this machine from the usual signals.
Do not guess. Check by hand and then update this script:
sacctmgr -n -P show cluster format=Cluster
sinfo -h -o '%P' | sort -u
ls -d /lustre-storage/fsx_2/user/jiaruiliu /data/group_data
echo "$HOME"; command -v x2pagentd
Capability matrix: docs/setup/servers_aws_vs_babel.md
TXT
exit 2
;;
esac
echo
echo "Full matrix and the rules for cross-server docs:"
echo " docs/setup/servers_aws_vs_babel.md"
|