1
- ##############################################################
2
- # This Dockerfile contains AMD compilers
3
- ##############################################################
1
+ ####################################################################################
2
+ # This Dockerfile contains the AMD ROCm SDK as well as other useful tools for Devito
3
+ ####################################################################################
4
+ ARG arch="aomp"
4
5
ARG ROCM_VERSION=5.1.3
5
6
6
- FROM rocm/dev-ubuntu-20.04:${ROCM_VERSION}-complete
7
+ ########################################################################
8
+ # Build base image with apt setup and common env
9
+ ########################################################################
10
+ FROM rocm/dev-ubuntu-20.04:${ROCM_VERSION}-complete as sdk-base
7
11
8
12
ENV DEBIAN_FRONTEND noninteractive
9
13
@@ -12,16 +16,21 @@ ENV rocm=/opt/rocm-${ROCM_VERSION}
12
16
ENV AOMP=/opt/rocm-${ROCM_VERSION}/llvm
13
17
14
18
# Bring in cmake3.19 apt repo
15
- RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - && \
16
- apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' && \
19
+ RUN apt-get update && \
20
+ apt-get install -y wget software-properties-common && \
21
+ wget https://apt.kitware.com/keys/kitware-archive-latest.asc && \
22
+ apt-key add kitware-archive-latest.asc && \
23
+ apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
17
24
18
25
# Some utils needed
19
26
# * lmod required to source Omniperf via `module use`
20
- # * software-properties-common required to compile cmake3.19, which in turn is required to compile Omniperf
21
27
RUN apt-get update && \
22
- apt-get install -y wget git autoconf dh-autoreconf \
23
- flex python3-venv python3-dev vim lmod \
24
- software-properties-common cmake libnuma1 tmux
28
+ apt-get install -y git autoconf dh-autoreconf flex \
29
+ python3-venv python3-dev vim lmod cmake libnuma1 tmux
30
+
31
+ # MongoDB utils is ultimately used by Omniperf
32
+ RUN wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-x86_64-100.6.1.deb && \
33
+ apt install ./mongodb-database-tools-ubuntu2004-x86_64-100.6.1.deb
25
34
26
35
# Install tmpi
27
36
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi
@@ -55,26 +64,51 @@ ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/openmpi/lib:$AOMP/lib
55
64
ENV OMPI_CC=$AOMP/bin/clang
56
65
57
66
# Install Omnitrace, an AMDResearch profiling tool akin to Nvidia's Nsight-systems
58
- RUN wget https://github.com/AMDResearch/omnitrace/releases/download/v1.7.3/omnitrace-1.7.3-ubuntu-20.04-ROCm-50100-PAPI-OMPT-Python3.sh -q
59
- RUN ./omnitrace-1.7.3-ubuntu-20.04-ROCm-50100-PAPI-OMPT-Python3.sh --prefix=/opt/omnitrace --exclude-subdir --skip-license && \
67
+ ENV OMNITRACE_DIR=/opt/omnitrace
68
+ RUN wget https://github.com/AMDResearch/omnitrace/releases/download/v1.7.3/omnitrace-1.7.3-ubuntu-20.04-ROCm-50100-PAPI-OMPT-Python3.sh -q && \
69
+ chmod +x omnitrace-1.7.3-ubuntu-20.04-ROCm-50100-PAPI-OMPT-Python3.sh && \
70
+ mkdir -p ${OMNITRACE_DIR} && \
71
+ ./omnitrace-1.7.3-ubuntu-20.04-ROCm-50100-PAPI-OMPT-Python3.sh --prefix=${OMNITRACE_DIR} --exclude-subdir --skip-license && \
60
72
rm omnitrace-1.7.3-ubuntu-20.04-ROCm-50100-PAPI-OMPT-Python3.sh
61
73
62
74
# Install Omniperf, an AMDResearch profiling tool akin to Nvidia's Nsight-compute
63
- ENV OMNIPERF_DIR=/app /omniperf
75
+ ENV OMNIPERF_DIR=/opt /omniperf
64
76
RUN wget https://github.com/AMDResearch/omniperf/releases/download/v1.0.4/omniperf-1.0.4.tar.gz -q
65
77
RUN tar xfz omniperf-1.0.4.tar.gz && \
66
78
cd omniperf-1.0.4/ && \
67
- /venv/bin/pip install --no-cache-dir -r requirements.txt && \
79
+ mkdir -p ${OMNIPERF_DIR} && \
80
+ python3 -m pip install -t ${OMNIPERF_DIR}/python-libs -r requirements.txt && \
68
81
mkdir build && cd build/ && \
69
82
cmake -DCMAKE_INSTALL_PREFIX=${OMNIPERF_DIR}/1.0.4 -DPYTHON_DEPS=${OMNIPERF_DIR}/python-libs -DMOD_INSTALL_PATH=${OMNIPERF_DIR}/modulefiles .. && \
70
83
make install && \
71
84
rm -rf omniperf-1.0.4.tar.gz omniperf-1.0.4/
85
+ ENV PYTHONPATH ${OMNIPERF_DIR}/python-libs:${PYTHONPATH}
86
+
87
+ # This will only trigger if arch is aomp since the final stage depends on it
88
+ ########################################################################
89
+ # AOMP for GPUs via OpenMP config
90
+ ########################################################################
91
+ FROM sdk-base as aomp
72
92
73
- # Devito env
74
93
ENV DEVITO_ARCH="aomp"
75
94
ENV DEVITO_PLATFORM="amdgpuX"
76
95
ENV DEVITO_LANGUAGE="openmp"
77
96
97
+ # This will only trigger if arch is hip since the final stage depends on it
98
+ ########################################################################
99
+ # HIPCC for GPUs via HIP config
100
+ ########################################################################
101
+ FROM sdk-base as hip
102
+
103
+ ENV DEVITO_ARCH="hip"
104
+ ENV DEVITO_PLATFORM="amdgpuX"
105
+ ENV DEVITO_LANGUAGE="hip"
106
+
107
+ ########################################################################
108
+ # Final image
109
+ ########################################################################
110
+ FROM ${arch} as final
111
+
78
112
RUN apt-get clean && apt-get autoclean && apt-get autoremove && \
79
113
rm -rf /var/lib/apt/lists/*
80
114
0 commit comments