blob: d3aeaff4bb46428701ca315c3275bcec10f79c1c [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# The latest tag uses gcc 9, which is too high for nvcc.
# The following tag uses gcc 8, which works with nvcc.
FROM quay.io/pypa/manylinux2014_x86_64:2020-05-01-b37d76b
# install dependencies
RUN yum install -y \
protobuf-devel \
openblas-devel \
# git \
wget \
openssh-server \
pcre-devel \
cmake \
&& yum clean all \
&& rm -rf /var/cache/yum/*
# install glog into /usr/local/include/glog /usr/local/lib
RUN wget https://github.com/google/glog/archive/v0.3.5.tar.gz -P /tmp/\
&& tar zxf /tmp/v0.3.5.tar.gz -C /tmp/ \
&& cd /tmp/glog-0.3.5 \
&& ./configure && make && make install && cd .. && rm -rf glog-0.3.5
# install dnnl into /usr/local/include /usr/local/lib
RUN wget https://github.com/intel/mkl-dnn/releases/download/v1.1/dnnl_lnx_1.1.0_cpu_gomp.tgz -P /tmp/ \
&& tar zxf /tmp/dnnl_lnx_1.1.0_cpu_gomp.tgz -C /tmp/ \
&& cp -r -H /tmp/dnnl_lnx_1.1.0_cpu_gomp/lib/lib* /usr/local/lib/ \
&& cp -r -H /tmp/dnnl_lnx_1.1.0_cpu_gomp/include/* /usr/local/include/ \
&& rm -rf /tmp/dnnl_lnx_1.1.0_cpu_gomp
# ENV DNNL_ROOT /root/dnnl_lnx_1.1.0_cpu_gomp/
# install swig into /usr/local/bin
RUN wget http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz -P /tmp/ \
&& tar zxf /tmp/swig-3.0.12.tar.gz -C /tmp/ \
&& cd /tmp/swig-3.0.12 && ./configure && make && make install && cd .. && rm -rf swig-3.0.12
# numpy and python versions should be matched;
# twine works for all python versions
RUN /opt/python/cp36-cp36m/bin/pip install numpy twine
RUN /opt/python/cp37-cp37m/bin/pip install numpy
RUN /opt/python/cp38-cp38/bin/pip install numpy
# install cuda and cudnn
# Refer to https://gitlab.com/nvidia/container-images/cuda/-/tree/master/dist for other cuda and cudnn versions
# 10.2-base-centos7
RUN NVIDIA_GPGKEY_SUM=d1be581509378368edeec8c1eb2958702feedf3bc3d17011adbf24efacce4ab5 && \
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/7fa2af80.pub | sed '/^Version/d' > /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA && \
echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict -
COPY cuda.repo /etc/yum.repos.d/cuda.repo
ENV CUDA_VERSION 10.2.89
ENV CUDA_PKG_VERSION 10-2-$CUDA_VERSION-1
# For libraries in the cuda-compat-* package: https://docs.nvidia.com/cuda/eula/index.html#attachment-a
RUN yum install -y \
cuda-cudart-$CUDA_PKG_VERSION \
cuda-compat-10-2 \
&& ln -s cuda-10.2 /usr/local/cuda && \
rm -rf /var/cache/yum/*
# nvidia-docker 1.0
RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64:$LD_LIBRARY_PATH
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
ENV NVIDIA_REQUIRE_CUDA "cuda>=10.2 brand=tesla,driver>=396,driver<397 brand=tesla,driver>=410,driver<411 brand=tesla,driver>=418,driver<419 brand=tesla,driver>=440,driver<441"
# 10.2-runtime-centos7
RUN yum install -y \
cuda-libraries-$CUDA_PKG_VERSION \
cuda-nvtx-$CUDA_PKG_VERSION \
libcublas10-10.2.2.89-1 \
&& rm -rf /var/cache/yum/*
# 10.2-devel-centos7
RUN yum install -y \
cuda-nvml-dev-$CUDA_PKG_VERSION \
cuda-command-line-tools-$CUDA_PKG_VERSION \
cuda-cudart-dev-$CUDA_PKG_VERSION \
cuda-libraries-dev-$CUDA_PKG_VERSION \
cuda-minimal-build-$CUDA_PKG_VERSION \
&& rm -rf /var/cache/yum/*
RUN yum install -y xz && NCCL_DOWNLOAD_SUM=a9ee790c3fc64b0ecbb00db92eddc1525552eda10a8656ff4b7380f66d81bda1 && \
curl -fsSL https://developer.download.nvidia.com/compute/redist/nccl/v2.7/nccl_2.7.3-1+cuda10.2_x86_64.txz -O && \
echo "$NCCL_DOWNLOAD_SUM nccl_2.7.3-1+cuda10.2_x86_64.txz" | sha256sum -c - && \
unxz nccl_2.7.3-1+cuda10.2_x86_64.txz && \
tar --no-same-owner --keep-old-files --no-overwrite-dir -xvf nccl_2.7.3-1+cuda10.2_x86_64.tar -C /usr/local/cuda/include/ --strip-components=2 --wildcards '*/include/*' && \
tar --no-same-owner --keep-old-files --no-overwrite-dir -xvf nccl_2.7.3-1+cuda10.2_x86_64.tar -C /usr/local/cuda/lib64/ --strip-components=2 --wildcards '*/lib/libnccl.so' && \
rm -f nccl_2.7.3-1+cuda10.2_x86_64.tar && \
ldconfig
ENV LIBRARY_PATH /usr/local/cuda/lib64/stubs
# 10.2-cudnn7-devel-centos7
ENV CUDNN_VERSION 7.6.5.32
# cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
RUN CUDNN_DOWNLOAD_SUM=600267f2caaed2fd58eb214ba669d8ea35f396a7d19b94822e6b36f9f7088c20 && \
curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v7.6.5/cudnn-10.2-linux-x64-v7.6.5.32.tgz -O && \
echo "$CUDNN_DOWNLOAD_SUM cudnn-10.2-linux-x64-v7.6.5.32.tgz" | sha256sum -c - && \
tar --no-same-owner -xzf cudnn-10.2-linux-x64-v7.6.5.32.tgz -C /usr/local && \
rm cudnn-10.2-linux-x64-v7.6.5.32.tgz && \
ldconfig
# install cnmem to /usr/local/include /usr/local/lib
RUN git clone https://github.com/NVIDIA/cnmem.git cnmem \
&& cd cnmem && mkdir build && cd build && cmake .. && make && make install && cd ../.. && rm -rf cnmem
# install mpich /usr/local/include /usr/local/lib
RUN wget http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz -P $HOME \
&& cd $HOME \
&& tar xfz mpich-3.3.2.tar.gz \
&& cd mpich-3.3.2 \
&& ./configure --prefix=/usr/local --disable-fortran \
&& make && make install && cd .. && rm -rf mpich-3.3.2