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

Add CUDA, HIP and SYCL targets for Alpaka #797

Merged
merged 12 commits into from
Dec 16, 2024
22 changes: 17 additions & 5 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,29 @@ jobs:
run_tests: false
build: Release
- platform:
name: ALPAKA
name: "ALPAKA_CPU"
container: ghcr.io/acts-project/ubuntu2404:69
options: --preset alpaka-fp32
run_tests: true
build: Release
- platform:
name: ALPAKA
container: ghcr.io/acts-project/ubuntu2404:69
options: --preset alpaka-fp32
name: "ALPAKA_CUDA"
container: ghcr.io/acts-project/ubuntu2404_cuda:69
options: --preset alpaka-fp32 -Dalpaka_ACC_GPU_CUDA_ENABLE=ON -DTRACCC_FAIL_ON_WARNINGS=OFF
run_tests: false
build: Debug
build: Release
- platform:
name: "ALPAKA_HIP_SYCL"
container: ghcr.io/acts-project/ubuntu2404_rocm_oneapi:69
options: --preset alpaka-fp32 -Dalpaka_ACC_GPU_HIP_ENABLE=ON -DCMAKE_PREFIX_PATH=/opt/rocm/lib/cmake/ -Dalpaka_DISABLE_VENDOR_RNG=ON -DTRACCC_USE_ROOT=OFF
run_tests: false
build: Release
- platform:
name: "ALPAKA_SYCL"
container: ghcr.io/acts-project/ubuntu2404_oneapi:69
options: --preset alpaka-fp32 -Dalpaka_ACC_CPU_B_SEQ_T_THREADS_ENABLE=OFF -Dalpaka_ACC_SYCL_ENABLE=ON -Dalpaka_SYCL_ONEAPI_GPU=ON -Dalpaka_SYCL_ONEAPI_GPU_DEVICES=spir64
run_tests: false
build: Release
# Use BASH as the shell from the images.
defaults:
run:
Expand Down
9 changes: 8 additions & 1 deletion device/alpaka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include( traccc-alpaka-functions )
include( traccc-compiler-options-cpp )

set(PUBLIC_LIBRARIES traccc::core traccc::device_common vecmem::core covfie::core)
set(PRIVATE_LIBRARIES alpaka::alpaka traccc::Thrust)
set(PRIVATE_LIBRARIES alpaka::alpaka)

traccc_enable_language_alpaka()

Expand Down Expand Up @@ -45,5 +45,12 @@ traccc_add_alpaka_library( traccc_alpaka alpaka TYPE SHARED
"src/seeding/seeding_algorithm.cpp"
"src/seeding/track_params_estimation.cpp"
)
# Set up Thrust specifically for the traccc::alpaka library.
if(alpaka_ACC_GPU_CUDA_ENABLE)
thrust_create_target( traccc::cuda_thrust
HOST CPP
DEVICE CUDA )
list(APPEND PRIVATE_LIBRARIES traccc::cuda_thrust)
endif()

target_link_libraries(traccc_alpaka PUBLIC ${PUBLIC_LIBRARIES} PRIVATE ${PRIVATE_LIBRARIES})
9 changes: 7 additions & 2 deletions extern/alpaka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ message( STATUS "Building Alpaka as part of the TRACCC project" )
set( TRACCC_ALPAKA_SOURCE
"URL;https://github.com/alpaka-group/alpaka/archive/refs/tags/1.2.0.tar.gz;URL_MD5;0e2dcf4ddf7987532835d7b2b3680843"
CACHE STRING "Source for Alpaka, when built as part of this project" )
mark_as_advanced( TRACCC_ALPAKA_SOURCE )
FetchContent_Declare( Alpaka SYSTEM ${TRACCC_ALPAKA_SOURCE} )
#Patch for alpaka printf macro
set( TRACCC_ALPAKA_PATCH
"PATCH_COMMAND;patch;-p1;<;${CMAKE_CURRENT_SOURCE_DIR}/alpaka-1.2.0.patch"
CACHE STRING "Patch for alpaka, when built as part of this project" )

mark_as_advanced( TRACCC_ALPAKA_SOURCE TRACCC_ALPAKA_PATCH )
FetchContent_Declare( Alpaka SYSTEM ${TRACCC_ALPAKA_SOURCE} ${TRACCC_ALPAKA_PATCH})

# Turn off build testing.
set( BUILD_TESTING FALSE )
Expand Down
48 changes: 48 additions & 0 deletions extern/alpaka/alpaka-1.2.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Only in alpaka-1.2.0-orig: .clang-format
Only in alpaka-1.2.0-orig: .dockerignore
Only in alpaka-1.2.0-orig: .git
Only in alpaka-1.2.0-orig: .github
Only in alpaka-1.2.0-orig: .gitignore
Only in alpaka-1.2.0-orig: .gitlab-ci.yml
diff -ur alpaka-1.2.0-orig/include/alpaka/core/Sycl.hpp alpaka-1.2.0-fixed/include/alpaka/core/Sycl.hpp
--- alpaka-1.2.0-orig/include/alpaka/core/Sycl.hpp 2024-12-09 18:48:17.584316863 +0100
+++ alpaka-1.2.0-fixed/include/alpaka/core/Sycl.hpp 2024-12-10 17:18:28.416146705 +0100
@@ -24,35 +24,6 @@

# include <sycl/sycl.hpp>

-// if SYCL is enabled with the AMD backend the printf will be killed because of missing compiler support
-# ifdef __AMDGCN__
-# define printf(...)
-# else
-
-# ifdef __SYCL_DEVICE_ONLY__
-using AlpakaFormat = char const* [[clang::opencl_constant]];
-# else
-using AlpakaFormat = char const*;
-# endif
-
-# if BOOST_COMP_CLANG
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
-# endif
-
-# define printf(FORMAT, ...) \
- do \
- { \
- static auto const format = AlpakaFormat{FORMAT}; \
- sycl::ext::oneapi::experimental::printf(format, ##__VA_ARGS__); \
- } while(false)
-
-# if BOOST_COMP_CLANG
-# pragma clang diagnostic pop
-# endif
-
-# endif
-
// SYCL vector types trait specializations.
namespace alpaka
{
Only in alpaka-1.2.0-orig: .pre-commit-config.yaml
Only in alpaka-1.2.0-orig: .readthedocs.yml
Only in alpaka-1.2.0-orig: .zenodo.json
Loading