Repository navigation
HIP backend for AMD GPUs; canoP studio on Adastra - #14
Merged
Merged
Conversation
- Shared Kokkos and pykokkos-base built with HIP (hipcc); the kernels of the physics compiled with the compiler of that Kokkos (physics/jit.py), directly as for Cuda. - kalypsso-core: a second patch, on top of the Cuda one, for HIP without relocatable device code (device code in headers, HIP device timer, KOKKOS_FUNCTION definitions, non-defaulted virtual destructors); the CMake applies the series as needed. - canoP studio: HIP backend, GPU architecture kept per backend, Slurm request gpus-per-node, pre-filled modules and constraints on Adastra (CINES). - Docs and changelog. Tested on Adastra: build with ROCm 6.4.3 for gfx90a; blast 2D on 1 MI250X and on 2 GCDs with 2 MPI ranks (GPU-aware cray-mpich) matches the OpenMP run to round-off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ptrembli
force-pushed
the
feature/hip-backend
branch
from
December 1, 2026 22:58
a9ad4ec to
e432542
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
canoP can now be built and run on AMD GPUs with the Kokkos HIP backend (tested on the MI250X of
Adastra, CINES). The shared Kokkos, pykokkos-base and the kernels of the physics are compiled with
hipcc. canoP studio offers HIP as a Kokkos backend and pre-fills the Adastra environment.Changes
Build
cmake/pykokkos.cmake:KALYPSSO_CORE_KOKKOS_BACKEND=HIPbuilds the shared Kokkos withKokkos_ENABLE_HIP(OpenMP on the host, no relocatable device code). The C++ compiler ishipcc.pykokkos-base is built with 8 jobs, as for Cuda.
cmake/patches/kalypsso-core-hip-device-code-in-headers.patch(new), applied on top of the Cudapatch for HIP:
KALYPSSO_CORE_DEVICE_CODE_IN_HEADERSis also defined for HIP without RDC;HIPAsyncTimer.h: the HIP port ofCudaAsyncTimer.h, which kalypsso-core lacked (the API is the same);KOKKOS_FUNCTIONon the definitions of theoperator()ofComputeDataSliceAlongLine. clangrefuses a host definition of a host-device declaration;
MeshGhostsExchanger(MultiVar)are no longer defaulted. clang makesthe defaulted ones device functions that reference a device vtable in another translation unit.
cmake/build_or_find_kalypsso_core.cmake: the patches are a series. CMake finds how much of theseries is already applied and applies the rest. A Cuda build in a tree patched for HIP keeps the
patches, which do not change Cuda or CPU builds.
Physics
physics/jit.py: HIP kernels are compiled directly, without CMake for each kernel, like Cuda.They use the compiler that the Kokkos install was built with (
Kokkos_CXX_COMPILER). WhenPK_KOKKOS_LIB_PATHis set, pykokkos itself would useg++for every backend except Cuda.canoP studio
PROFILE_FIELDS), because Cuda and HIParchitectures differ. Settings saved before this change keep their Cuda architecture.
gpus-per-node, in the studio and in the template of new campaigns.Adastra refuses
--gpus-per-task.GCC-CPU-6.0.0for OpenMP; for HIP,GCC-GPU-6.0.0plus cray-mpich GTL(
LDFLAGS) andMPICH_GPU_SUPPORT_ENABLED=1, because canoP gives device buffers to MPI;--constraint=GENOA/MI250/MI300instead of--partition, which Adastra refuses;gpus-per-nodeas the default GPU request.Docs: installation (HIP, Adastra), tutorial, physics guide,
AGENTS.md,CHANGELOG.md.Tests (Adastra)
canoP_2dandcanoP_3dwith ROCm 6.4.3 /hipccforAMD_GFX90A, on the login node.hipccat the first run (15 to 30 s each);it matches the OpenMP run (relative difference below 1e-15).
CANOP_STUDIO_CONFIG;check_i18n.pypasses.Not tested: MI300A (
AMD_GFX942_APU), a HIP campaign run from the studio, and Cuda (the Cudapatch and its code path are unchanged). CI has no GPU, so neither the Cuda nor the HIP builds run
there.
Notes for review
templates/script.sh, which does not knowgpus-per-node. Only new campaigns get it.🤖 Generated with Claude Code