Skip to content

Commit dac3dbe

Browse files
authored
Merge pull request #281 from NCAR/new_env
two fixes -- mpi + torch version for derecho
2 parents f010ac6 + aa1a112 commit dac3dbe

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

create_derecho_env.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ set -e
2323
# containing Derecho-specific torch & MPI bits.
2424
# (install torchmetrics at this point too, installing it later
2525
# via pip risks an undesirable torch update.)
26-
ml conda
27-
26+
module load conda
27+
module list
2828
topdir=$(git rev-parse --show-toplevel)
2929
CREDIT_ENV_NAME=${CREDIT_ENV_NAME:-"credit-derecho"}
3030
yml=$(mktemp --tmpdir=${topdir} credit-derecho-tmp-XXXXXXXXXX.yml)
@@ -49,7 +49,6 @@ dependencies:
4949
- torchmetrics
5050
- pip:
5151
- pipdeptree
52-
- -e .
5352
EOF
5453

5554
# create the environment
@@ -73,12 +72,23 @@ find ${CONDA_PREFIX} -name "libnccl.*"
7372
# (echo-opt -> xgboost -> nvidia-nccl-cu12 -> problem.)
7473
pip uninstall -y $(pip list | grep nvidia-nccl | awk '{print $1}') || true
7574

75+
#-----------------------------------------------------------
76+
# install credit (editable) with constraints to prevent pip
77+
# from overwriting the conda-installed torch/torchvision/torchmetrics.
78+
constraint_file=$(mktemp --tmpdir=${topdir} credit-constraints-XXXXXXXXXX.txt)
79+
pip list --format=freeze | grep -iE "^(torch|torchvision|torchmetrics)==" > "${constraint_file}"
80+
echo "Using pip constraints:"
81+
cat "${constraint_file}"
82+
pip install --constraint "${constraint_file}" -e .
83+
rm -f "${constraint_file}"
84+
7685
conda-tree deptree --small
7786
pipdeptree --depth 3
7887

7988
echo "NCCLs - after cleanup:"
8089
find ${CONDA_PREFIX} -name "libnccl.*"
8190

91+
python -c "import torch; print('torch version:', torch.__version__); print('CUDA available:', torch.cuda.is_available())"
8292
python -c "import credit"
8393

8494
echo

0 commit comments

Comments
 (0)