Skip to content

Commit 56dd197

Browse files
authored
Merge branch 'development' into HaloIC
2 parents af6afc1 + f2d7811 commit 56dd197

224 files changed

Lines changed: 2350 additions & 875 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/azure-pipelines-amdgpu.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pr:
4848
- extern/yaml-cpp/**
4949
- extern/openPMD-api/**
5050
- extern/AMReX-Hydro/**
51+
- extern/turbulence/**
5152
exclude:
5253
- docs/**
5354
- paper/**

.ci/azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pr:
4747
- extern/yaml-cpp/**
4848
- extern/openPMD-api/**
4949
- extern/AMReX-Hydro/**
50+
- extern/turbulence/**
5051
exclude:
5152
- docs/**
5253
- paper/**

.devcontainer/rocm-container/Dockerfile

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,33 @@ RUN if ! zypper repos -E | grep devel_languages_perl; then \
2020
zypper clean --all && \
2121
cat rocm_so.conf >> /etc/ld.so.conf.d/rocm.conf && \
2222
rm rocm_so.conf && \
23-
ldconfig
23+
ldconfig
2424

2525
ENV PATH="/opt/rocm/bin:${PATH}" \
2626
LD_LIBRARY_PATH="/opt/rocm/lib:${LD_LIBRARY_PATH}"
2727

28-
RUN zypper --non-interactive install wget tar gzip gcc gcc-fortran file gcc-c++ make && zypper clean --all && \
28+
COPY mpich-4.1.2-rocm-6.4-hip-pointer-attr.patch /tmp/mpich-4.1.2-rocm-6.4-hip-pointer-attr.patch
29+
30+
RUN zypper --non-interactive install wget tar gzip gcc gcc-fortran file gcc-c++ make patch && zypper clean --all && \
2931
if [ ! -z "$(gcc --version | grep -Eo -m 1 [0-9][0-9]+\.[0-9]+\.[0-9]+ | grep -m 1 [0-9])" ]; then \
3032
export FFLAGS=-fallow-argument-mismatch; \
3133
fi && \
32-
wget --progress=bar:force https://www.mpich.org/static/downloads/3.4.3/mpich-3.4.3.tar.gz && \
33-
tar xzf mpich-3.4.3.tar.gz && \
34-
cd mpich-3.4.3 && \
35-
./configure --with-device=ch4:ofi --prefix=/opt/mpich/3.4.3 --with-hip=/opt/rocm/hip && \
34+
wget --progress=bar:force https://www.mpich.org/static/downloads/4.1.2/mpich-4.1.2.tar.gz && \
35+
tar xzf mpich-4.1.2.tar.gz && \
36+
cd mpich-4.1.2 && \
37+
patch -p1 < /tmp/mpich-4.1.2-rocm-6.4-hip-pointer-attr.patch && \
38+
./configure --with-device=ch4:ofi --prefix=/opt/mpich/4.1.2 && \
3639
make install -j7 && \
3740
cd / && \
38-
rm -rf mpich-3.4.3/ mpich-3.4.3.tar.gz
39-
40-
ENV MPICH_VERSION="3.4.3" \
41-
MPICH_URL="https://www.mpich.org/static/downloads/3.4.3/mpich-3.4.3.tar.gz" \
42-
MPICH_DIR="/opt/mpich/3.4.3" \
43-
PATH="/opt/mpich/3.4.3/bin:$PATH" \
44-
LIBRARY_PATH="/opt/mpich/3.4.3/lib:$LIBRARY_PATH" \
45-
LD_LIBRARY_PATH="/opt/mpich/3.4.3/lib:$LD_LIBRARY_PATH" \
46-
MANPATH="/opt/mpich/3.4.3/share/man:$MANPATH"
41+
rm -rf mpich-4.1.2/ mpich-4.1.2.tar.gz
42+
43+
ENV MPICH_VERSION="4.1.2" \
44+
MPICH_URL="https://www.mpich.org/static/downloads/4.1.2/mpich-4.1.2.tar.gz" \
45+
MPICH_DIR="/opt/mpich/4.1.2" \
46+
PATH="/opt/mpich/4.1.2/bin:$PATH" \
47+
LIBRARY_PATH="/opt/mpich/4.1.2/lib:$LIBRARY_PATH" \
48+
LD_LIBRARY_PATH="/opt/mpich/4.1.2/lib:$LD_LIBRARY_PATH" \
49+
MANPATH="/opt/mpich/4.1.2/share/man:$MANPATH"
4750

4851
# Install CMake
4952
RUN zypper --non-interactive install cmake && zypper clean --all
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/src/mpl/src/gpu/mpl_gpu_hip.c b/src/mpl/src/gpu/mpl_gpu_hip.c
2+
index f6a2df3..b2c5954 100644
3+
--- a/src/mpl/src/gpu/mpl_gpu_hip.c
4+
+++ b/src/mpl/src/gpu/mpl_gpu_hip.c
5+
@@ -90,7 +90,13 @@ int MPL_gpu_query_pointer_attr(const void *ptr, MPL_pointer_attr_t * attr)
6+
hipError_t ret;
7+
ret = hipPointerGetAttributes(&attr->device_attr, ptr);
8+
if (ret == hipSuccess) {
9+
- switch (attr->device_attr.memoryType) {
10+
+#if defined(HIP_VERSION_MAJOR) && (HIP_VERSION_MAJOR >= 6)
11+
+ /* ROCm 6+ uses hipPointerAttribute_t::type */
12+
+ enum hipMemoryType memory_type = attr->device_attr.type;
13+
+#else
14+
+ enum hipMemoryType memory_type = attr->device_attr.memoryType;
15+
+#endif
16+
+ switch (memory_type) {
17+
case hipMemoryTypeHost:
18+
attr->type = MPL_GPU_POINTER_REGISTERED_HOST;
19+
attr->device = attr->device_attr.device;

.dockerignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.git
2+
.gitmodules
3+
.github/workflows/**/node_modules
4+
.vscode
5+
6+
# Local build artifacts
7+
build/
8+
cmake-build-*/
9+
10+
# Large CI/regression assets (not needed for container builds)
11+
tests/
12+
13+
# Developer-facing content (not needed for container builds)
14+
docs/
15+
paper/
16+
scripts/
17+
18+
# OS/editor noise
19+
**/.DS_Store

.github/workflows/check_changes.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_call:
55
inputs:
66
workflow_file:
7-
description: 'Specific workflow file to check for changes (optional)'
7+
description: "Specific workflow file to check for changes (optional)"
88
required: false
99
type: string
1010
outputs:
@@ -35,7 +35,7 @@ jobs:
3535
has_workflow_changes: ${{ steps.set-output.outputs.has_workflow_changes }}
3636
has_specific_workflow_changes: ${{ steps.set-output.outputs.has_specific_workflow_changes }}
3737
steps:
38-
- uses: actions/checkout@v6.0.1
38+
- uses: actions/checkout@v6
3939
- uses: dorny/paths-filter@v3
4040
id: changes
4141
with:
@@ -52,6 +52,7 @@ jobs:
5252
- 'extern/grackle_data_files/**'
5353
- 'extern/openPMD-api/**'
5454
- 'extern/yaml-cpp/**'
55+
- 'extern/turbulence/**'
5556
- 'inputs/**'
5657
- 'CMakeLists.txt'
5758
- '**/*.cpp'

.github/workflows/codeql.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
outputs:
2222
code-changed: ${{ steps.changes.outputs.code }}
2323
steps:
24-
- uses: actions/checkout@v6.0.1
24+
- uses: actions/checkout@v6
2525
- uses: dorny/paths-filter@v3
2626
id: changes
2727
with:
@@ -34,6 +34,7 @@ jobs:
3434
- 'extern/grackle_data_files/**'
3535
- 'extern/openPMD-api/**'
3636
- 'extern/yaml-cpp/**'
37+
- 'extern/turbulence/**'
3738
- 'inputs/**'
3839
- 'CMakeLists.txt'
3940
- '**/*.cpp'
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
FROM --platform=linux/amd64 opensuse/leap:15.6 AS build
2+
3+
ARG ROCM_ZYPP_REPO_VERSION=6.4.2
4+
ARG ROCM_ZYPP_PACKAGES=
5+
ARG MPICH_VERSION=4.1.2
6+
ARG MPICH_URL=https://www.mpich.org/static/downloads/4.1.2/mpich-4.1.2.tar.gz
7+
ARG AMREX_SPACEDIM=3
8+
ARG AMREX_MPI=ON
9+
ARG AMREX_AMD_ARCH=gfx90a
10+
ARG DOCKERFILES_DIR=.github/workflows/dockerfiles/ROCm-DiskGalaxy
11+
12+
# Combine system updates, repo setup, and package installation
13+
RUN set -euo pipefail && \
14+
echo "rpm.install.excludedocs = yes" >> /etc/zypp/zypp.conf && \
15+
zypper --non-interactive refresh && \
16+
zypper --non-interactive update && \
17+
if ! zypper repos -E | grep -q devel_languages_perl; then \
18+
zypper --non-interactive addrepo https://download.opensuse.org/repositories/devel:/languages:/perl/15.6/devel:languages:perl.repo; \
19+
fi && \
20+
printf "[ROCm-%s]\nname=ROCm%s\nbaseurl=https://repo.radeon.com/rocm/zyp/%s/main\nenabled=1\ngpgcheck=1\ngpgkey=https://repo.radeon.com/rocm/rocm.gpg.key\n" \
21+
"${ROCM_ZYPP_REPO_VERSION}" "${ROCM_ZYPP_REPO_VERSION}" "${ROCM_ZYPP_REPO_VERSION}" > /etc/zypp/repos.d/rocm.repo && \
22+
zypper --non-interactive --gpg-auto-import-keys refresh && \
23+
if [ -n "${ROCM_ZYPP_PACKAGES}" ]; then \
24+
zypper --non-interactive install --no-recommends ${ROCM_ZYPP_PACKAGES}; \
25+
else \
26+
zypper --non-interactive install --no-recommends \
27+
rocm-llvm hipcc hip-runtime-amd hip-devel hsa-rocr comgr \
28+
rocm-device-libs rocrand-devel hiprand-devel rocprim-devel rocsparse-devel; \
29+
fi && \
30+
zypper --non-interactive install --no-recommends \
31+
cmake git gcc13 gcc13-c++ libstdc++6-devel-gcc13 \
32+
make tar gzip wget patch hdf5-devel python3-devel && \
33+
ln -sf /usr/lib64/libefa.so.1 /usr/lib64/libefa.so && \
34+
zypper clean --all && \
35+
printf "%s\n" "/opt/rocm/lib" "/opt/rocm/lib64" >> /etc/ld.so.conf.d/rocm.conf && \
36+
ldconfig
37+
38+
ENV PATH="/opt/rocm/bin:${PATH}" \
39+
LD_LIBRARY_PATH="/opt/rocm/lib:${LD_LIBRARY_PATH}" \
40+
ROCM_PATH="/opt/rocm" \
41+
AMREX_AMD_ARCH="${AMREX_AMD_ARCH}" \
42+
CC="amdclang" \
43+
CXX="amdclang++"
44+
45+
COPY . /tmp/quokka-src
46+
WORKDIR /tmp/quokka-src
47+
48+
# Combine MPICH download, patch, and build
49+
RUN set -euo pipefail && \
50+
test -f CMakeLists.txt || { \
51+
echo "ERROR: Quokka source not found in the Docker build context." >&2; \
52+
echo "Build from the repo root, e.g.: docker build -f .github/workflows/dockerfiles/ROCm-DiskGalaxy/Dockerfile ." >&2; \
53+
exit 1; \
54+
} && \
55+
if [ -f "/tmp/quokka-src/${DOCKERFILES_DIR}/mpich-4.1.2-rocm-6.4-hip-pointer-attr.patch" ]; then \
56+
PATCH_PATH="/tmp/quokka-src/${DOCKERFILES_DIR}/mpich-4.1.2-rocm-6.4-hip-pointer-attr.patch"; \
57+
elif [ -f "/tmp/quokka-src/mpich-4.1.2-rocm-6.4-hip-pointer-attr.patch" ]; then \
58+
PATCH_PATH="/tmp/quokka-src/mpich-4.1.2-rocm-6.4-hip-pointer-attr.patch"; \
59+
else \
60+
echo "ERROR: MPICH patch not found." >&2; exit 1; \
61+
fi && \
62+
mkdir -p /tmp/build-mpich && \
63+
cd /tmp/build-mpich && \
64+
wget -q "${MPICH_URL}" -O "mpich-${MPICH_VERSION}.tar.gz" && \
65+
tar xzf "mpich-${MPICH_VERSION}.tar.gz" && \
66+
cd "mpich-${MPICH_VERSION}" && \
67+
patch -p1 < "$PATCH_PATH" && \
68+
./configure --with-device=ch4:ofi --disable-fortran --prefix="/opt/mpich/${MPICH_VERSION}" && \
69+
make -j"$(nproc)" && \
70+
make install && \
71+
cd .. && \
72+
rm -rf mpich-4.1.2/ mpich-4.1.2.tar.gz /tmp/mpich-4.1.2-rocm-6.4-hip-pointer-attr.patch && \
73+
cd / && \
74+
rm -rf /tmp/build-mpich
75+
76+
77+
ENV MPICH_VERSION="${MPICH_VERSION}" \
78+
MPICH_DIR="/opt/mpich/${MPICH_VERSION}" \
79+
PATH="/opt/mpich/${MPICH_VERSION}/bin:${PATH}" \
80+
LD_LIBRARY_PATH="/opt/mpich/${MPICH_VERSION}/lib:${LD_LIBRARY_PATH}"
81+
82+
# Build Quokka
83+
RUN set -euo pipefail && \
84+
cmake -S . -B build \
85+
-DCMAKE_BUILD_TYPE=Release \
86+
-DAMReX_SPACEDIM="${AMREX_SPACEDIM}" \
87+
-DAMReX_GPU_BACKEND=HIP \
88+
-DAMReX_MPI="${AMREX_MPI}" \
89+
-DAMReX_GPU_ARCH="${AMREX_AMD_ARCH}" \
90+
-DCMAKE_C_COMPILER="${CC}" \
91+
-DCMAKE_CXX_COMPILER="${CXX}" \
92+
-DQUOKKA_PYTHON=OFF && \
93+
cmake --build build -j"$(nproc)" --target DiskGalaxy && \
94+
test -x build/src/problems/DiskGalaxy/DiskGalaxy
95+
96+
# Runtime stage (reduced image size)
97+
FROM --platform=linux/amd64 opensuse/leap:15.6
98+
99+
ARG MPICH_VERSION=4.1.2
100+
101+
COPY --from=build /opt/rocm /opt/rocm
102+
COPY --from=build /opt/mpich /opt/mpich
103+
104+
# Install runtime deps, cleanup, and setup user
105+
RUN set -euo pipefail && \
106+
zypper --non-interactive refresh && \
107+
zypper --non-interactive install --no-recommends libhdf5 libpciaccess0 libnuma1 libdrm2 libdrm_amdgpu1 && \
108+
zypper clean --all && \
109+
printf "%s\n" "/opt/rocm/lib" "/opt/rocm/lib64" >> /etc/ld.so.conf.d/rocm.conf && \
110+
rm -rf /opt/rocm/bin /opt/rocm/include /opt/rocm/share /opt/rocm/lib/cmake \
111+
/opt/rocm/llvm/bin /opt/rocm/llvm/include /opt/rocm/llvm/share /opt/rocm/llvm/lib/cmake && \
112+
find /opt/rocm -type f -name "*.a" -delete && \
113+
find /opt/rocm -type f -name "*.o" -delete && \
114+
find /opt/mpich -type f -name "*.a" -delete && \
115+
find /opt/mpich -type f -name "*.o" -delete && \
116+
ldconfig && \
117+
mkdir -p /opt/quokka/bin /opt/quokka/share/quokka/inputs /opt/quokka/share/quokka/extern/agora_data && \
118+
useradd -ms /bin/bash leap && \
119+
usermod -a -G render,video leap
120+
121+
COPY --from=build /tmp/quokka-src/build/src/problems/DiskGalaxy/DiskGalaxy /opt/quokka/bin/DiskGalaxy
122+
COPY --from=build /tmp/quokka-src/inputs/DiskGalaxy.in /opt/quokka/share/quokka/inputs/DiskGalaxy.in
123+
COPY --from=build /tmp/quokka-src/extern/agora_data/ /opt/quokka/share/quokka/extern/agora_data/
124+
125+
RUN chmod 0755 /opt/quokka/bin/DiskGalaxy && \
126+
chown -R leap /opt/quokka
127+
128+
ENV MPICH_VERSION="${MPICH_VERSION}" \
129+
PATH="/opt/quokka/bin:/opt/mpich/${MPICH_VERSION}/bin:${PATH}" \
130+
LD_LIBRARY_PATH="/opt/mpich/${MPICH_VERSION}/lib:${LD_LIBRARY_PATH}"
131+
132+
USER leap
133+
WORKDIR /home/leap
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/src/mpl/src/gpu/mpl_gpu_hip.c b/src/mpl/src/gpu/mpl_gpu_hip.c
2+
index f6a2df3..b2c5954 100644
3+
--- a/src/mpl/src/gpu/mpl_gpu_hip.c
4+
+++ b/src/mpl/src/gpu/mpl_gpu_hip.c
5+
@@ -90,7 +90,13 @@ int MPL_gpu_query_pointer_attr(const void *ptr, MPL_pointer_attr_t * attr)
6+
hipError_t ret;
7+
ret = hipPointerGetAttributes(&attr->device_attr, ptr);
8+
if (ret == hipSuccess) {
9+
- switch (attr->device_attr.memoryType) {
10+
+#if defined(HIP_VERSION_MAJOR) && (HIP_VERSION_MAJOR >= 6)
11+
+ /* ROCm 6+ uses hipPointerAttribute_t::type */
12+
+ enum hipMemoryType memory_type = attr->device_attr.type;
13+
+#else
14+
+ enum hipMemoryType memory_type = attr->device_attr.memoryType;
15+
+#endif
16+
+ switch (memory_type) {
17+
case hipMemoryTypeHost:
18+
attr->type = MPL_GPU_POINTER_REGISTERED_HOST;
19+
attr->device = attr->device_attr.device;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/opt/rocm/lib
2+
/opt/rocm/lib64

0 commit comments

Comments
 (0)