|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | + |
| 18 | +# https://quay.io/repository/pypa/manylinux_2_28_x86_64?tab=tags |
| 19 | +# https://github.com/pypa/manylinux/tree/main |
| 20 | +# FROM quay.io/pypa/manylinux_2_28_x86_64:2023-10-15-e4d9465 |
| 21 | +FROM quay.io/pypa/manylinux_2_28_x86_64:2022-05-30-26ca994 |
| 22 | + |
| 23 | +# install dependencies |
| 24 | +RUN yum install -y \ |
| 25 | + protobuf-devel \ |
| 26 | + openblas-devel \ |
| 27 | + # git \ |
| 28 | + wget \ |
| 29 | + openssh-server \ |
| 30 | + pcre-devel \ |
| 31 | + cmake \ |
| 32 | + rpm-build rpmdevtools \ |
| 33 | + && yum clean all \ |
| 34 | + && rm -rf /var/cache/yum/* |
| 35 | + |
| 36 | +# install glog into /usr/local/include/glog /usr/local/lib |
| 37 | +# RUN wget https://github.com/google/glog/archive/v0.3.5.tar.gz -P /tmp/\ |
| 38 | +# && tar zxf /tmp/v0.3.5.tar.gz -C /tmp/ \ |
| 39 | +# && cd /tmp/glog-0.3.5 \ |
| 40 | +# && ./configure && make && make install && cd .. && rm -rf glog-0.3.5 |
| 41 | + |
| 42 | +# install newer glog |
| 43 | +RUN wget https://github.com/google/glog/archive/refs/tags/v0.4.0.tar.gz -P /tmp/\ |
| 44 | + && tar zxf /tmp/v0.4.0.tar.gz -C /tmp/ \ |
| 45 | + && cd /tmp/glog-0.4.0 \ |
| 46 | + && ./autogen.sh && ./configure && make && make install && cd .. && rm -rf glog-0.4.0 |
| 47 | + |
| 48 | +# install dnnl into /usr/local/include /usr/local/lib |
| 49 | +RUN wget https://github.com/intel/mkl-dnn/releases/download/v1.1/dnnl_lnx_1.1.0_cpu_gomp.tgz -P /tmp/ \ |
| 50 | + && tar zxf /tmp/dnnl_lnx_1.1.0_cpu_gomp.tgz -C /tmp/ \ |
| 51 | + && cp -r -H /tmp/dnnl_lnx_1.1.0_cpu_gomp/lib/lib* /usr/local/lib/ \ |
| 52 | + && cp -r -H /tmp/dnnl_lnx_1.1.0_cpu_gomp/include/* /usr/local/include/ \ |
| 53 | + && rm -rf /tmp/dnnl_lnx_1.1.0_cpu_gomp |
| 54 | +# ENV DNNL_ROOT /root/dnnl_lnx_1.1.0_cpu_gomp/ |
| 55 | + |
| 56 | +# install swig into /usr/local/bin |
| 57 | +RUN wget http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz -P /tmp/ \ |
| 58 | + && tar zxf /tmp/swig-3.0.12.tar.gz -C /tmp/ \ |
| 59 | + && cd /tmp/swig-3.0.12 && ./configure && make && make install && cd .. && rm -rf swig-3.0.12 |
| 60 | + |
| 61 | +# numpy and python versions should be matched; |
| 62 | +# twine works for all python versions |
| 63 | +RUN /opt/python/cp39-cp39/bin/pip install numpy twine |
| 64 | +RUN /opt/python/cp310-cp310/bin/pip install numpy |
| 65 | +RUN /opt/python/cp311-cp311/bin/pip install numpy |
| 66 | + |
| 67 | +# install cuda and cudnn |
| 68 | +# Refer to https://gitlab.com/nvidia/container-images/cuda/-/tree/master/dist for other cuda and cudnn versions |
| 69 | +# 10.2-base-centos7 |
| 70 | +RUN NVIDIA_GPGKEY_SUM=d0664fbbdb8c32356d45de36c5984617217b2d0bef41b93ccecd326ba3b80c87 && \ |
| 71 | + curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/D42D0685.pub | sed '/^Version/d' > /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA && \ |
| 72 | + echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict - |
| 73 | +COPY cuda.repo /etc/yum.repos.d/cuda.repo |
| 74 | +ENV CUDA_VERSION 10.2.89 |
| 75 | +ENV CUDA_PKG_VERSION 10-2-$CUDA_VERSION-1 |
| 76 | +# For libraries in the cuda-compat-* package: https://docs.nvidia.com/cuda/eula/index.html#attachment-a |
| 77 | +RUN yum install -y \ |
| 78 | + cuda-cudart-$CUDA_PKG_VERSION \ |
| 79 | + cuda-compat-10-2 \ |
| 80 | + && ln -s cuda-10.2 /usr/local/cuda && \ |
| 81 | + rm -rf /var/cache/yum/* |
| 82 | + |
| 83 | +# nvidia-docker 1.0 |
| 84 | +RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \ |
| 85 | + echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf |
| 86 | +ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH} |
| 87 | +ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64:$LD_LIBRARY_PATH |
| 88 | + |
| 89 | +# nvidia-container-runtime |
| 90 | +ENV NVIDIA_VISIBLE_DEVICES all |
| 91 | +ENV NVIDIA_DRIVER_CAPABILITIES compute,utility |
| 92 | +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" |
| 93 | + |
| 94 | +# 10.2-runtime-centos7 |
| 95 | +RUN yum install -y \ |
| 96 | + cuda-libraries-$CUDA_PKG_VERSION \ |
| 97 | + cuda-nvtx-$CUDA_PKG_VERSION \ |
| 98 | + libcublas10-10.2.2.89-1 \ |
| 99 | + && rm -rf /var/cache/yum/* |
| 100 | + |
| 101 | +# 10.2-devel-centos7 |
| 102 | +RUN yum install -y \ |
| 103 | + cuda-nvml-dev-$CUDA_PKG_VERSION \ |
| 104 | + cuda-command-line-tools-$CUDA_PKG_VERSION \ |
| 105 | + cuda-cudart-dev-$CUDA_PKG_VERSION \ |
| 106 | + cuda-libraries-dev-$CUDA_PKG_VERSION \ |
| 107 | + cuda-minimal-build-$CUDA_PKG_VERSION \ |
| 108 | + && rm -rf /var/cache/yum/* |
| 109 | +RUN yum install -y xz && NCCL_DOWNLOAD_SUM=a9ee790c3fc64b0ecbb00db92eddc1525552eda10a8656ff4b7380f66d81bda1 && \ |
| 110 | + curl -fsSL https://developer.download.nvidia.com/compute/redist/nccl/v2.7/nccl_2.7.3-1+cuda10.2_x86_64.txz -O && \ |
| 111 | + echo "$NCCL_DOWNLOAD_SUM nccl_2.7.3-1+cuda10.2_x86_64.txz" | sha256sum -c - && \ |
| 112 | + unxz nccl_2.7.3-1+cuda10.2_x86_64.txz && \ |
| 113 | + # 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/*' && \ |
| 114 | + tar --no-same-owner --keep-old-files -xvf nccl_2.7.3-1+cuda10.2_x86_64.tar -C /usr/local/cuda/include/ --strip-components=2 --wildcards '*/include/*' && \ |
| 115 | + # 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' && \ |
| 116 | + tar --no-same-owner --keep-old-files -xvf nccl_2.7.3-1+cuda10.2_x86_64.tar -C /usr/local/cuda/lib64/ --strip-components=2 --wildcards '*/lib/libnccl.so' && \ |
| 117 | + |
| 118 | + rm -f nccl_2.7.3-1+cuda10.2_x86_64.tar && \ |
| 119 | + ldconfig |
| 120 | +ENV LIBRARY_PATH /usr/local/cuda/lib64/stubs |
| 121 | + |
| 122 | +# 10.2-cudnn7-devel-centos7 |
| 123 | +ENV CUDNN_VERSION 7.6.5.32 |
| 124 | +# cuDNN license: https://developer.nvidia.com/cudnn/license_agreement |
| 125 | +RUN CUDNN_DOWNLOAD_SUM=600267f2caaed2fd58eb214ba669d8ea35f396a7d19b94822e6b36f9f7088c20 && \ |
| 126 | + curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v7.6.5/cudnn-10.2-linux-x64-v7.6.5.32.tgz -O && \ |
| 127 | + echo "$CUDNN_DOWNLOAD_SUM cudnn-10.2-linux-x64-v7.6.5.32.tgz" | sha256sum -c - && \ |
| 128 | + tar --no-same-owner -xzf cudnn-10.2-linux-x64-v7.6.5.32.tgz -C /usr/local && \ |
| 129 | + rm cudnn-10.2-linux-x64-v7.6.5.32.tgz && \ |
| 130 | + ldconfig |
| 131 | + |
| 132 | +# install gcc-8.5.0 for nccl |
| 133 | +RUN dnf install gcc |
| 134 | +ENV PATH /usr/bin:$PATH |
| 135 | +RUN gcc --version |
| 136 | + |
| 137 | +# install nccl for distributed training |
| 138 | +RUN git clone https://github.com/NVIDIA/nccl.git $HOME/nccl \ |
| 139 | + && cd $HOME/nccl \ |
| 140 | + && git checkout v2.4.8-1 \ |
| 141 | + && make BUILDDIR=/usr/local/ -j$(nproc) src.build \ |
| 142 | + && rm -rf /usr/local/obj \ |
| 143 | + && rm -rf $HOME/nccl |
| 144 | + |
| 145 | +# install cnmem to /usr/local/include /usr/local/lib |
| 146 | +RUN git clone https://github.com/NVIDIA/cnmem.git cnmem \ |
| 147 | + && cd cnmem && mkdir build && cd build && cmake .. && make && make install && cd ../.. && rm -rf cnmem |
| 148 | + |
| 149 | +# install mpich /usr/local/include /usr/local/lib |
| 150 | +RUN wget http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz -P $HOME \ |
| 151 | + && cd $HOME \ |
| 152 | + && tar xfz mpich-3.3.2.tar.gz \ |
| 153 | + && cd mpich-3.3.2 \ |
| 154 | + && ./configure --prefix=/usr/local --disable-fortran \ |
| 155 | + && make && make install && cd .. && rm -rf mpich-3.3.2 |
0 commit comments