This repository has been archived by the owner on Nov 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSingularity
executable file
·161 lines (120 loc) · 4.1 KB
/
Singularity
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
Bootstrap: docker
From: nvidia/cuda:8.0-cudnn6-devel-ubuntu16.04
%environment
#Environment variables
#Use bash as default shell
SHELL=/bin/bash
#Add CUDA paths
CPATH="/usr/local/cuda/include:$CPATH"
PATH="/usr/local/cuda/bin:$PATH"
LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
CUDA_HOME="/usr/local/cuda"
#CUDA root needed for Theano
CUDA_ROOT="/usr/local/cuda"
#Python 3.5 paths
CPATH="/usr/include/python3.5m:$CPATH"
PYTHONPATH="/usr/local/lib/python3.5/dist-packages:$PYTHONPATH"
export PATH LD_LIBRARY_PATH CPATH CUDA_HOME PYTHONPATH CUDA_ROOT
%setup
#Runs on host
#The path to the image is $SINGULARITY_ROOTFS
%post
#Post setup script
#Makes a root build directory
mkdir /build
#Load environment variables
. /environment
#Default mount paths
mkdir /scratch /data /shared /fastdata
echo "Updating ubuntu"
apt-get -y update
apt-get -y upgrade
apt-get -y dist-upgrade
apt-get -y autoremove
echo "Installing essential packages"
apt-get install -y wget git vim cmake cmake-curses-gui build-essential
echo "Installing OpenCV Dependencies"
## GUI (if you want to use GTK instead of Qt, replace 'qt5-default' with 'libgtkglext1-dev' and remove '-DWITH_QT=ON' option in CMake):
apt-get install -y qt5-default libvtk6-dev
## Media I/O:
apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev libopenexr-dev libgdal-dev
## Video I/O:
apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev
## Parallelism and linear algebra libraries:
apt-get install -y libtbb-dev libeigen3-dev
## Python:
apt-get install -y python3.5-dev python3.5-tk python3.5-numpy
## Make python 3.5m the default
cd /usr/bin
rm python
ln -s python3.5m python
## Install pip for python 3
cd /build
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
## Installed required global python packages
pip install pandas scipy sklearn matplotlib NLTK
## Java:
apt-get install -y ant default-jdk
## Documentation:
apt-get install -y doxygen
#Update libs links
ldconfig
# OpenCV - INSTALL (YOU CAN CHANGE '3.3.0' FOR THE LAST STABLE VERSION)
echo "Installing OpenCV"
cd /build
apt-get install -y unzip wget
wget https://github.com/opencv/opencv/archive/3.3.0.tar.gz
tar -xf 3.3.0.tar.gz
rm 3.3.0.tar.gz
cd opencv-3.3.0
mkdir build
cd build
cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DENABLE_PRECOMPILED_HEADERS=OFF -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D BUILD_opencv_python3=yes \
-D PYTHON_DEFAULT_EXECUTABLE="/usr/bin/python3.5m" \
-D CUDA_ARCH_BIN="3.0 3.5 3.7 5.0 5.2 6.0 6.1" \
-D CUDA_CUDA_LIBRARY="/usr/local/cuda/lib64/stubs/libcuda.so" \
..
make -j4
make install
ldconfig
#echo "Installing SMILE" - Doesn't support python 3.5
#cd /build
#apt-get install -y python-pyo python-kivy
#git clone https://github.com/compmem/smile.git
cd smile
#pip install .
#Update libs links
ldconfig
echo "Installing Theano"
pip install cython nose pydot-ng pycuda Theano
#Install libgpuarray needed by theano
cd /build
wget https://github.com/Theano/libgpuarray/releases/download/v0.7.5/libgpuarray-0.7.5.tar.gz
tar -xf libgpuarray-0.7.5.tar.gz
cd libgpuarray-0.7.5
mkdir Build
cd Build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
make install
cd ..
python setup.py build
python setup.py install
echo "Installing Tensorflow"
TF_PYTHON_URL="https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.1-cp35-cp35m-linux_x86_64.whl"
pip install --ignore-installed --upgrade $TF_PYTHON_URL
echo "Installing Keras"
pip install keras
echo "Installing Pytorch"
pip install http://download.pytorch.org/whl/cu80/torch-0.3.0.post4-cp35-cp35m-linux_x86_64.whl
pip install torchvision
#Remove the build directory
rm -rf /build
%runscript
#Executes with the singularity run command
#delete this section to use existing docker ENTRYPOINT command
%test
#Test that script is a success