Skip to content

Commit

Permalink
update installation scripts for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jarlsondre committed Nov 29, 2024
1 parent 166f1ec commit 59302f5
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 8,614 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ torch-env-cpu: env-files/torch/generic_torch.sh
env ENV_NAME=.venv-pytorch \
NO_CUDA=1 \
bash -c 'bash env-files/torch/generic_torch.sh'
.venv-pytorch/bin/horovodrun --check-build
# .venv-pytorch/bin/horovodrun --check-build

# Install TensorFlow env (GPU support)
tensorflow-env: env-files/tensorflow/generic_tf.sh
Expand Down Expand Up @@ -44,7 +44,7 @@ tf-env-vega: env-files/tensorflow/createEnvVegaTF.sh env-files/tensorflow/generi


test:
PYTORCH_ENABLE_MPS_FALLBACK=1 .venv/bin/pytest -v tests/ -m "not slurm"
PYTORCH_ENABLE_MPS_FALLBACK=1 .venv/bin/pytest -v tests/

test-jsc: tests/run_on_jsc.sh
bash tests/run_on_jsc.sh
Expand Down
2 changes: 1 addition & 1 deletion docs/uv-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ particular, if you are a developer you would use one of the following two comman
you are on HPC with cuda, you would use:

```bash
uv sync --extra torch --extra dev --extra tf \
uv sync --extra dev --extra nvidia --extra torch --extra tf \
--no-cache \
--index https://download.pytorch.org/whl/cu121
```
Expand Down
134 changes: 66 additions & 68 deletions env-files/tensorflow/generic_tf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,89 +9,87 @@ if [ -z "$ENV_NAME" ]; then
ENV_NAME=".venv-tf"
fi

if [ -z "$NO_CUDA" ]; then
echo "Installing itwinai and its dependencies in '$ENV_NAME' virtual env (CUDA enabled)"
else
echo "Installing itwinai and its dependencies in '$ENV_NAME' virtual env (CUDA disabled)"
fi

# get python version
pver="$(python --version 2>&1 | awk '{print $2}' | cut -f1-2 -d.)"

# use pyenv if exist
if [ -d "$HOME/.pyenv" ];then
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
fi

# if [ -z "$NO_CUDA" ]; then
# echo "Installing itwinai and its dependencies in '$ENV_NAME' virtual env (CUDA enabled)"
# else
# echo "Installing itwinai and its dependencies in '$ENV_NAME' virtual env (CUDA disabled)"
# fi
#
# # get python version
# pver="$(python --version 2>&1 | awk '{print $2}' | cut -f1-2 -d.)"
#
# # use pyenv if exist
# if [ -d "$HOME/.pyenv" ];then
# export PYENV_ROOT="$HOME/.pyenv"
# export PATH="$PYENV_ROOT/bin:$PATH"
# fi
#
# set dir
cDir=$PWD

# create environment
if [ -d "${cDir}/$ENV_NAME" ];then
echo "env $ENV_NAME already exists"

source $ENV_NAME/bin/activate
else
python3 -m venv $ENV_NAME

# activate env
source $ENV_NAME/bin/activate

echo "$ENV_NAME environment is created in ${cDir}"
fi

pip3 install --no-cache-dir --upgrade pip

# get wheel -- setuptools extension
pip3 install --no-cache-dir wheel

# install TF
if [ -f "${cDir}/$ENV_NAME/bin/tensorboard" ]; then
echo 'TF already installed'
echo
else
if [ -z "$NO_CUDA" ]; then
pip3 install tensorflow[and-cuda]==2.16.* --no-cache-dir
else
# CPU only installation
pip3 install tensorflow==2.16.* --no-cache-dir
fi
fi

# CURRENTLY, horovod is not used with TF. Skipped.
# # install horovod
# if [ -f "${cDir}/$ENV_NAME/bin/horovodrun" ]; then
# echo 'Horovod already installed'
source $ENV_NAME/bin/activate
pip install --no-cache-dir -e ".[dev,nvidia,tf]"

# pip3 install --no-cache-dir --upgrade pip
#
# # get wheel -- setuptools extension
# pip3 install --no-cache-dir wheel
#
# # install TF
# if [ -f "${cDir}/$ENV_NAME/bin/tensorboard" ]; then
# echo 'TF already installed'
# echo
# else
# if [ -z "$NO_CUDA" ]; then
# export HOROVOD_GPU=CUDA
# export HOROVOD_GPU_OPERATIONS=NCCL
# export HOROVOD_WITH_TENSORFLOW=1
# # export TMPDIR=${cDir}
# pip3 install tensorflow[and-cuda]==2.16.* --no-cache-dir
# else
# # CPU only installation
# export HOROVOD_WITH_TENSORFLOW=1
# # export TMPDIR=${cDir}
# pip3 install tensorflow==2.16.* --no-cache-dir
# fi

# pip3 install --no-cache-dir horovod[tensorflow,keras] # --ignore-installed
# fi

# WHEN USING TF >= 2.16:
# install legacy version of keras (2.16)
# Since TF 2.16, keras updated to 3.3,
# which leads to an error when more than 1 node is used
# https://keras.io/getting_started/
pip3 install --no-cache-dir tf_keras==2.16.*

# Install Pov4ML
if [[ "$OSTYPE" =~ ^darwin ]] ; then
pip install "prov4ml[apple,nvidia]@git+https://github.com/matbun/ProvML@new-main" || exit 1
else
pip install "prov4ml[nvidia]@git+https://github.com/matbun/ProvML@new-main" || exit 1
fi

# Install itwinai: MUST be last line of the script for the user installation script to work!
pip3 install --no-cache-dir -e .[dev]
#
# # CURRENTLY, horovod is not used with TF. Skipped.
# # # install horovod
# # if [ -f "${cDir}/$ENV_NAME/bin/horovodrun" ]; then
# # echo 'Horovod already installed'
# # echo
# # else
# # if [ -z "$NO_CUDA" ]; then
# # export HOROVOD_GPU=CUDA
# # export HOROVOD_GPU_OPERATIONS=NCCL
# # export HOROVOD_WITH_TENSORFLOW=1
# # # export TMPDIR=${cDir}
# # else
# # # CPU only installation
# # export HOROVOD_WITH_TENSORFLOW=1
# # # export TMPDIR=${cDir}
# # fi
#
# # pip3 install --no-cache-dir horovod[tensorflow,keras] # --ignore-installed
# # fi
#
# # WHEN USING TF >= 2.16:
# # install legacy version of keras (2.16)
# # Since TF 2.16, keras updated to 3.3,
# # which leads to an error when more than 1 node is used
# # https://keras.io/getting_started/
# pip3 install --no-cache-dir tf_keras==2.16.*
#
# # Install Pov4ML
# if [[ "$OSTYPE" =~ ^darwin ]] ; then
# pip install "prov4ml[apple,nvidia]@git+https://github.com/matbun/ProvML@new-main" || exit 1
# else
# pip install "prov4ml[nvidia]@git+https://github.com/matbun/ProvML@new-main" || exit 1
# fi
#
#
# # Install itwinai: MUST be last line of the script for the user installation script to work!
# pip3 install --no-cache-dir -e .[dev]
Loading

0 comments on commit 59302f5

Please sign in to comment.