Skip to content

Commit be9263a

Browse files
committed
Intel MKL support kernel of base kerenl 20.07
1 parent d6d1d17 commit be9263a

File tree

1 file changed

+309
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)