-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpytorch.build
77 lines (65 loc) · 2.05 KB
/
pytorch.build
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
bootstrap:docker
From:nvidia/cuda:9.1-cudnn7-devel-ubuntu16.04
%setup
echo "# singularity nvidia libs when run in --nv
/.singularity.d/libs/" >> ${SINGULARITY_ROOTFS}/etc/ld.so.conf.d/singularity-nv.conf
%environment
PATH=/opt/anaconda3/bin:$PATH
%post
## Install dependencies and clean
apt update && apt install -y --no-install-recommends \
build-essential \
cmake \
curl \
wget \
unzip \
vim \
git \
ca-certificates \
libjpeg-dev \
libpng-dev
rm -rf /var/lib/apt/lists/*
## Install anaconda3 5.1
wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh -O ~/anaconda.sh
bash ~/anaconda.sh -b -p /opt/anaconda3
export PATH=/opt/anaconda3/bin:$PATH
conda update -y -n base conda
conda install -y \
numpy \
pyyaml \
mkl \
mkl-include \
setuptools \
cmake \
cffi \
typing \
ipython \
scipy \
matplotlib
conda install -c magma-cuda91
conda update --all -y
conda clean -ya
###############################
# Installing pytorch
###############################
%apphelp torchinstall
The torch install app allows a post installation of torch to a writable container.
It requires the container first be made using --sandbox (so image size can grow).
Then the pytorch installation can be run with the following:
singularity run --writable --nv --app torchinstall /path/to/this/container/
%appenv torchinstall
export CMAKE_PREFIX_PATH=/opt/anaconda3/
export TORCH_CUDA_ARCH_LIST="5.2+PTX 6.0 6.1"
export CUDA_HOME=/usr/local/cuda-9.1/
#export TORCH_CUDA_ARCH_LIST="3.0;3.5;5.0;5.2+PTX;6.0;6.1" (all arhitectures)
git clone --recursive https://github.com/pytorch/pytorch
########### new install
mkdir /opt/pytorch && cd /opt/pytorch
git submodule update --init
TORCH_CUDA_ARCH_LIST="3.5 5.2 6.0 6.1 7.0+PTX" TORCH_NVCC_FLAGS="-Xfatbin -compress-all" \
CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" \
pip install -v .
git clone https://github.com/pytorch/vision.git && cd vision && pip install -v .
#conda install -y -c pytorch magma-cuda91
#cd pytorch
#python setup.py install