Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: Add Omnitrace and Omniperf to Dockerfile.amd #2032

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 65 additions & 6 deletions docker/Dockerfile.amd
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
##############################################################
# This Dockerfile contains AMD compilers
##############################################################
####################################################################################
# This Dockerfile contains the AMD ROCm SDK as well as other useful tools for Devito
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as well as AMD profiling tools (Omnitrace, Omniperf) useful to Devito... or something like this...

####################################################################################
ARG arch="aomp"
ARG ROCM_VERSION=5.1.3

FROM rocm/dev-ubuntu-20.04:${ROCM_VERSION}-complete
########################################################################
# Build base image with apt setup and common env
########################################################################
FROM rocm/dev-ubuntu-20.04:${ROCM_VERSION}-complete as sdk-base

ENV DEBIAN_FRONTEND noninteractive

ARG ROCM_VERSION
ENV rocm=/opt/rocm-${ROCM_VERSION}
ENV AOMP=/opt/rocm-${ROCM_VERSION}/llvm

# Bring in cmake3.19 apt repo
georgebisbas marked this conversation as resolved.
Show resolved Hide resolved
RUN apt-get update && \
apt-get install -y wget software-properties-common && \
wget https://apt.kitware.com/keys/kitware-archive-latest.asc && \
apt-key add kitware-archive-latest.asc && \
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'

# Some utils needed
RUN apt-get update && apt-get install -y wget git autoconf dh-autoreconf flex python3-venv python3-dev vim libnuma1 tmux
# * lmod required to source Omniperf via `module use`
RUN apt-get update && \
apt-get install -y git autoconf dh-autoreconf flex \
python3-venv python3-dev vim lmod cmake libnuma1 tmux

# MongoDB utils is ultimately used by Omniperf
RUN wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-x86_64-100.6.1.deb && \
apt install ./mongodb-database-tools-ubuntu2004-x86_64-100.6.1.deb

# Install tmpi
RUN curl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /usr/local/bin/tmpi
Expand Down Expand Up @@ -45,11 +63,52 @@ ENV PATH=${PATH}:/opt/openmpi/bin:$AOMP/bin
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/openmpi/lib:$AOMP/lib
ENV OMPI_CC=$AOMP/bin/clang

# Devito env
# Install Omnitrace, an AMDResearch profiling tool akin to Nvidia's Nsight-systems
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would drop akin to....

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omniperf is very similar to Nsight-Compute but the capabilities of Omnitrace far exceed the capabilities of Nsight-Systems. Intel's VTune is closer analogue.

ENV OMNITRACE_DIR=/opt/omnitrace
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 && \
chmod +x omnitrace-1.7.3-ubuntu-20.04-ROCm-50100-PAPI-OMPT-Python3.sh && \
mkdir -p ${OMNITRACE_DIR} && \
./omnitrace-1.7.3-ubuntu-20.04-ROCm-50100-PAPI-OMPT-Python3.sh --prefix=${OMNITRACE_DIR} --exclude-subdir --skip-license && \
rm omnitrace-1.7.3-ubuntu-20.04-ROCm-50100-PAPI-OMPT-Python3.sh

# Install Omniperf, an AMDResearch profiling tool akin to Nvidia's Nsight-compute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

ENV OMNIPERF_DIR=/opt/omniperf
RUN wget https://github.com/AMDResearch/omniperf/releases/download/v1.0.4/omniperf-1.0.4.tar.gz -q
RUN tar xfz omniperf-1.0.4.tar.gz && \
cd omniperf-1.0.4/ && \
mkdir -p ${OMNIPERF_DIR} && \
python3 -m pip install -t ${OMNIPERF_DIR}/python-libs -r requirements.txt && \
mkdir build && cd build/ && \
cmake -DCMAKE_INSTALL_PREFIX=${OMNIPERF_DIR}/1.0.4 -DPYTHON_DEPS=${OMNIPERF_DIR}/python-libs -DMOD_INSTALL_PATH=${OMNIPERF_DIR}/modulefiles .. && \
make install && \
rm -rf omniperf-1.0.4.tar.gz omniperf-1.0.4/
ENV PYTHONPATH ${OMNIPERF_DIR}/python-libs:${PYTHONPATH}

# This will only trigger if arch is aomp since the final stage depends on it
georgebisbas marked this conversation as resolved.
Show resolved Hide resolved
########################################################################
# AOMP for GPUs via OpenMP config
########################################################################
FROM sdk-base as aomp

FabioLuporini marked this conversation as resolved.
Show resolved Hide resolved
ENV DEVITO_ARCH="aomp"
ENV DEVITO_PLATFORM="amdgpuX"
ENV DEVITO_LANGUAGE="openmp"

# This will only trigger if arch is hip since the final stage depends on it
georgebisbas marked this conversation as resolved.
Show resolved Hide resolved
########################################################################
# HIPCC for GPUs via HIP config
########################################################################
FROM sdk-base as hip

ENV DEVITO_ARCH="hip"
ENV DEVITO_PLATFORM="amdgpuX"
ENV DEVITO_LANGUAGE="hip"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be added to the cron CI?

Also maybe a line in the Readme that it's an option now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can and should add it to the cron jobs, I agree.

We shouldn't isntead write anything in the README until support is complete. This is to be regarded as a dev utility for now


########################################################################
# Final image
########################################################################
FROM ${arch} as final

RUN apt-get clean && apt-get autoclean && apt-get autoremove && \
rm -rf /var/lib/apt/lists/*

Expand Down
11 changes: 10 additions & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ if [[ "$MPIVER" = "HPCX" ]]; then
hpcx_load
fi

if [[ -n "${ROCM_VERSION}" ]]; then
source /usr/share/lmod/lmod/init/profile
echo "configuring Omnitrace..."
module use /opt/omnitrace/share/modulefiles
echo "configuring Omniperf..."
module use /opt/omniperf/modulefiles
module load omniperf
fi

if [[ -z "${DEPLOY_ENV}" ]]; then
exec "$@"
./codecov -t -t ${CODECOV_TOKEN} -F "${DEVITO_ARCH}-${DEVITO-PLATFORM}"
else
exec "$@"
fi
fi