Skip to content

Commit e132dd2

Browse files
committedOct 27, 2017
Initial commit
0 parents  commit e132dd2

File tree

4 files changed

+514
-0
lines changed

4 files changed

+514
-0
lines changed
 

‎Dockerfile

+280
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
FROM nvidia/cuda:8.0-cudnn6-devel
2+
LABEL maintainer="Ming <i@ufoym.com>"
3+
4+
# =================================
5+
# cuda 8.0
6+
# cudnn v6
7+
# ---------------------------------
8+
# python 3.5
9+
# opencv latest (git)
10+
# ---------------------------------
11+
# tensorflow latest (pip)
12+
# sonnet latest (pip)
13+
# pytorch 0.2.0 (pip)
14+
# keras latest (pip)
15+
# mxnet latest (pip)
16+
# cntk 2.2 (pip)
17+
# chainer latest (pip)
18+
# theano latest (git)
19+
# lasagne latest (git)
20+
# caffe latest (git)
21+
# torch latest (git)
22+
# ---------------------------------
23+
24+
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
25+
PIP_INSTALL="pip --no-cache-dir install --upgrade" && \
26+
GIT_CLONE="git clone --depth 10" && \
27+
28+
# =================================
29+
# apt
30+
# =================================
31+
32+
rm -rf /var/lib/apt/lists/* \
33+
/etc/apt/sources.list.d/cuda.list \
34+
/etc/apt/sources.list.d/nvidia-ml.list && \
35+
36+
apt-get update && \
37+
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
38+
apt-utils \
39+
&& \
40+
41+
# =================================
42+
# common tools
43+
# =================================
44+
45+
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
46+
build-essential \
47+
ca-certificates \
48+
wget \
49+
git \
50+
vim \
51+
&& \
52+
53+
# =================================
54+
# cmake
55+
# =================================
56+
57+
# fix boost-not-found issue caused by the `apt-get` version of cmake
58+
$GIT_CLONE https://github.com/Kitware/CMake ~/cmake && \
59+
cd ~/cmake && \
60+
./bootstrap --prefix=/usr/local && \
61+
make -j"$(nproc)" install && \
62+
63+
# =================================
64+
# python3
65+
# =================================
66+
67+
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
68+
python3-pip \
69+
python3-dev \
70+
&& \
71+
ln -s /usr/bin/python3 /usr/local/bin/python && \
72+
pip3 --no-cache-dir install --upgrade pip && \
73+
$PIP_INSTALL \
74+
setuptools \
75+
numpy \
76+
scipy \
77+
pandas \
78+
scikit-learn \
79+
matplotlib \
80+
Cython \
81+
&& \
82+
83+
# =================================
84+
# opencv
85+
# =================================
86+
87+
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
88+
libatlas-base-dev \
89+
libboost-all-dev \
90+
libgflags-dev \
91+
libgoogle-glog-dev \
92+
libhdf5-serial-dev \
93+
libleveldb-dev \
94+
liblmdb-dev \
95+
libprotobuf-dev \
96+
libsnappy-dev \
97+
protobuf-compiler \
98+
&& \
99+
100+
$GIT_CLONE https://github.com/opencv/opencv ~/opencv && \
101+
mkdir -p ~/opencv/build && cd ~/opencv/build && \
102+
cmake -D CMAKE_BUILD_TYPE=RELEASE \
103+
-D CMAKE_INSTALL_PREFIX=/usr/local \
104+
-D WITH_IPP=OFF \
105+
-D WITH_CUDA=OFF \
106+
-D WITH_OPENCL=OFF \
107+
-D BUILD_TESTS=OFF \
108+
-D BUILD_PERF_TESTS=OFF \
109+
.. && \
110+
make -j"$(nproc)" install && \
111+
112+
# =================================
113+
# tensorflow
114+
# =================================
115+
116+
$PIP_INSTALL \
117+
tensorflow_gpu \
118+
&& \
119+
120+
# =================================
121+
# sonnet
122+
# =================================
123+
124+
$PIP_INSTALL \
125+
dm-sonnet \
126+
&& \
127+
128+
# =================================
129+
# mxnet
130+
# =================================
131+
132+
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
133+
graphviz \
134+
&& \
135+
136+
$PIP_INSTALL \
137+
mxnet-cu80 \
138+
graphviz \
139+
&& \
140+
141+
# =================================
142+
# cntk
143+
# =================================
144+
145+
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
146+
openmpi-bin \
147+
libjasper-dev \
148+
&& \
149+
150+
$PIP_INSTALL \
151+
https://cntk.ai/PythonWheel/GPU/cntk-2.2-cp35-cp35m-linux_x86_64.whl \
152+
&& \
153+
154+
# =================================
155+
# keras
156+
# =================================
157+
158+
$PIP_INSTALL \
159+
h5py \
160+
keras \
161+
&& \
162+
163+
# =================================
164+
# pytorch
165+
# =================================
166+
167+
$PIP_INSTALL \
168+
http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp35-cp35m-manylinux1_x86_64.whl \
169+
torchvision \
170+
&& \
171+
172+
# =================================
173+
# chainer
174+
# =================================
175+
176+
$PIP_INSTALL \
177+
cupy \
178+
chainer \
179+
&& \
180+
181+
# =================================
182+
# theano
183+
# =================================
184+
185+
$GIT_CLONE https://github.com/Theano/Theano ~/theano && \
186+
cd ~/theano && \
187+
$PIP_INSTALL \
188+
. && \
189+
190+
$GIT_CLONE https://github.com/Theano/libgpuarray ~/gpuarray && \
191+
mkdir -p ~/gpuarray/build && cd ~/gpuarray/build && \
192+
cmake -D CMAKE_BUILD_TYPE=RELEASE \
193+
-D CMAKE_INSTALL_PREFIX=/usr/local \
194+
.. && \
195+
make -j"$(nproc)" install && \
196+
cd ~/gpuarray && \
197+
python setup.py build && \
198+
python setup.py install && \
199+
200+
printf '[global]\nfloatX = float32\ndevice = cuda0\n\n[dnn]\ninclude_path = /usr/local/cuda/targets/x86_64-linux/include\n' \
201+
> ~/.theanorc && \
202+
203+
# =================================
204+
# lasagne
205+
# =================================
206+
207+
$GIT_CLONE https://github.com/Lasagne/Lasagne ~/lasagne && \
208+
cd ~/lasagne && \
209+
$PIP_INSTALL \
210+
. && \
211+
212+
# =================================
213+
# caffe
214+
# =================================
215+
216+
$GIT_CLONE https://github.com/NVIDIA/nccl && \
217+
cd nccl; make -j"$(nproc)" install; cd ..; rm -rf nccl && \
218+
219+
$GIT_CLONE https://github.com/BVLC/caffe ~/caffe && \
220+
mkdir ~/caffe/build && cd ~/caffe/build && \
221+
cmake -D CMAKE_BUILD_TYPE=RELEASE \
222+
-D CMAKE_INSTALL_PREFIX=/usr/local \
223+
-D USE_CUDNN=1 \
224+
-D USE_NCCL=1 \
225+
-D python_version=3 \
226+
-D CUDA_NVCC_FLAGS=--Wno-deprecated-gpu-targets \
227+
-Wno-dev \
228+
.. && \
229+
make -j"$(nproc)" install && \
230+
231+
# fix ValueError caused by python-dateutil 1.x
232+
sed -i 's/,<2//g' ~/caffe/python/requirements.txt && \
233+
234+
$PIP_INSTALL \
235+
-r ~/caffe/python/requirements.txt && \
236+
237+
mv /usr/local/python/caffe /usr/local/lib/python3.5/dist-packages/ && \
238+
rm -rf /usr/local/python && \
239+
240+
# =================================
241+
# torch
242+
# =================================
243+
244+
$GIT_CLONE https://github.com/torch/distro.git ~/torch --recursive&& \
245+
246+
cd ~/torch/exe/luajit-rocks && \
247+
mkdir build && cd build && \
248+
cmake -D CMAKE_BUILD_TYPE=RELEASE \
249+
-D CMAKE_INSTALL_PREFIX=/usr/local \
250+
-D WITH_LUAJIT21=ON \
251+
.. && \
252+
make -j"$(nproc)" install && \
253+
254+
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
255+
libreadline-dev \
256+
&& \
257+
258+
$GIT_CLONE https://github.com/Yonaba/Moses ~/moses && \
259+
cd ~/moses && \
260+
luarocks install rockspec/moses-1.6.1-1.rockspec && \
261+
262+
cd ~/torch && \
263+
sed -i 's/extra\/cudnn/extra\/cudnn \&\& git checkout R6/' install.sh && \
264+
sed -i 's/$PREFIX\/bin\/luarocks/luarocks/' install.sh && \
265+
sed -i '/qt/d' install.sh && \
266+
sed -i '/Installing Lua/,/^cd \.\.$/d' install.sh && \
267+
sed -i '/path_to_nvidiasmi/,/^fi$/d' install.sh && \
268+
sed -i '/Restore anaconda/,/^Not updating$/d' install.sh && \
269+
sed -i '/You might want to/,/^fi$/d' install.sh && \
270+
yes no | ./install.sh && \
271+
272+
273+
# =================================
274+
# config & cleanup
275+
# =================================
276+
277+
ldconfig && \
278+
apt-get clean && \
279+
apt-get autoremove && \
280+
rm -rf /var/lib/apt/lists/* /tmp/* ~/*

‎LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Ming
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)
Please sign in to comment.