Skip to content

Commit d4e9dc3

Browse files
committed
misc: Patch Omniperf install in Dockerfile.amd
1 parent d1a6194 commit d4e9dc3

File tree

2 files changed

+57
-22
lines changed

2 files changed

+57
-22
lines changed

docker/Dockerfile.amd

+49-15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
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"
45
ARG ROCM_VERSION=5.1.3
56

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
711

812
ENV DEBIAN_FRONTEND noninteractive
913

@@ -12,16 +16,21 @@ ENV rocm=/opt/rocm-${ROCM_VERSION}
1216
ENV AOMP=/opt/rocm-${ROCM_VERSION}/llvm
1317

1418
# 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'
1724

1825
# Some utils needed
1926
# * 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
2127
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
2534

2635
# Install tmpi
2736
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
5564
ENV OMPI_CC=$AOMP/bin/clang
5665

5766
# 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 && \
6072
rm omnitrace-1.7.3-ubuntu-20.04-ROCm-50100-PAPI-OMPT-Python3.sh
6173

6274
# Install Omniperf, an AMDResearch profiling tool akin to Nvidia's Nsight-compute
63-
ENV OMNIPERF_DIR=/app/omniperf
75+
ENV OMNIPERF_DIR=/opt/omniperf
6476
RUN wget https://github.com/AMDResearch/omniperf/releases/download/v1.0.4/omniperf-1.0.4.tar.gz -q
6577
RUN tar xfz omniperf-1.0.4.tar.gz && \
6678
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 && \
6881
mkdir build && cd build/ && \
6982
cmake -DCMAKE_INSTALL_PREFIX=${OMNIPERF_DIR}/1.0.4 -DPYTHON_DEPS=${OMNIPERF_DIR}/python-libs -DMOD_INSTALL_PATH=${OMNIPERF_DIR}/modulefiles .. && \
7083
make install && \
7184
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
7292

73-
# Devito env
7493
ENV DEVITO_ARCH="aomp"
7594
ENV DEVITO_PLATFORM="amdgpuX"
7695
ENV DEVITO_LANGUAGE="openmp"
7796

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+
78112
RUN apt-get clean && apt-get autoclean && apt-get autoremove && \
79113
rm -rf /var/lib/apt/lists/*
80114

docker/entrypoint.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ if [[ "$MPIVER" = "HPCX" ]]; then
88
hpcx_load
99
fi
1010

11-
if [[ -z "${DEPLOY_ENV}" ]]; then
12-
exec "$@"
13-
./codecov -t -t ${CODECOV_TOKEN} -F "${DEVITO_ARCH}-${DEVITO-PLATFORM}"
14-
else
15-
exec "$@"
16-
fi
17-
1811
if [[ -n "${ROCM_VERSION}" ]]; then
12+
source /usr/share/lmod/lmod/init/profile
1913
echo "configuring Omnitrace..."
2014
module use /opt/omnitrace/share/modulefiles
2115
echo "configuring Omniperf..."
2216
module use /opt/omniperf/modulefiles
2317
module load omniperf
2418
fi
19+
20+
if [[ -z "${DEPLOY_ENV}" ]]; then
21+
exec "$@"
22+
./codecov -t -t ${CODECOV_TOKEN} -F "${DEVITO_ARCH}-${DEVITO-PLATFORM}"
23+
else
24+
exec "$@"
25+
fi

0 commit comments

Comments
 (0)