-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile-gpu
More file actions
139 lines (109 loc) · 5.7 KB
/
Dockerfile-gpu
File metadata and controls
139 lines (109 loc) · 5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Base image
FROM nvidia/cuda:11.2.2-devel-ubuntu20.04
# Defined only while building
ARG DEBIAN_FRONTEND=noninteractive
# TZ Data available at runtime
ENV TZ="America/New_York"
# Will make python ignore some warnings for docker
ENV PYTHONUNBUFFERED=1
# Clang version
ENV CLANG_VERSION="7"
ENV LLD_VERSION="7"
# OpenMPI
ENV OPENMPI_VERSION="4.1"
ENV OPENMPI_MINOR_VERSION="2"
# CMake
ENV CMAKE_VERSION="3.30.5"
# OpenCL™ 2.0 Driver for Intel® HD, Iris™, and Iris™ Pro Graphics for Linux* (64-bit)
ENV INTEL_DRIVER_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/15532/l_opencl_p_18.1.0.015.tgz
# Intel® SDK for OpenCL™ Applications 2016 R2 for Linux* (64 bit)
ENV INTEL_SDK_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/17206/intel_sdk_for_opencl_applications_2020.3.494.tar.gz
# Install os dependencies and pip3
RUN apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/* && update-ca-certificates && apt-get update -y
RUN apt-get install nano alien bash dpkg git make curl wget cmake autoconf vim automake python3 python3-pip build-essential libssl-dev -y
RUN apt-get install nvidia-driver-460 cuda-drivers-460 intel-opencl-icd nvidia-cuda-toolkit opencl-headers clinfo -y
RUN apt-get install binutils clang-format clang-${CLANG_VERSION} clang++-${CLANG_VERSION} gcc lld-${LLD_VERSION} lld -y
RUN apt-get install libxml2-dev linux-headers-generic libopenmpi-dev libxslt-dev mpi mpich -y
RUN ln -sf python3 /usr/bin/python
# Install doxygen
RUN wget https://www.doxygen.nl/files/doxygen-1.9.7.linux.bin.tar.gz \
&& tar -xzvf doxygen-1.9.7.linux.bin.tar.gz \
&& cp doxygen-1.9.7/bin/doxygen /bin/
RUN chmod +x /bin/doxygen
# Setup pip and requirements
RUN pip3 install --no-cache --upgrade pip setuptools
RUN pip3 install --no-cache cpplint
RUN ln -sf /usr/bin/clang /usr/bin/cc
RUN ln -sf /usr/bin/clang++ /usr/bin/c++
RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 10
RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 10
RUN update-alternatives --install /usr/bin/ld ld /usr/bin/lld 10
# Use python3 instead of python(2)
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
RUN update-alternatives --auto cc
RUN update-alternatives --auto c++
RUN update-alternatives --auto ld
WORKDIR /home/
## OpenMPI
RUN wget https://download.open-mpi.org/release/open-mpi/v${OPENMPI_VERSION}/openmpi-${OPENMPI_VERSION}.${OPENMPI_MINOR_VERSION}.tar.gz
RUN tar xzvf openmpi-${OPENMPI_VERSION}.${OPENMPI_MINOR_VERSION}.tar.gz
WORKDIR openmpi-${OPENMPI_VERSION}.${OPENMPI_MINOR_VERSION}
## Configure and install
RUN ./configure CFLAGS=-O3 CXXFLAGS=-O3 --sysconfdir=/mnt/0 --prefix=/opt/openmpi --disable-silent-rules --enable-mpi-cxx --with-devel-headers --enable-binaries
RUN make -j12
RUN make install
RUN ldconfig
# Fix for: Cannot open configuration file /usr/share/openmpi/share/openmpi/mpicxx.openmpi-wrapper-data.txt
# Error parsing data file mpicxx.openmpi: Not found
# See: http://www.open-mpi.org/faq/?category=building#installdirs
ENV OPAL_PREFIX="/opt/openmpi"
ENV PATH="$PATH:/opt/openmpi/bin"
ENV LD_LIBRARY_PATH="/opt/openmpi/lib"
# export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/openmpi/lib:/usr/lib:/usr/lib/x86_64-linux-gnu"
WORKDIR /opt/openmpi/share/openmpi
RUN ln -s mpiCC-wrapper-data.txt mpiCC.openmpi-wrapper-data.txt
RUN ln -s mpic++-wrapper-data.txt mpic++.openmpi-wrapper-data.txt
RUN ln -s mpicc-wrapper-data.txt mpicc.openmpi-wrapper-data.txt
RUN ln -s mpicxx-wrapper-data.txt mpicxx.openmpi-wrapper-data.txt
RUN ln -s mpicxx-wrapper-data.txt mpif77.openmpi-wrapper-data.txt
RUN ln -s mpif90-wrapper-data.txt mpif90.openmpi-wrapper-data.txt
# Print version information
RUN mpicc -show
RUN mpiexec --version
RUN mpicxx.openmpi --version
# Run MPI hello.c test
WORKDIR /home/
RUN mkdir OpenMPi
WORKDIR /home/OpenMPi
RUN wget https://www.open-mpi.org/papers/workshop-2006/hello.c
RUN mpicc hello.c -o hello
RUN mpirun --allow-run-as-root -np 4 ./hello
WORKDIR /tmp
RUN wget https://github.com/intel/compute-runtime/releases/download/22.09.22577/intel-gmmlib_22.0.2_amd64.deb
RUN wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.10409/intel-igc-core_1.0.10409_amd64.deb
RUN wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.10409/intel-igc-opencl_1.0.10409_amd64.deb
RUN wget https://github.com/intel/compute-runtime/releases/download/22.09.22577/intel-opencl-icd_22.09.22577_amd64.deb
RUN wget https://github.com/intel/compute-runtime/releases/download/22.09.22577/intel-level-zero-gpu_1.3.22577_amd64.deb
RUN dpkg -i *.deb
RUN echo 'ACCEPT_EULA=accept \n\
ACTIVATION_TYPE=no_license \n\
INSTALL_MODE=NONRPM \n\
CONTINUE_WITH_OPTIONAL_ERROR=yes \n\
PSET_INSTALL_DIR=/opt \n\
CONTINUE_WITH_INSTALLDIR_OVERWRITE=yes \n\
COMPONENTS=DEFAULTS \n\
PSET_MODE=install' > silent_install.cfg
# RUN wget ${INTEL_SDK_URL}
# Install SDK
# Intel® SDK for OpenCL™ applications is not being mantained anymore and has been discontinued by Intel
# They recommend using: https://github.com/intel/compute-runtime/releases
# We're almost certain it's not used anymore so we will try without!
#RUN TARBALL=$(basename ${INTEL_SDK_URL}) \
# && DIR=$(basename ${INTEL_SDK_URL} .tar.gz) \
# && tar zxvf ${TARBALL} \
# && cd ${DIR} && ./install.sh --silent ../silent_install.cfg
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz
RUN tar -zxvf cmake-${CMAKE_VERSION}.tar.gz
RUN cd cmake-${CMAKE_VERSION} && ./bootstrap && make && sudo make install && cmake --version
# Set our working directory
WORKDIR /workdir