Alpaka / HIP Cleanup, main branch (2026.03.02.)#1271
Alpaka / HIP Cleanup, main branch (2026.03.02.)#1271krasznaa wants to merge 3 commits intoacts-project:mainfrom
Conversation
Similar to traccc_add_alpaka_library(...), it makes use of the helper function provided by Alpaka (alpaka_add_executable(...)) for setting up the code build. Simplifying our own code a little in the process.
The main thing being that an installed rocthrust version will only provide the target roc::rocthrust. So we need to create a target with that same name even when we provide rocthrust as part of our own build.
While simplifying the configuration of the Alpaka unit tests a little using traccc_add_alpaka_test(...).
|
|
I always use hipcc + llvm clang, whichever version matches the printout from |
Interesting. 🤔 You see, now that with the latest VecMem version we use CMake's own HIP language implementation, I rather made such a setup on RHEL9: # Set up GCC.
GCCDIR=/software/gcc/13.3.0/x86_64-el9
source ${GCCDIR}/setup.sh
# Set up where to get HIP from.
export ROCM_PATH=/opt/rocm-6.0.3
export CMAKE_PREFIX_PATH=${ROCM_PATH}${CMAKE_PREFIX_PATH:+:${CMAKE_PREFIX_PATH}}
# Set up the compilers for CMake.
export CC="${ROCM_PATH}/bin/amdclang"
export CFLAGS="${CFLAGS:+${CFLAGS} }--gcc-toolchain=${GCCDIR}"
export CXX="${ROCM_PATH}/bin/amdclang++"
export CXXFLAGS="${CXXFLAGS:+${CXXFLAGS} }--gcc-toolchain=${GCCDIR}"
export HIPCXX="${ROCM_PATH}/bin/amdclang++"
export HIPFLAGS="${HIPFLAGS:+${HIPFLAGS} }--gcc-toolchain=${GCCDIR}"Previously I was also of course using |
|
I think we expect alpaka to only work with a clang host compiler, given the compatibility matrix here: |
|
In CMSSW we mix the
Note that we have to tell COMPILER_HOST=$(gcc -dumpmachine)
COMPILER_PATH=$(dirname $(realpath $(which gcc)))
hipcc --target=$COMPILER_HOST --gcc-toolchain=$COMPILER_PATH ...(not really like this, but it gives you an idea) |
* Introduced traccc_add_alpaka_test(...). Similar to traccc_add_alpaka_library(...), it makes use of the helper function provided by Alpaka (alpaka_add_executable(...)) for setting up the code build. Simplifying our own code a little in the process. * Modified how rocthrust would be set up for the project. The main thing being that an installed rocthrust version will only provide the target roc::rocthrust. So we need to create a target with that same name even when we provide rocthrust as part of our own build. * Migrated all clients to the roc::rocthrust target name. While simplifying the configuration of the Alpaka unit tests a little using traccc_add_alpaka_test(...).
|
To confirm, this PR (as of 09d2fc2) works in the context of CMSSW. |



This was triggered by @fwyzard pointing out in #1269 that our code is currently not able to use rocThrust from an already installed location. (Picking it up from the local HIP installation for instance.)
But while experimenting with the code, I realized that we should do some additional cleanup as well. So I changed the setup of the Alpaka unit test a little as well along the way. 🤔
@StewMH, how do you do builds with Alpaka+HIP usually? I has to realize that I only ever did such builds on Ubuntu so far, never on RHEL. So on RHEL I had to devise a build setup where:
amdclang/amdclang++respectably;Without this, if I let the host compiler be GCC 13, I was getting into some weird linking errors on
traccc_test_alpaka. The kind of linking errors that I also get when mixing GCC + oneAPI in a single build tree. (Some of our templates are not represented in the ABI in the same way between GCC and Clang unfortunately.)So, do you do the same @StewMH? I.e. do you need to use HIP's Clang as the host compiler in such builds as well?