1- FROM nvidia/cuda:11.2.2-devel-ubuntu20.04
2-
3- RUN apt-get update && \
4- DEBIAN_FRONTEND=noninteractive apt-get install -y \
5- libcudnn8 \
6- python3-appdirs \
7- python3-mako \
8- python3-numpy \
9- python3-pytest \
10- python3-pytest-cov \
11- python3-pytools \
12- python3-pip \
13- python3-venv \
14- python3-yaml \
15- curl \
16- && \
17- apt-get autoremove --purge -y && \
18- apt-get autoclean -y && \
19- rm -rf /var/cache/apt/* /var/lib/apt/lists/*
20-
21- RUN pip3 install \
22- scipy \
23- configparser \
24- torchvision \
25- scikit-cuda \
26- cupy \
27- 'tensorflow-gpu>=2.0.0a0' \
28- scikit-learn
1+ # Base image
2+ FROM nvidia/cuda:11.2.2-devel-ubuntu20.04
3+
4+ # Defined only while building
5+ ARG DEBIAN_FRONTEND=noninteractive
6+
7+ # TZ Data available at runtime
8+ ENV TZ="America/New_York"
9+ # Will make python ignore some warnings for docker
10+ ENV PYTHONUNBUFFERED=1
11+ # Clang version
12+ ENV CLANG_VERSION="6.0"
13+
14+ # OpenMPI
15+ ENV OPENMPI_VERSION="4.1"
16+ ENV OPENMPI_MINOR_VERSION="2"
17+
18+ # /usr/local/sbin:/usr/local/.openmpi/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
19+
20+ # https://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/15532/l_opencl_p_18.1.0.015.tgz
21+
22+ # OpenCL™ 2.0 Driver for Intel® HD, Iris™, and Iris™ Pro Graphics for Linux* (64-bit)
23+ ENV INTEL_DRIVER_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/15532/l_opencl_p_18.1.0.015.tgz
24+ # Intel® SDK for OpenCL™ Applications 2016 R2 for Linux* (64 bit)
25+ ENV INTEL_SDK_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/17206/intel_sdk_for_opencl_applications_2020.3.494.tar.gz
26+
27+ # Install os dependencies and pip3
28+ RUN apt-get update -y
29+ RUN apt-get install nano alien bash dpkg git make curl wget cmake autoconf vim automake python3 python3-pip -y
30+ RUN apt-get install nvidia-driver-460 cuda-drivers-460 intel-opencl-icd nvidia-cuda-toolkit opencl-headers clinfo -y
31+ RUN apt-get install doxygen binutils clang-format clang-${CLANG_VERSION} clang++-${CLANG_VERSION} gcc lld-${CLANG_VERSION} lld -y
32+ RUN apt-get install libxml2-dev linux-headers-generic libopenmpi-dev libxslt-dev mpi mpich -y
33+ RUN ln -sf python3 /usr/bin/python
34+
35+ # mpi mpich openmpi-common libopenmpi-dev openmpi-bin nvidia-cuda-toolkit
36+
37+ # Setup pip and requirements
38+ RUN pip3 install --no-cache --upgrade pip setuptools
39+ RUN pip3 install --no-cache cpplint
40+
41+ RUN ln -sf /usr/bin/clang /usr/bin/cc
42+ RUN ln -sf /usr/bin/clang++ /usr/bin/c++
43+
44+ RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 10
45+ RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 10
46+ RUN update-alternatives --install /usr/bin/ld ld /usr/bin/lld 10
47+
48+ # Use python3 instead of python(2)
49+ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
50+
51+ RUN update-alternatives --auto cc
52+ RUN update-alternatives --auto c++
53+ RUN update-alternatives --auto ld
54+
55+ WORKDIR /home/
56+
57+ ## OpenMPI
58+ RUN wget https://download.open-mpi.org/release/open-mpi/v${OPENMPI_VERSION}/openmpi-${OPENMPI_VERSION}.${OPENMPI_MINOR_VERSION}.tar.gz
59+ RUN tar xzvf openmpi-${OPENMPI_VERSION}.${OPENMPI_MINOR_VERSION}.tar.gz
60+
61+ WORKDIR openmpi-${OPENMPI_VERSION}.${OPENMPI_MINOR_VERSION}
62+
63+ ## Configure and install
64+ RUN ./configure CFLAGS=-O3 CXXFLAGS=-O3 --sysconfdir=/mnt/0 --prefix=/opt/openmpi --disable-silent-rules --enable-mpi-cxx --with-devel-headers --enable-binaries
65+ RUN make -j12
66+ RUN make install
67+ RUN ldconfig
68+
69+ # Fix for: Cannot open configuration file /usr/share/openmpi/share/openmpi/mpicxx.openmpi-wrapper-data.txt
70+ # Error parsing data file mpicxx.openmpi: Not found
71+ # See: http://www.open-mpi.org/faq/?category=building#installdirs
72+ ENV OPAL_PREFIX="/opt/openmpi"
73+ ENV PATH="$PATH:/opt/openmpi/bin"
74+ ENV LD_LIBRARY_PATH="/opt/openmpi/lib"
75+ # export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/openmpi/lib:/usr/lib:/usr/lib/x86_64-linux-gnu"
76+
77+ WORKDIR /opt/openmpi/share/openmpi
78+
79+ RUN ln -s mpiCC-wrapper-data.txt mpiCC.openmpi-wrapper-data.txt
80+ RUN ln -s mpic++-wrapper-data.txt mpic++.openmpi-wrapper-data.txt
81+ RUN ln -s mpicc-wrapper-data.txt mpicc.openmpi-wrapper-data.txt
82+ RUN ln -s mpicxx-wrapper-data.txt mpicxx.openmpi-wrapper-data.txt
83+ RUN ln -s mpicxx-wrapper-data.txt mpif77.openmpi-wrapper-data.txt
84+ RUN ln -s mpif90-wrapper-data.txt mpif90.openmpi-wrapper-data.txt
85+
86+ # Print version information
87+ RUN mpicc -show
88+ RUN mpiexec --version
89+ RUN mpicxx.openmpi --version
90+
91+ # Run MPI hello.c test
92+ WORKDIR /home/
93+ RUN mkdir OpenMPi
94+ WORKDIR /home/OpenMPi
95+
96+ RUN wget https://www.open-mpi.org/papers/workshop-2006/hello.c
97+ RUN mpicc hello.c -o hello
98+ RUN mpirun --allow-run-as-root -np 4 ./hello
99+
100+ WORKDIR /tmp
101+
102+ RUN wget https://github.com/intel/compute-runtime/releases/download/22.09.22577/intel-gmmlib_22.0.2_amd64.deb
103+ RUN wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.10409/intel-igc-core_1.0.10409_amd64.deb
104+ RUN wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.10409/intel-igc-opencl_1.0.10409_amd64.deb
105+ RUN wget https://github.com/intel/compute-runtime/releases/download/22.09.22577/intel-opencl-icd_22.09.22577_amd64.deb
106+ RUN wget https://github.com/intel/compute-runtime/releases/download/22.09.22577/intel-level-zero-gpu_1.3.22577_amd64.deb
107+
108+ RUN dpkg -i *.deb
109+
110+ RUN echo 'ACCEPT_EULA=accept \n\
111+ ACTIVATION_TYPE=no_license \n\
112+ INSTALL_MODE=NONRPM \n\
113+ CONTINUE_WITH_OPTIONAL_ERROR=yes \n\
114+ PSET_INSTALL_DIR=/opt \n\
115+ CONTINUE_WITH_INSTALLDIR_OVERWRITE=yes \n\
116+ COMPONENTS=DEFAULTS \n\
117+ PSET_MODE=install' > silent_install.cfg
118+
119+ RUN wget ${INTEL_SDK_URL}
120+
121+ # Install SDK
122+ RUN TARBALL=$(basename ${INTEL_SDK_URL}) \
123+ && DIR=$(basename ${INTEL_SDK_URL} .tar.gz) \
124+ && tar zxvf ${TARBALL} \
125+ && cd ${DIR} && ./install.sh --silent ../silent_install.cfg
126+
127+ # Set our working directory
128+ WORKDIR /workdir
0 commit comments