From 96efae4ba5f425b1e80be98d0ef408b7219d84d3 Mon Sep 17 00:00:00 2001 From: "Stewart Martin-Haugh stewart.martin-haugh@stfc.ac.uk" Date: Tue, 13 Feb 2024 16:22:19 +0000 Subject: [PATCH 1/4] Update Alpaka version for improved HIP support --- extern/alpaka/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/alpaka/CMakeLists.txt b/extern/alpaka/CMakeLists.txt index 7b2f08260e..ce7ea19a41 100644 --- a/extern/alpaka/CMakeLists.txt +++ b/extern/alpaka/CMakeLists.txt @@ -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} ) From 1edcdcb0252494e604c46ec0d14b40845f50686e Mon Sep 17 00:00:00 2001 From: "Stewart Martin-Haugh stewart.martin-haugh@stfc.ac.uk" Date: Thu, 7 Mar 2024 15:26:09 +0000 Subject: [PATCH 2/4] Updates to support HIP in Alpaka --- device/alpaka/CMakeLists.txt | 6 +++++- device/alpaka/src/utils/utils.hpp | 6 +++++- examples/run/alpaka/CMakeLists.txt | 6 +++++- examples/run/alpaka/seeding_example_alpaka.cpp | 11 +++++++++-- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/device/alpaka/CMakeLists.txt b/device/alpaka/CMakeLists.txt index 60d0183a6b..ef5d4f5bf5 100644 --- a/device/alpaka/CMakeLists.txt +++ b/device/alpaka/CMakeLists.txt @@ -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 @@ -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}) \ No newline at end of file +target_link_libraries(traccc_alpaka PUBLIC ${PUBLIC_LIBRARIES} PRIVATE ${PRIVATE_LIBRARIES}) diff --git a/device/alpaka/src/utils/utils.hpp b/device/alpaka/src/utils/utils.hpp index d8d58ae7cc..b0f4bc9a93 100644 --- a/device/alpaka/src/utils/utils.hpp +++ b/device/alpaka/src/utils/utils.hpp @@ -14,6 +14,10 @@ #include #endif +#ifdef ALPAKA_ACC_GPU_HIP_ENABLED +#include +#endif + #include namespace traccc::alpaka { @@ -27,7 +31,7 @@ using Host = ::alpaka::DevCpu; using Queue = ::alpaka::Queue; 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; diff --git a/examples/run/alpaka/CMakeLists.txt b/examples/run/alpaka/CMakeLists.txt index 2ffaf6496f..ada9a1bc85 100644 --- a/examples/run/alpaka/CMakeLists.txt +++ b/examples/run/alpaka/CMakeLists.txt @@ -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} ) diff --git a/examples/run/alpaka/seeding_example_alpaka.cpp b/examples/run/alpaka/seeding_example_alpaka.cpp index b8acc311c7..4941a653c6 100644 --- a/examples/run/alpaka/seeding_example_alpaka.cpp +++ b/examples/run/alpaka/seeding_example_alpaka.cpp @@ -50,6 +50,13 @@ #include #endif +#ifdef ALPAKA_ACC_GPU_HIP_ENABLED +#include +#include +#include +#include +#endif + #include #include @@ -72,13 +79,13 @@ int seq_run(const traccc::seeding_input_options& /*i_cfg*/, // 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::device_memory_resource device_mr; vecmem::cuda::managed_memory_resource mng_mr; traccc::memory_resource mr{device_mr, &cuda_host_mr}; -#else +#elif defined(ALPAKA_ACC_GPU_HIP_ENABLED) vecmem::copy copy; vecmem::host_memory_resource mng_mr; traccc::memory_resource mr{host_mr, &host_mr}; From 6fbcfa917f94b02c41d31ac7e3cbcdacc59de663 Mon Sep 17 00:00:00 2001 From: "Stewart Martin-Haugh stewart.martin-haugh@stfc.ac.uk" Date: Mon, 11 Mar 2024 22:30:43 +0000 Subject: [PATCH 3/4] Fix CPU version --- examples/run/alpaka/seeding_example_alpaka.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/run/alpaka/seeding_example_alpaka.cpp b/examples/run/alpaka/seeding_example_alpaka.cpp index 4941a653c6..190a2bb30a 100644 --- a/examples/run/alpaka/seeding_example_alpaka.cpp +++ b/examples/run/alpaka/seeding_example_alpaka.cpp @@ -76,17 +76,21 @@ int seq_run(const traccc::seeding_input_options& /*i_cfg*/, using host_detector_type = detray::detector<>; - // Memory resources used by the application. - vecmem::host_memory_resource host_mr; - #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 From 2014a0cb2f8be34ccf831d5b912456cd525b922d Mon Sep 17 00:00:00 2001 From: "Stewart Martin-Haugh stewart.martin-haugh@stfc.ac.uk" Date: Thu, 11 Apr 2024 14:21:38 +0100 Subject: [PATCH 4/4] Update vecmem --- extern/vecmem/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/vecmem/CMakeLists.txt b/extern/vecmem/CMakeLists.txt index be6de657a7..ed739724e5 100644 --- a/extern/vecmem/CMakeLists.txt +++ b/extern/vecmem/CMakeLists.txt @@ -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} )