Skip to content

Commit 27bc500

Browse files
committed
Lablup FF 20.07 kernel with Python 3.6.9 & CUDA 10.1
1 parent 720380d commit 27bc500

File tree

1 file changed

+352
-0
lines changed

1 file changed

+352
-0
lines changed
Lines changed: 352 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,352 @@
1+
FROM nvidia/cuda:10.1-devel-ubuntu18.04
2+
3+
# TensorFlow version is tightly coupled to CUDA and cuDNN so it should be selected carefully
4+
ARG CUDA=10.1
5+
ARG LIBNVINFER=6.0.1-1
6+
ARG LIBNVINFER_MAJOR_VERSION=6
7+
ARG CUDNN=7.6.5.32-1
8+
ENV NCCL_VERSION=2.7.3-1+cuda10.1
9+
10+
# Python 2.7 or 3.6 is supported by Ubuntu Bionic out of the box
11+
ARG python=3.6
12+
ENV PYTHON_VERSION=${python}
13+
14+
ENV DEBIAN_FRONTEND=noninteractive \
15+
MPLBACKEND=Svg \
16+
PYTHONUNBUFFERED=1 \
17+
LD_LIBRARY_PATH="/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/local/nvidia/lib64:/usr/include/x86_64-linux-gnu" \
18+
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/bin/cmake/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin/mecab" \
19+
mecab_dicdir=/usr/local/lib/mecab/dic/mecab-ko-dic \
20+
LANG=C.UTF-8
21+
22+
# Set default shell to /bin/bash
23+
SHELL ["/bin/bash", "-cu"]
24+
25+
RUN apt-get update -y && \
26+
apt-get install -y --no-install-recommends software-properties-common && \
27+
add-apt-repository -y "deb http://security.ubuntu.com/ubuntu xenial-security main" && \
28+
apt-get update -y && \
29+
apt-get install -y --allow-downgrades --allow-change-held-packages --no-install-recommends \
30+
build-essential \
31+
ca-certificates \
32+
gcc g++ make \
33+
gfortran \
34+
dkms \
35+
git \
36+
curl \
37+
vim \
38+
yasm \
39+
wget zip unzip \
40+
software-properties-common \
41+
openssh-client openssh-server \
42+
libssl-dev \
43+
libmpdec2 \
44+
pdsh curl net-tools \
45+
iputils-ping \
46+
cuda-command-line-tools-${CUDA/./-} \
47+
libcublas10=10.2.1.243-1 \
48+
libcublas-dev=10.2.1.243-1 \
49+
cuda-nvrtc-${CUDA/./-} \
50+
cuda-nvrtc-dev-${CUDA/./-} \
51+
cuda-cudart-dev-${CUDA/./-} \
52+
cuda-cufft-dev-${CUDA/./-} \
53+
cuda-curand-dev-${CUDA/./-} \
54+
cuda-cusolver-dev-${CUDA/./-} \
55+
cuda-cusparse-dev-${CUDA/./-} \
56+
libcudnn7=${CUDNN}+cuda${CUDA} \
57+
libcudnn7-dev=${CUDNN}+cuda${CUDA} \
58+
libnccl2=${NCCL_VERSION} \
59+
libnccl-dev=${NCCL_VERSION} \
60+
libcurl3-dev \
61+
libfreetype6-dev \
62+
libhdf5-serial-dev \
63+
libzmq3-dev \
64+
libjpeg-dev \
65+
libpng-dev \
66+
libsm6 \
67+
libxext6 \
68+
libxrender-dev \
69+
libcairo2-dev libgirepository1.0-dev pkg-config gir1.2-gtk-3.0 \
70+
libgeos-dev libgeos++-dev \
71+
pkg-config \
72+
zlib1g-dev \
73+
mime-support \
74+
proj-bin libproj-dev libgeos-dev libgeos++-dev graphviz \
75+
python${PYTHON_VERSION} \
76+
python${PYTHON_VERSION}-dev \
77+
libnuma-dev \
78+
libjasper-dev \
79+
libtiff-dev \
80+
libavcodec-dev \
81+
libavformat-dev \
82+
libswscale-dev \
83+
libxine2-dev \
84+
libv4l-dev \
85+
libboost-dev \
86+
libboost-system-dev \
87+
libboost-filesystem-dev \
88+
fonts-nanum \
89+
fonts-nanum-coding \
90+
fonts-nanum-extra \
91+
&& \
92+
find /usr/local/cuda-${CUDA}/lib64/ -type f -name 'lib*_static.a' -not -name 'libcudart_static.a' -delete && \
93+
rm /usr/lib/x86_64-linux-gnu/libcudnn_static_v7.a
94+
95+
RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \
96+
&& echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \
97+
&& ldconfig
98+
99+
# Install CUDA-10.1 + cuDNN 7.6.0
100+
RUN ln -s /usr/local/cuda-10.1 /usr/local/cuda && \
101+
ln -s /usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.0 /usr/local/cuda/lib64/libcudnn.so && \
102+
ldconfig
103+
104+
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
105+
apt-get update -y && \
106+
apt-get install -y nodejs
107+
108+
RUN apt-get update && \
109+
apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda${CUDA} \
110+
libnvinfer-dev=${LIBNVINFER}+cuda${CUDA} \
111+
libnvinfer-plugin-dev=${LIBNVINFER}+cuda${CUDA} \
112+
libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda${CUDA} \
113+
&& apt-get clean \
114+
&& rm -rf /var/lib/apt/lists/*
115+
116+
# OFED
117+
ENV STAGE_DIR=/tmp
118+
RUN mkdir -p ${STAGE_DIR}
119+
ENV MLNX_OFED_VERSION=4.6-1.0.1.1
120+
RUN cd ${STAGE_DIR} && \
121+
wget -q -O - http://www.mellanox.com/downloads/ofed/MLNX_OFED-${MLNX_OFED_VERSION}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu18.04-x86_64.tgz | tar xzf -
122+
RUN cd ${STAGE_DIR}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu18.04-x86_64 && \
123+
./mlnxofedinstall --user-space-only --without-fw-update --all -q && \
124+
cd ${STAGE_DIR} && \
125+
rm -rf ${STAGE_DIR}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu18.04-x86_64*
126+
127+
# nvidia-peer
128+
RUN mkdir -p ${STAGE_DIR} && \
129+
git clone https://github.com/Mellanox/nv_peer_memory.git ${STAGE_DIR}/nv_peer_memory && \
130+
cd ${STAGE_DIR}/nv_peer_memory && \
131+
./build_module.sh && \
132+
cd ${STAGE_DIR} && \
133+
tar xzf ${STAGE_DIR}/nvidia-peer-memory_1.0.orig.tar.gz && \
134+
cd ${STAGE_DIR}/nvidia-peer-memory-1.0 && \
135+
dpkg-buildpackage -us -uc && \
136+
dpkg -i ${STAGE_DIR}/nvidia-peer-memory_1.0-9_all.deb
137+
138+
RUN if [[ "${PYTHON_VERSION}" == "3.6" ]]; then \
139+
apt-get install -y python${PYTHON_VERSION}-distutils python-apt ; \
140+
fi
141+
142+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 2
143+
144+
RUN apt-get update -y && \
145+
apt-get install -y --allow-downgrades --allow-change-held-packages --no-install-recommends \
146+
libatlas-base-dev libopenblas-dev
147+
148+
WORKDIR /tmp
149+
RUN curl https://bootstrap.pypa.io/get-pip.py | python3 && \
150+
python3 -m pip install --no-cache-dir -U setuptools pip
151+
152+
COPY ./numpy-1.18.5-cp36-cp36m-manylinux2010_x86_64.whl /tmp
153+
COPY ./pandas-1.0.4+4.g29edbab4a-cp36-cp36m-linux_x86_64.whl /tmp
154+
155+
RUN python3 -m pip install --no-cache-dir --upgrade -Iv \
156+
Cython==0.29.20 \
157+
/tmp/numpy-1.18.5-cp36-cp36m-manylinux2010_x86_64.whl \
158+
/tmp/pandas-1.0.4+4.g29edbab4a-cp36-cp36m-linux_x86_64.whl \
159+
tornado==6.0.4 \
160+
pystan==2.19.1.1 \
161+
pycairo==1.19.0 \
162+
python-language-server[all] \
163+
matplotlib==3.1.1
164+
165+
WORKDIR /tmp
166+
RUN git clone -q --branch=master git://github.com/xianyi/OpenBLAS.git && \
167+
cd OpenBLAS && \
168+
make DYNAMIC_ARCH=1 NO_AFFINITY=1 NUM_THREADS=48 FC=gfortran && \
169+
make install
170+
RUN git clone --recursive https://github.com/bodono/scs-python.git && \
171+
cd /tmp/scs-python && \
172+
python setup.py install --scs --gpu
173+
174+
RUN python3 -m pip install pip --no-cache-dir \
175+
Cartopy==0.18.0 \
176+
notebook==6.0.3
177+
178+
WORKDIR /tmp
179+
COPY ./requirements.20.07.txt /tmp
180+
RUN python3 -m pip install --no-cache-dir --upgrade -r requirements.20.07.txt && \
181+
rm -f /tmp/*.whl /tmp/requirements.20.07.txt
182+
183+
RUN apt-get update && \
184+
apt-get install -y \
185+
openjdk-8-jdk \
186+
automake \
187+
&& \
188+
cd /tmp && \
189+
curl -LO https://bitbucket.org/eunjeon/mecab-ko/downloads/mecab-0.996-ko-0.9.2.tar.gz && \
190+
tar zxfv mecab-0.996-ko-0.9.2.tar.gz && \
191+
cd mecab-0.996-ko-0.9.2 && \
192+
./configure && \
193+
make -j$(nproc) && \
194+
make check && \
195+
make install
196+
197+
RUN echo "Install mecab-ko-dic" && \
198+
cd /tmp && \
199+
ldconfig && \
200+
curl -LO https://bitbucket.org/eunjeon/mecab-ko-dic/downloads/mecab-ko-dic-2.1.1-20180720.tar.gz && \
201+
tar -zxvf mecab-ko-dic-2.1.1-20180720.tar.gz && \
202+
cd mecab-ko-dic-2.1.1-20180720 && \
203+
./autogen.sh && \
204+
./configure && \
205+
make -j$(nproc) && \
206+
sh -c 'echo "dicdir=/usr/local/lib/mecab/dic/mecab-ko-dic" > /usr/local/etc/mecabrc' && \
207+
make install && \
208+
cd /tmp && \
209+
git clone https://bitbucket.org/eunjeon/mecab-python-0.996.git && \
210+
python3 -m pip install /tmp/mecab-python-0.996
211+
212+
# OpenCV
213+
RUN ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h && \
214+
apt-get install -y \
215+
libgstreamer1.0-dev \
216+
libgstreamer-plugins-base1.0-dev \
217+
libgtk-3-dev \
218+
libtbb-dev \
219+
libatlas-base-dev \
220+
libdc1394-22-dev \
221+
libxvidcore-dev \
222+
libfaac-dev \
223+
libmp3lame-dev \
224+
libtheora-dev \
225+
libvorbis-dev \
226+
libxvidcore-dev \
227+
libopencore-amrnb-dev libopencore-amrwb-dev \
228+
libavresample-dev \
229+
x264 \
230+
libx264-dev \
231+
v4l-utils \
232+
libprotobuf-dev protobuf-compiler \
233+
libgoogle-glog-dev libgflags-dev \
234+
libgphoto2-dev \
235+
libeigen3-dev \
236+
libhdf5-dev \
237+
&& \
238+
apt-get clean && \
239+
rm -rf /var/lib/apt/lists/
240+
241+
RUN wget https://github.com/Kitware/CMake/releases/download/v3.15.3/cmake-3.15.3-Linux-x86_64.sh \
242+
-q -O /tmp/cmake-install.sh && \
243+
chmod u+x /tmp/cmake-install.sh && \
244+
mkdir /usr/bin/cmake && \
245+
/tmp/cmake-install.sh --skip-license --prefix=/usr/bin/cmake && \
246+
rm /tmp/cmake-install.sh
247+
248+
WORKDIR /tmp
249+
ENV OPENCV_VERSION="4.1.0"
250+
RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
251+
wget -O opencv-contrib.zip https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \
252+
unzip ${OPENCV_VERSION}.zip && \
253+
unzip opencv-contrib.zip && \
254+
mkdir opencv-${OPENCV_VERSION}/cmake_binary && \
255+
cd opencv-${OPENCV_VERSION}/cmake_binary && \
256+
cmake \
257+
-DCMAKE_BUILD_TYPE=RELEASE \
258+
-D BUILD_TIFF=ON \
259+
-D BUILD_opencv_java=OFF \
260+
-D WITH_CUDA=ON \
261+
-D CUDA_NVCC_FLAGS=--expt-relaxed-constexpr \
262+
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.1 \
263+
-D ENABLE_FAST_MATH=1 \
264+
-D CUDA_FAST_MATH=1 \
265+
-D WITH_CUBLAS=1 \
266+
-D WITH_OPENGL=ON \
267+
-D WITH_OPENCL=ON \
268+
-D WITH_IPP=ON \
269+
-D WITH_TBB=ON \
270+
-D WITH_EIGEN=ON \
271+
-D WITH_V4L=ON \
272+
-D BUILD_TESTS=OFF \
273+
-D BUILD_PERF_TESTS=OFF \
274+
-D OPENCV_EXTRA_MODULES_PATH="../../opencv_contrib-4.1.0/modules" \
275+
-D CMAKE_BUILD_TYPE=RELEASE \
276+
-D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") \
277+
-D PYTHON_EXECUTABLE=$(which python3) \
278+
-D PYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
279+
-D PYTHON_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
280+
.. 2>&1 | tee cmake_messages.txt && \
281+
make -j$(nproc) && \
282+
make install && \
283+
cd /tmp && \
284+
python3 -m pip install --no-cache-dir opencv-python && \
285+
rm -fr opencv*
286+
287+
# XGBoost
288+
RUN git clone --recursive https://github.com/dmlc/xgboost && \
289+
cd xgboost && \
290+
mkdir build && \
291+
cd build && \
292+
cmake .. -DUSE_CUDA=ON -DUSE_NCCL=ON && \
293+
make -j$(nproc) && \
294+
cd ../python-package && \
295+
python3 setup.py install
296+
297+
# LightGBM
298+
RUN git clone --recursive https://github.com/Microsoft/LightGBM && \
299+
cd LightGBM && \
300+
mkdir build ; cd build && \
301+
cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda-10.1/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda-10.1/include/ .. && \
302+
make -j$(nproc) && \
303+
cd ../python-package && \
304+
python3 setup.py install --precompile
305+
306+
# Install Open MPI
307+
RUN mkdir /tmp/openmpi && \
308+
cd /tmp/openmpi && \
309+
wget https://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-4.0.4.tar.gz && \
310+
tar zxf openmpi-4.0.4.tar.gz && \
311+
cd openmpi-4.0.4 && \
312+
./configure --enable-orterun-prefix-by-default && \
313+
make -j $(nproc) all && \
314+
make install && \
315+
ldconfig && \
316+
rm -rf /tmp/openmpi*
317+
318+
# Install OpenSSH for MPI to communicate between containers
319+
RUN apt-get install -y --no-install-recommends openssh-client openssh-server && \
320+
mkdir -p /var/run/sshd
321+
322+
# Allow OpenSSH to talk to containers without asking for confirmation
323+
RUN cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \
324+
echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \
325+
mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config
326+
327+
RUN apt autoclean && \
328+
rm -rf /var/lib/apt/lists/* && \
329+
rm -rf /root/.cache && \
330+
rm -rf /tmp/*
331+
332+
# Jupyter notebook extension
333+
RUN mkdir -p /home/work/.jupyter/nbextension
334+
WORKDIR /home/work/.jupyter/nbextension
335+
336+
RUN jupyter nbextensions_configurator enable && \
337+
jupyter contrib nbextension install && \
338+
jupyter nbextension enable --py --sys-prefix widgetsnbextension && \
339+
jupyter contrib nbextension install && \
340+
jupyter serverextension enable --py jupyterlab --sys-prefix && \
341+
jupyter labextension install --no-build @jupyter-widgets/jupyterlab-manager && \
342+
# git clone https://github.com/lambdalisue/jupyter-vim-binding vim_binding && \
343+
# jupyter nbextension enable /home/work/.jupyter/nbextension/vim_binding/vim_binding && \
344+
# jupyter labextension install --no-build @lckr/jupyterlab_variableinspector && \
345+
jupyter labextension install --no-build @krassowski/jupyterlab-lsp && \
346+
jupyter serverextension enable --py jupyter_lsp && \
347+
jupyter labextension install --no-build @jupyterlab/toc && \
348+
# jupyter labextension install @jupyterlab/hdf5
349+
jupyter labextension install --no-build jupyterlab-nvdashboard && \
350+
jupyter lab build
351+
352+
WORKDIR /home/work

0 commit comments

Comments
 (0)