#!/bin/bash #SBATCH --job-name=hrm-decode-bench #SBATCH --account=nemotron_agents_dev #SBATCH --partition=interactive #SBATCH --nodes=2 #SBATCH --ntasks-per-node=1 #SBATCH --gpus-per-node=8 #SBATCH --mem=0 #SBATCH --exclusive #SBATCH --time=01:45:00 #SBATCH --output=/lustre/fsw/portfolios/nemotron/users/hengyuf/HRM-Text/slurm/logs/%x_%j.out # End-to-end training-step overhead of loop_cot's decode channel, sweeping # cot_decode_topk. All configs run at CONSTANT FULL backprop (the steady-state # regime) on the smoke dataset for exactly 1 epoch (~217 steps), same 2 nodes, # sequentially in one allocation. Reference = UT at full backprop (identical # except no decode channel). set -euo pipefail BASE=/lustre/fsw/portfolios/nemotron/users/hengyuf HRM_DIR=$BASE/HRM-Text SQSH=$BASE/hrm_env/hrm-text.sqsh SMOKE=$BASE/hrm_data/sampled_smoke_ep4_seed0 export NVIDIA_VISIBLE_DEVICES=all MASTER_ADDR=$(scontrol show hostnames "$SLURM_JOB_NODELIST" | head -n1) MOUNTS=/lustre:/lustre,/dev/shm:/dev/shm # Stage smoke data once per node srun --ntasks-per-node=1 --container-image="$SQSH" --container-name=bench \ --container-mounts="$MOUNTS" \ bash -c "rm -rf /dev/shm/sampled_bench && cp -r '$SMOKE' /dev/shm/sampled_bench && echo staged" CONFIGS=( "ut_ref|arch/net@arch=ut arch.bp_cycles=4 arch.bp_warmup_ratio=0.0" "lc_k16|arch/net@arch=loop_cot arch.cot_decode_topk=16 arch.bp_min_cycles=4 arch.bp_warmup_ratio=0.0" "lc_k32|arch/net@arch=loop_cot arch.cot_decode_topk=32 arch.bp_min_cycles=4 arch.bp_warmup_ratio=0.0" "lc_k64|arch/net@arch=loop_cot arch.cot_decode_topk=64 arch.bp_min_cycles=4 arch.bp_warmup_ratio=0.0" "lc_k128|arch/net@arch=loop_cot arch.cot_decode_topk=128 arch.bp_min_cycles=4 arch.bp_warmup_ratio=0.0" "lc_k256|arch/net@arch=loop_cot arch.cot_decode_topk=256 arch.bp_min_cycles=4 arch.bp_warmup_ratio=0.0" ) PORT_BASE=$((21000 + SLURM_JOB_ID % 5000)) IDX=0 for entry in "${CONFIGS[@]}"; do TAG="${entry%%|*}" ARGS="${entry#*|}" PORT=$((PORT_BASE + IDX)); IDX=$((IDX + 1)) echo "=================== CONFIG $TAG ===================" srun --ntasks-per-node=1 --kill-on-bad-exit=1 \ --container-name=bench --container-mounts="$MOUNTS" \ --container-workdir="$HRM_DIR" \ bash -c " set -euo pipefail export OMP_NUM_THREADS=1 MKL_NUM_THREADS=1 WANDB_MODE=disabled export TORCHINDUCTOR_CACHE_DIR=/dev/shm/inductor_cache TRITON_CACHE_DIR=/dev/shm/triton_cache rm -rf /dev/shm/bench_ckpt torchrun --nnodes=$SLURM_JOB_NUM_NODES --nproc_per_node=8 --node_rank=\$SLURM_NODEID \ --rdzv_backend=c10d --rdzv_endpoint=$MASTER_ADDR:$PORT --rdzv_id=bench$IDX \ pretrain.py $ARGS arch/size@arch=L lr=2.5e-4 global_batch_size=172032 epochs=1 \ data.path=/dev/shm/sampled_bench +seed=0 \ +project_name=HRM-Text-bench +run_name=bench-$TAG +checkpoint_path=/dev/shm/bench_ckpt " || echo "CONFIG $TAG FAILED" echo "=================== END $TAG ===================" done echo BENCH_ALL_DONE