-
Notifications
You must be signed in to change notification settings - Fork 1
/
Singularity.ubuntu_torch
81 lines (68 loc) · 2.55 KB
/
Singularity.ubuntu_torch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Bootstrap: docker
From: nvidia/cuda:10.1-cudnn7-runtime-ubuntu16.04
%environment
SHELL=/bin/bash
export SHELL
export HDF5_USE_FILE_LOCKING='FALSE'
export PATH=/usr/local/cuda/bin:$PATH
export CPATH=/usr/local/cuda/include:$CPATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export ANACONDA_HOME=/opt/anaconda3/:$ANACONDA_HOME
%setup
# runs on host
# the path to the image is $SINGULARITY_ROOTFS
%post
# post-setup script
# load environment variables
. /environment
# use bash as default shell
echo 'SHELL=/bin/bash' >> /environment
# make environment file executable
chmod +x /environment
# default mount paths
mkdir /scratch
# fix this issue: https://github.com/singularityware/singularity/issues/1182#issuecomment-381796545
touch /usr/bin/nvidia-smi
apt-get update && apt-get -y install locales
locale-gen en_US.UTF-8
apt-get -y --force-yes install vim wget bzip2 git
apt-get -y install build-essential
# install anaconda
# PREFIX=/opt/anaconda3
wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh
bash ./Anaconda3-5.2.0-Linux-x86_64.sh -b -p /opt/anaconda3
export PATH=$PATH:/opt/anaconda3/bin
# setup torch environment
conda create -n torch-env python=3.6
chmod +x /opt/anaconda3/bin/activate
/opt/anaconda3/bin/activate torch-env
conda update -n base conda
conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses
conda install -c pytorch magma-cuda101
git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
# if you are updating an existing checkout
git submodule sync
git submodule update --init --recursive
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
python setup.py install
conda install Pillow
conda install matplotlib
conda install tqdm
conda install h5py
conda install pandas
conda install simpleitk
conda install comet_ml
conda install pyyaml
pip install torch-scatter==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.4.0.html
pip install torch-sparse==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.4.0.html
pip install torch-cluster==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.4.0.html
pip install torch-spline-conv==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.4.0.html
pip install torch-geometric
%runscript
# executes with the singularity run command
# delete this section to use existing docker ENTRYPOINT command
echo "Welcome to Singularity Container pytorch ubuntu 16.04"
#exec source /opt/anaconda3/bin/activate torch-env
%test
# test that script is a success