Skip to content

Commit

Permalink
adding lightweight gpu support
Browse files Browse the repository at this point in the history
  • Loading branch information
VIGNESHinZONE committed Jul 23, 2021
1 parent 86042a0 commit d2ac5f8
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
3 changes: 3 additions & 0 deletions requirements/jax/env_jax.cpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies:
- pip:
- jax[cpu]
4 changes: 4 additions & 0 deletions requirements/jax/env_jax.gpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
- pip:
- -f https://storage.googleapis.com/jax-releases/jax_releases.html
- jax[cuda111]
11 changes: 11 additions & 0 deletions requirements/torch/env_torch.gpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dependencies:
- pip:
- -f https://download.pytorch.org/whl/torch_stable.html
- -f https://pytorch-geometric.com/whl/torch-1.9.0+cu111.html
- -f https://data.dgl.ai/wheels/repo.html
- dgl-cu111
- torch==1.9.0+cu111
- torchvision==0.10.0+cu111
- torch-scatter
- torch-sparse

60 changes: 60 additions & 0 deletions scripts/light/install_deepchem.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This script creates the new deepchem enviroment
# This script works on only Bash and Zsh

CMDNAME=`basename ${BASH_SOURCE:-$0}`
if [ $# -ne 3 ]; then
echo "Please set two arguments."
echo "Usage) source $CMDNAME python_version cpu_or_gpu" 1>&2
echo "Example) source $CMDNAME 3.8 gpu tensorflow" 1>&2
return 1
fi

# This command is nearly equal to `conda init` command
# Need to use `conda activate` command
eval "$(conda shell.bash hook)"

# Create deepchem environment
conda config --set always_yes yes
conda create --name deepchem python=$1
conda install -c conda-forge conda-merge

if [ "$2" = "gpu" ];
then
# We expect the CUDA vesion is 10.1.
if [ "$3" = "tensorflow" ];
then
conda-merge $PWD/requirements/tensorflow/env_tensorflow.yml > $PWD/env.yml
echo "Installing Tensorflow environment with GPU"
elif [ "$3" = "pytorch" ];
then
conda-merge $PWD/requirements/pytorch/env_pytorch.yml $PWD/requirements/pytorch/env_pytorch.gpu.yml > $PWD/env.yml
echo "Installing pytorch environment with GPU"
elif [ "$3" = "jax" ];
then
conda-merge $PWD/requirements/jax/env_jax.yml $PWD/requirements/jax/env_jax.gpu.yml > $PWD/env.yml
echo "Installing jax environment with GPU"
else
conda-merge $PWD/requirements/env_common.yml > $PWD/env.yml
echo "Installing common environment with GPU"
fi
else
# We expect the CUDA vesion is 10.1.
if [ "$3" = "tensorflow" ];
then
conda-merge $PWD/requirements/tensorflow/env_tensorflow.yml > $PWD/env.yml
echo "Installing Tensorflow environment with CPU"
elif [ "$3" = "pytorch" ];
then
conda-merge $PWD/requirements/pytorch/env_pytorch.yml $PWD/requirements/pytorch/env_pytorch.cpu.yml > $PWD/env.yml
echo "Installing pytorch environment with CPU"
elif [ "$3" = "jax" ];
then
conda-merge $PWD/requirements/jax/env_jax.yml $PWD/requirements/jax/env_jax.cpu.yml > $PWD/env.yml
echo "Installing jax environment with CPU"
else
conda-merge $PWD/requirements/env_common.yml > $PWD/env.yml
echo "Installing common environment with CPU"
fi
fi
# Install all dependencies
conda env update --file $PWD/env.yml

0 comments on commit d2ac5f8

Please sign in to comment.