#!/usr/bin/env bash set -euo pipefail REPO_DIR="${REPO_DIR:-/nfs/ywang29/GmNet/journal_exp}" DATA_ROOT="${DATA_ROOT:-/tmp/gmnet_data/cifar-100}" OUTPUT_ROOT="${OUTPUT_ROOT:-/tmp/gmnet_runs/e3_cifar100}" LOCAL_SCRATCH_DIR="${LOCAL_SCRATCH_DIR:-/tmp/gmnet_scratch/e3_cifar100}" WANDB_PROJECT="${WANDB_PROJECT:-gmnet-journal}" WANDB_ENTITY="${WANDB_ENTITY:-yi-fan-wang1216}" MAX_PARALLEL="${MAX_PARALLEL:-8}" EPOCHS="${EPOCHS:-100}" VENV_DIR="${VENV_DIR:-/tmp/gmnet_venv}" PYTHON="${PYTHON_BIN:-${VENV_DIR}/bin/python}" export TMPDIR="${LOCAL_SCRATCH_DIR}/tmp" export TORCH_NCCL_HEARTBEAT_TIMEOUT_SEC=1800 export NCCL_SOCKET_IFNAME="${NCCL_SOCKET_IFNAME:-eth}" # export GLOO_SOCKET_IFNAME="${GLOO_SOCKET_IFNAME:-${NCCL_SOCKET_IFNAME}}" export NCCL_NET="${NCCL_NET:-Socket}" # export NCCL_NET_PLUGIN="${NCCL_NET_PLUGIN:-none}" # export NCCL_IB_DISABLE="${NCCL_IB_DISABLE:-1}" export NCCL_DEBUG="${NCCL_DEBUG:-INFO}" export PYTHONUNBUFFERED=1 export FI_EFA_FORK_SAFE=1 export TORCH_NCCL_ASYNC_ERROR_HANDLING=1 export WANDB_API_KEY='24d6afefd46915ea938dca1af6caf95ae0288a19' export WANDB_USERNAME='yi-fan-wang1216' export WANDB_PROJECT="${WANDB_PROJECT}" export WANDB_ENTITY="${WANDB_ENTITY}" export TORCH_DISTRIBUTED_DEBUG=DETAIL # export HF_TOKEN='__REDACTED_HF_TOKEN__' export AWS_PROFILE=default_mle export LD_LIBRARY_PATH= mkdir -p "${OUTPUT_ROOT}" "${TMPDIR}" cd "${REPO_DIR}" gates=(relu6 relu gelu smooth_static identity no_gate) configs=( configs/e3_gate/cifar100_gmnet_s1_relu6.yaml configs/e3_gate/cifar100_gmnet_s1_relu.yaml configs/e3_gate/cifar100_gmnet_s1_gelu.yaml configs/e3_gate/cifar100_gmnet_s1_smooth_static.yaml configs/e3_gate/cifar100_gmnet_s1_identity.yaml configs/e3_gate/cifar100_gmnet_s1_no_gate.yaml ) if (( MAX_PARALLEL < 1 || MAX_PARALLEL > 8 )); then echo "MAX_PARALLEL must be in [1, 8]" >&2 exit 2 fi running=0 pids=() for seed in 0 1 2; do for index in "${!gates[@]}"; do gate="${gates[$index]}" config="${configs[$index]}" run_name="e3_c100_s1_${gate}_seed${seed}" output="${OUTPUT_ROOT}/${run_name}" mkdir -p "${output}" ( CUDA_VISIBLE_DEVICES="${running}" WANDB_MODE=disabled "${PYTHON}" -m gmnet.train \ --config "${config}" --run-name "${run_name}" --data-root "${DATA_ROOT}" \ --output-dir "${output}" --seed "${seed}" --resume auto \ --set "train.epochs=${EPOCHS}" > "${output}/console.log" 2>&1 ) & pids+=("$!") running=$((running + 1)) if (( running >= MAX_PARALLEL )); then for pid in "${pids[@]}"; do wait "${pid}"; done running=0 pids=() fi done done for pid in "${pids[@]}"; do wait "${pid}"; done echo "E3 CIFAR-100 runs completed under ${OUTPUT_ROOT}"