Avra98's picture
sync training code: stage-1 instance-epoch sampler, multi-stage run, superposition metrics
6a1771b verified
Raw
History Blame Contribute Delete
2.89 kB
#!/usr/bin/env bash
# Portable RUN_DIR / PY / CUDNN_LIB for slimgpu vs Berkeley (gandalf/feanor).
#
# Override any of these before sourcing:
# SUDOKU_RUN_DIR, SUDOKU_PY, SUDOKU_CUDNN_LIB
#
# Usage (from launch_*.sh):
# source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/env_paths.sh"
_SLIM_ROOT="/egr/research-slim/ghoshavr/llm-reasoning-logic-puzzles"
_SLIM_RUN="${_SLIM_ROOT}/sudoku-code/multicandidate_run"
_SLIM_PY="/egr/research-slim/ghoshavr/conda-envs/logicpuzzles/bin/python"
_SLIM_CUDNN="/egr/research-slim/ghoshavr/conda-envs/logicpuzzles/lib/python3.9/site-packages/nvidia/cudnn/lib"
# Berkeley: prefer scratch (home often quota-limited), then $HOME (may be a symlink).
_BERK_RUN_SCRATCH="/scratch/users/gatmiry/llm-reasoning-logic-puzzles/sudoku-code/multicandidate_run"
_BERK_RUN="${HOME}/llm-reasoning-logic-puzzles/sudoku-code/multicandidate_run"
# Prefer explicit overrides, then slimgpu tree if present, else Berkeley home.
if [ -n "${SUDOKU_RUN_DIR:-}" ]; then
RUN_DIR="${SUDOKU_RUN_DIR}"
elif [ -d "${_SLIM_RUN}" ]; then
RUN_DIR="${_SLIM_RUN}"
elif [ -d "${_BERK_RUN_SCRATCH}" ]; then
RUN_DIR="${_BERK_RUN_SCRATCH}"
else
RUN_DIR="${_BERK_RUN}"
fi
if [ -n "${SUDOKU_PY:-}" ]; then
PY="${SUDOKU_PY}"
elif [ -x "${_SLIM_PY}" ]; then
PY="${_SLIM_PY}"
else
# Common Berkeley conda layouts; first existing wins.
for _cand in \
"${HOME}/miniconda3/envs/logic_puzzles/bin/python" \
"${HOME}/miniconda3/envs/logicpuzzles/bin/python" \
"${HOME}/anaconda3/envs/logic_puzzles/bin/python" \
"${HOME}/anaconda3/envs/logicpuzzles/bin/python" \
"${HOME}/.conda/envs/logic_puzzles/bin/python" \
"${HOME}/.conda/envs/logicpuzzles/bin/python" \
"/scratch/users/gatmiry/conda/envs/logic_puzzles/bin/python" \
"/scratch/users/gatmiry/conda/envs/logicpuzzles/bin/python"; do
if [ -x "${_cand}" ]; then
PY="${_cand}"
break
fi
done
if [ -z "${PY:-}" ]; then
if command -v python >/dev/null 2>&1; then
PY="$(command -v python)"
else
echo "ERROR: no Python found. Create env: conda env create -f ~/llm-reasoning-logic-puzzles/environment.yml -n logic_puzzles" >&2
echo " then: export SUDOKU_PY=\$HOME/miniconda3/envs/logic_puzzles/bin/python" >&2
return 1 2>/dev/null || exit 1
fi
fi
fi
if [ -n "${SUDOKU_CUDNN_LIB:-}" ]; then
CUDNN_LIB="${SUDOKU_CUDNN_LIB}"
elif [ -d "${_SLIM_CUDNN}" ]; then
CUDNN_LIB="${_SLIM_CUDNN}"
else
# Derive from PY site-packages if present; else leave empty (cluster CUDA often enough).
_py_root="$(cd "$(dirname "${PY}")/.." && pwd)"
_cudnn_guess="${_py_root}/lib/python3.9/site-packages/nvidia/cudnn/lib"
if [ -d "${_cudnn_guess}" ]; then
CUDNN_LIB="${_cudnn_guess}"
else
CUDNN_LIB=""
fi
fi
export RUN_DIR PY CUDNN_LIB
unset _SLIM_ROOT _SLIM_RUN _SLIM_PY _SLIM_CUDNN _BERK_RUN _cand _py_root _cudnn_guess