Skip to content

Instantly share code, notes, and snippets.

@npho
Created September 28, 2021 06:36
Show Gist options
  • Save npho/57dda32c28f5e0ab6df4948188484c95 to your computer and use it in GitHub Desktop.
Save npho/57dda32c28f5e0ab6df4948188484c95 to your computer and use it in GitHub Desktop.
Building a Singularity container to support CUDA and Pytorch.
Bootstrap: docker
From: nvcr.io/nvidia/cuda:11.4.2-base-ubuntu20.04
%files
cuda-pytorch.yml environment.yml
%environment
export PATH=/opt/conda/bin:${PATH}
%post
apt update
apt install -y wget
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda
export PATH=/opt/conda/bin:${PATH}
pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
conda env create -f environment.yml
%runscript
source /opt/conda/etc/profile.d/conda.sh
exec /opt/conda/envs/$(head -n 1 environment.yml | cut -f 2 -d ' ')/bin/"$@"
name: cuda-pytorch
channels:
- gwoptics
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=4.5=1_gnu
- ca-certificates=2021.7.5=h06a4308_1
- certifi=2021.5.30=py38h06a4308_0
- ld_impl_linux-64=2.35.1=h7274673_9
- libffi=3.3=he6710b0_2
- libgcc-ng=9.3.0=h5101ec6_17
- libgomp=9.3.0=h5101ec6_17
- libstdcxx-ng=9.3.0=hd4cf53a_17
- ncurses=6.2=he6710b0_1
- openssl=1.1.1l=h7f8727e_0
- pip=21.0.1=py38h06a4308_0
- python=3.8.11=h12debd9_0_cpython
- readline=8.1=h27cfd23_0
- setuptools=52.0.0=py38h06a4308_0
- sqlite=3.36.0=hc218d9a_0
- tk=8.6.10=hbc83047_0
- wheel=0.37.0=pyhd3eb1b0_1
- xz=5.2.5=h7b6447c_0
- zlib=1.2.11=h7b6447c_3
- pip:
- aiohttp==3.7.4.post0
- async-timeout==3.0.1
- attrs==21.2.0
- chardet==4.0.0
- charset-normalizer==2.0.5
- click==8.0.1
- datasets==1.12.0
- dill==0.3.4
- filelock==3.0.12
- fsspec==2021.8.1
- huggingface-hub==0.0.17
- idna==3.2
- joblib==1.0.1
- multidict==5.1.0
- multiprocess==0.70.12.2
- numpy==1.21.2
- packaging==21.0
- pandas==1.3.3
- pillow==8.3.2
- pyarrow==5.0.0
- pyparsing==2.4.7
- python-dateutil==2.8.2
- pytz==2021.1
- pyyaml==5.4.1
- regex==2021.8.28
- requests==2.26.0
- sacremoses==0.0.45
- six==1.16.0
- tokenizers==0.10.3
- tqdm==4.62.2
- transformers
- typing-extensions==3.10.0.2
- urllib3==1.26.6
- xxhash==2.0.2
- yarl==1.6.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment