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

Update Alpaka version for improved HIP support + HIP updates #519

Merged
merged 10 commits into from
Apr 17, 2024
6 changes: 5 additions & 1 deletion device/alpaka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ if(alpaka_ACC_GPU_CUDA_ENABLE)
include( traccc-compiler-options-cuda )

list(APPEND PRIVATE_LIBRARIES CUDA::cudart vecmem::cuda)
elseif(alpaka_ACC_GPU_HIP_ENABLE)
enable_language(HIP)
find_package( HIPToolkit REQUIRED )
list(APPEND PRIVATE_LIBRARIES HIP::hiprt vecmem::hip)
endif()

traccc_add_alpaka_library( traccc_alpaka alpaka TYPE SHARED
Expand All @@ -34,4 +38,4 @@ traccc_add_alpaka_library( traccc_alpaka alpaka TYPE SHARED
"src/seeding/track_params_estimation.cpp"
)

target_link_libraries(traccc_alpaka PUBLIC ${PUBLIC_LIBRARIES} PRIVATE ${PRIVATE_LIBRARIES})
target_link_libraries(traccc_alpaka PUBLIC ${PUBLIC_LIBRARIES} PRIVATE ${PRIVATE_LIBRARIES})
6 changes: 5 additions & 1 deletion device/alpaka/src/utils/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
#include <vecmem/utils/cuda/copy.hpp>
#endif

#ifdef ALPAKA_ACC_GPU_HIP_ENABLED
#include <vecmem/utils/hip/copy.hpp>
#endif

#include <vecmem/utils/copy.hpp>

namespace traccc::alpaka {
Expand All @@ -27,7 +31,7 @@ using Host = ::alpaka::DevCpu;
using Queue = ::alpaka::Queue<Acc, ::alpaka::NonBlocking>;

static constexpr std::size_t warpSize =
#ifdef ALPAKA_ACC_GPU_CUDA_ENABLED
#if defined(ALPAKA_ACC_GPU_CUDA_ENABLED) || defined(ALPAKA_ACC_GPU_HIP_ENABLED)
32;
#else
4;
Expand Down
6 changes: 5 additions & 1 deletion examples/run/alpaka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ if(alpaka_ACC_GPU_CUDA_ENABLE)
include( traccc-compiler-options-cuda )

list (APPEND LIBRARIES vecmem::cuda traccc::cuda)
endif()
elseif(alpaka_ACC_GPU_HIP_ENABLE)
enable_language(HIP)
find_package( HIPToolkit REQUIRED )
list(APPEND LIBRARIES HIP::hiprt vecmem::hip)
endif()

traccc_add_executable( seeding_example_alpaka "seeding_example_alpaka.cpp"
LINK_LIBRARIES ${LIBRARIES} )
Expand Down
23 changes: 17 additions & 6 deletions examples/run/alpaka/seeding_example_alpaka.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@
#include <vecmem/utils/cuda/copy.hpp>
#endif

#ifdef ALPAKA_ACC_GPU_HIP_ENABLED
#include <vecmem/memory/hip/device_memory_resource.hpp>
#include <vecmem/memory/hip/host_memory_resource.hpp>
#include <vecmem/memory/hip/managed_memory_resource.hpp>
#include <vecmem/utils/hip/copy.hpp>
#endif

#include <vecmem/memory/host_memory_resource.hpp>
#include <vecmem/utils/copy.hpp>

Expand All @@ -72,17 +79,21 @@ int seq_run(const traccc::opts::track_seeding& seeding_opts,

using host_detector_type = detray::detector<>;

// Memory resources used by the application.
vecmem::host_memory_resource host_mr;

#ifdef ALPAKA_ACC_GPU_CUDA_ENABLED
#if defined(ALPAKA_ACC_GPU_CUDA_ENABLED)
vecmem::cuda::copy copy;
vecmem::cuda::host_memory_resource cuda_host_mr;
vecmem::cuda::host_memory_resource host_mr;
vecmem::cuda::device_memory_resource device_mr;
vecmem::cuda::managed_memory_resource mng_mr;
traccc::memory_resource mr{device_mr, &cuda_host_mr};
traccc::memory_resource mr{device_mr, &host_mr};
#elif defined(ALPAKA_ACC_GPU_HIP_ENABLED)
vecmem::hip::copy copy;
vecmem::hip::host_memory_resource host_mr;
vecmem::hip::device_memory_resource device_mr;
vecmem::hip::managed_memory_resource mng_mr;
traccc::memory_resource mr{device_mr, &host_mr};
#else
vecmem::copy copy;
vecmem::host_memory_resource host_mr;
vecmem::host_memory_resource mng_mr;
traccc::memory_resource mr{host_mr, &host_mr};
#endif
Expand Down
2 changes: 1 addition & 1 deletion extern/alpaka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ message( STATUS "Building Alpaka as part of the TRACCC project" )

# Declare where to get Alpaka from.
set( TRACCC_ALPAKA_SOURCE
"URL;https://github.com/alpaka-group/alpaka/archive/refs/tags/1.0.0.tar.gz;URL_MD5;e4bcc48411eed1daf8bc33a031a9f7dc"
"URL;https://github.com/alpaka-group/alpaka/archive/refs/tags/1.1.0.tar.gz;URL_MD5;e788ec42c8c4ebd87d12647940a01458"
CACHE STRING "Source for Alpaka, when built as part of this project" )
mark_as_advanced( TRACCC_ALPAKA_SOURCE )
FetchContent_Declare( Alpaka ${TRACCC_ALPAKA_SOURCE} )
Expand Down
2 changes: 1 addition & 1 deletion extern/vecmem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ message( STATUS "Building VecMem as part of the TRACCC project" )

# Declare where to get VecMem from.
set( TRACCC_VECMEM_SOURCE
"URL;https://github.com/acts-project/vecmem/archive/refs/tags/v1.4.0.tar.gz;URL_MD5;af5434e34ca9c084678c2c043441f174"
"URL;https://github.com/acts-project/vecmem/archive/refs/tags/v1.5.0.tar.gz;URL_MD5;3cc5a3bb14b93f611513535173a6be28"
CACHE STRING "Source for VecMem, when built as part of this project" )
mark_as_advanced( TRACCC_VECMEM_SOURCE )
FetchContent_Declare( VecMem ${TRACCC_VECMEM_SOURCE} )
Expand Down
Loading