Skip to content

Commit 10f50c7

Browse files
committed
support intel python
1 parent e07b169 commit 10f50c7

File tree

1 file changed

+36
-47
lines changed

1 file changed

+36
-47
lines changed

commons/Dockerfile.base.py38-cuda11.2

Lines changed: 36 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@ MAINTAINER Mario Cho "[email protected]"
33

44
ARG CUDA=11.2
55
ARG CUDNN=8.1.1.33-1
6-
# Python 3.8 is supported by Ubuntu Bionic out of the box
7-
ARG python=3.8
86
ENV CUDNN_VERSION 8.1.1.33
97
ENV NCCL=2.8.4
108
ENV NCCL_VERSION=2.8.4-1
119
ENV MLNX_OFED_VERSION=5.4-2.4.1.3
12-
ENV PYTHON_VERSION=${python}
1310
ENV OPENMPI 4.1.2
14-
ENV NUMPY_VERSION 1.22.4
15-
ENV SCIPY_VERSION 1.8.1
16-
ENV MKL_VERSION=2020.3
17-
ENV MKL_BUILD=279
1811
# configure for enviroments
1912
ENV DEBIAN_FRONTEND=noninteractive \
2013
TZ=Asia/Seoul \
@@ -24,7 +17,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
2417
LIBRARY_PATH=/usr/local/cuda/lib64/stubs \
2518
_CUDA_COMPAT_PATH="/usr/local/cuda/compat" \
2619
LD_LIBRARY_PATH="/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/compat/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/usr/lib/x86_64-linux-gnu:/usr/include/x86_64-linux-gnu:/usr/local/lib" \
27-
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/mpi/bin:/usr/local/ucx:/usr/local/sbin:/usr/bin/cmake/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/src/lightgbm/LightGBM" \
20+
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/mpi/bin:/usr/local/ucx:/opt/conda/bin:/usr/local/sbin:/usr/bin/cmake/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/src/lightgbm/LightGBM" \
2821
CPLUS_INCLUDE_PATH=/usr/include/gdal \
2922
C_INCLUDE_PATH=/usr/include/gdal \
3023
mecab_dicdir=/usr/local/lib/mecab/dic/mecab-ko-dic \
@@ -41,15 +34,11 @@ SHELL ["/bin/bash", "-cu"]
4134

4235
WORKDIR /tmp
4336
RUN apt-get update -y && \
44-
apt-get install -y --no-install-recommends software-properties-common wget && \
37+
apt-get install -y --no-install-recommends software-properties-common wget curl && \
4538
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
4639
add-apt-repository -y "deb http://security.ubuntu.com/ubuntu xenial-security main" && \
4740
add-apt-repository -y ppa:deadsnakes/ppa && \
4841
add-apt-repository -y ppa:bashtop-monitor/bashtop && \
49-
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
50-
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
51-
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
52-
wget https://apt.repos.intel.com/setup/intelproducts.list -O /etc/apt/sources.list.d/intelproducts.list && \
5342
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub && \
5443
apt-get update -y && \
5544
apt-get install -y --no-install-recommends \
@@ -77,7 +66,6 @@ RUN apt-get update -y && \
7766
git \
7867
graphviz \
7968
htop \
80-
intel-mkl-2020.3-111 intel-ipp-2020.2-108 intel-tbb-2020.3-108 intel-daal-2020.2-108 intel-mpi-2019.8-108 \
8169
iputils-ping \
8270
libasound2-dev \
8371
libatlas-base-dev \
@@ -92,6 +80,7 @@ RUN apt-get update -y && \
9280
libdc1394-22-dev \
9381
libeigen3-dev \
9482
libfaac-dev \
83+
libfftw3-dev \
9584
libfreetype6-dev \
9685
libfuse2 \
9786
libgdal-dev \
@@ -157,6 +146,7 @@ RUN apt-get update -y && \
157146
mpich \
158147
ncurses-term \
159148
net-tools \
149+
nodejs \
160150
openjdk-8-jdk \
161151
openssh-client \
162152
openssh-server \
@@ -165,11 +155,7 @@ RUN apt-get update -y && \
165155
pkg-config \
166156
proj-bin \
167157
protobuf-compiler \
168-
python${PYTHON_VERSION} \
169-
python${PYTHON_VERSION}-dev \
170-
python${PYTHON_VERSION}-distutils \
171158
python-apt \
172-
python3-gdal \
173159
subversion \
174160
swig \
175161
tk \
@@ -194,17 +180,28 @@ RUN apt-get update -y && \
194180
echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf && \
195181
ldconfig && \
196182
# Add OpenCL ICD files for LightGBM
183+
find /usr/local/cuda-${CUDA}/lib64/ -type f -name 'lib*_static.a' -not -name 'libcudart_static.a' -delete && \
197184
mkdir -p /etc/OpenCL/vendors && \
198185
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd && \
199186
ldconfig && \
200-
echo "/opt/intel/daal/lib/intel64" >> /etc/ls.so.conf && \
201-
echo "/opt/intel/ipp/lib/intel64" >> /etc/ls.so.conf && \
202-
echo "/opt/intel/lib/intel64" >> /etc/ls.so.conf && \
203-
echo "/opt/intel/mkl/lib/intel64" >> /etc/ls.so.conf && \
204-
find /usr/local/cuda-${CUDA}/lib64/ -type f -name 'lib*_static.a' -not -name 'libcudart_static.a' -delete && \
205-
# Add OpenCL ICD files for LightGBM
206-
mkdir -p /etc/OpenCL/vendors && \
207-
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
187+
wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py38_4.9.2-Linux-x86_64.sh -O /tmp/miniconda.sh && \
188+
/bin/bash /tmp/miniconda.sh -b -p /opt/conda && \
189+
rm /tmp/miniconda.sh && \
190+
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
191+
echo ". /opt/conda/etc/profile.d/conda.sh" >> /root/.bashrc && \
192+
echo "conda activate base" >> /root/.bashrc && \
193+
curl -L "https://github.com/krallin/tini/releases/download/v0.19.0/tini_0.19.0.deb" > tini.deb && \
194+
dpkg -i tini.deb && \
195+
rm tini.deb && \
196+
/opt/conda/bin/conda config --add channels conda-forge && \
197+
/opt/conda/bin/conda config --add channels bioconda && \
198+
/opt/conda/bin/conda config --add channels intel && \
199+
/opt/conda/bin/conda config --add envs_dirs /home/work/.conda && \
200+
/opt/conda/bin/conda update --prefix /opt/conda conda && \
201+
/opt/conda/bin/conda install -c intel mkl intelpython3_core && \
202+
/opt/conda/bin/conda install pip && \
203+
/opt/conda/bin/python -m pip install --no-cache-dir -U "setuptools <58"
204+
208205

209206
# OFED
210207
WORKDIR /tmp
@@ -267,17 +264,6 @@ RUN git clone -q --branch=v0.3.20 https://github.com/xianyi/OpenBLAS.git && \
267264
make DYNAMIC_ARCH=1 NO_AFFINITY=1 NUM_THREADS=48 FC=gfortran && \
268265
make install
269266

270-
# install python
271-
WORKDIR /tmp
272-
RUN curl https://bootstrap.pypa.io/get-pip.py | python3 && \
273-
# rm -r /usr/bin/python3 && \
274-
python3 -m pip install --no-cache-dir -U setuptools "pip < 22" && \
275-
python3 -m pip install --no-cache-dir cython pybind11 pythran && \
276-
# ln -s /usr/bin/python3.8 /usr/bin/python3 && \
277-
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
278-
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
279-
280-
281267
# XGBoost
282268
RUN git clone --recursive https://github.com/dmlc/xgboost && \
283269
cd xgboost && \
@@ -297,21 +283,24 @@ RUN cd /usr/local/src && mkdir lightgbm && cd lightgbm && \
297283
cd /usr/local/src/lightgbm/LightGBM/python-package && \
298284
python3 setup.py install --precompile
299285

300-
ENV NUMPY_VERSION=1.17.4
286+
ENV NUMPY_VERSION 1.22.4
287+
ENV SCIPY_VERSION 1.8.1
288+
ENV MKL_VERSION=2020.3
289+
ENV MKL_BUILD=279
290+
301291
# Numpy
302292
RUN git clone --branch=v${NUMPY_VERSION} --depth=1 https://github.com/numpy/numpy.git numpy && \
303293
cd numpy && \
304294
git checkout -b v${NUMPY_VERSION} && \
305295
git submodule update --init && \
306296
cp site.cfg.example site.cfg && \
307297
echo "[mkl]" >> site.cfg && \
308-
echo "include_dirs = /opt/intel/compilers_and_libraries_2020.3.279/linux/mkl/include/" >> site.cfg && \
298+
echo "include_dirs = /opt/2020.3.279/linux/mkl/include/" >> site.cfg && \
309299
echo "library_dirs = /opt/intel/compilers_and_libraries_2020.3.279/linux/mkl/lib/intel64" >> site.cfg && \
310300
echo "mkl_libs = mkl_rt" >> site.cfg && \
311301
echo "lapack_libs =" >> site.cfg && \
312302
python3 setup.py bdist_wheel -d /tmp
313303

314-
ENV SCIPY_VERSION=1.6.0
315304
# Scipy
316305
RUN cd /tmp && \
317306
git clone --branch=v${SCIPY_VERSION} --depth=1 https://github.com/scipy/scipy.git scipy && \
@@ -430,13 +419,13 @@ RUN mkdir /tmp/openmpi && \
430419
chmod a+x /usr/local/bin/mpirun && \
431420
ln -s /usr/local/lib/libmpi.so.40.30.2 /usr/local/lib/libmpi.so.12 && \
432421
# Configure OpenMPI to run good defaults:
433-
echo "btl_tcp_if_exclude = lo,docker0" >> /usr/local/etc/openmpi-mca-params.conf && \
434-
MPICC=/usr/lib64/openmpi/bin/mpicc python3 -m pip install mpi4py && \
435-
python3 -m pip install "jax[cuda11_cudnn805]" -f https://storage.googleapis.com/jax-releases/jax_releases.html && \
436-
CUDA_ROOT=/usr/local/cuda python3 -m pip install mpi4jax \
437-
nni==1.9 \
438-
mlflow==1.12.1 \
439-
scikit-nni==0.2.1
422+
echo "btl_tcp_if_exclude = lo,docker0" >> /usr/local/etc/openmpi-mca-params.conf
423+
RUN MPICC=/usr/lib64/openmpi/bin/mpicc python3 -m pip install mpi4py && \
424+
python3 -m pip install "jax[cuda11_cudnn805]" -f https://storage.googleapis.com/jax-releases/jax_releases.html
425+
RUN CUDA_ROOT=/usr/local/cuda python3 -m pip install mpi4jax
426+
# nni==1.9 \
427+
# mlflow==1.12.1 \
428+
# scikit-nni==0.2.1
440429

441430
RUN ldconfig /usr/local/cuda/targets/x86_64-linux/lib/stubs && \
442431
HOROVOD_NCCL_LINK=SHARED \

0 commit comments

Comments
 (0)