Skip to content

Commit

Permalink
Tweaking the rocThrust setup according to my own taste.
Browse files Browse the repository at this point in the history
So that it could be used with our existing ROCm/HIP Docker
images as well.
  • Loading branch information
krasznaa committed May 17, 2024
1 parent 84c3f24 commit 1c26d46
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
- name: CPU
container: ghcr.io/acts-project/ubuntu2004:v30
options: -DTRACCC_USE_ROOT=FALSE
- name: HIP
container: ghcr.io/acts-project/ubuntu2204_rocm_clang:sha-3a6b0b2
- name: HIP
container: ghcr.io/acts-project/ubuntu2004_rocm:v42
options: -DTRACCC_BUILD_HIP=TRUE -DTRACCC_SETUP_ROCTHRUST=TRUE
- name: CUDA
container: ghcr.io/acts-project/ubuntu2004_cuda:v30
Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,24 @@ set( TRACCC_THRUST_OPTIONS "" CACHE STRING
mark_as_advanced( TRACCC_THRUST_OPTIONS )
thrust_create_target( traccc::Thrust ${TRACCC_THRUST_OPTIONS} )

# Set up rocThrust.
option( TRACCC_SETUP_ROCTHRUST
"Set up the rocThrust target(s) explicitly" FALSE )
option( TRACCC_USE_SYSTEM_ROCTHRUST
"Pick up an existing installation of rocThrust from the build environment"
${TRACCC_USE_SYSTEM_LIBS} )
if( TRACCC_SETUP_ROCTHRUST )
set( ROCM_WARN_TOOLCHAIN_VAR FALSE CACHE BOOL "Don't print ROCm warnings" )
set( ROCM_ERROR_TOOLCHAIN_VAR FALSE CACHE BOOL "Don't print ROCm errors" )
mark_as_advanced( ROCM_WARN_TOOLCHAIN_VAR ROCM_ERROR_TOOLCHAIN_VAR )
if( TRACCC_USE_SYSTEM_ROCTHRUST )
find_package( rocThrust REQUIRED )
else()
add_subdirectory( extern/rocThrust )
endif()
# Dress up the rocthrust target a little.
target_compile_definitions( rocthrust INTERFACE
THRUST_IGNORE_CUB_VERSION_CHECK )
endif()

# Set up TBB.
Expand Down
3 changes: 2 additions & 1 deletion cmake/traccc-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TRACCC library, part of the ACTS project (R&D line)
#
# (c) 2022-2023 CERN for the benefit of the ACTS project
# (c) 2022-2024 CERN for the benefit of the ACTS project
#
# Mozilla Public License Version 2.0

Expand All @@ -9,6 +9,7 @@

# Remember the options that traccc was built with.
set( TRACCC_BUILD_CUDA @TRACCC_BUILD_CUDA@ )
set( TRACCC_BUILD_HIP @TRACCC_BUILD_HIP@ )
set( TRACCC_BUILD_SYCL @TRACCC_BUILD_SYCL@ )
set( TRACCC_BUILD_FUTHARK @TRACCC_BUILD_FUTHARK@ )
set( TRACCC_BUILD_KOKKOS @TRACCC_BUILD_KOKKOS@ )
Expand Down
17 changes: 12 additions & 5 deletions extern/rocThrust/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TRACCC library, part of the ACTS project (R&D line)
#
# (c) 2021-2024 CERN for the benefit of the ACTS project
# (c) 2024 CERN for the benefit of the ACTS project
#
# Mozilla Public License Version 2.0

Expand All @@ -18,16 +18,23 @@ message( STATUS "Building rocThrust as part of the TRACCC project" )

# Declare where to get rocThrust from.
set( TRACCC_ROCTHRUST_SOURCE
"GIT_REPOSITORY;https://github.com/ROCm/rocThrust.git;GIT_TAG;rocm-6.1.0"
CACHE STRING "Source for Thrust, when built as part of this project" )
"URL;https://github.com/ROCm/rocThrust/archive/refs/tags/rocm-6.1.1.tar.gz;URL_MD5;038abf313688c00555fe1efc51e1307b"
CACHE STRING "Source for rocThrust, when built as part of this project" )
set( TRACCC_ROCTHRUST_PATCH
"PATCH_COMMAND;patch;-p1;<;${CMAKE_CURRENT_SOURCE_DIR}/rocm-6.1.1.patch"
CACHE STRING "Patch for rocThrust, when built as part of this project" )
mark_as_advanced( TRACCC_ROCTHRUST_SOURCE )
FetchContent_Declare( rocThrust ${TRACCC_ROCTHRUST_SOURCE} )
FetchContent_Declare( rocThrust
${TRACCC_ROCTHRUST_SOURCE}
${TRACCC_ROCTHRUST_PATCH} )

#Turn off build testing
# Settings for the rocThrust build.
if( DEFINED CACHE{BUILD_TESTING} )
set( _buildTestingValue ${BUILD_TESTING} )
endif()
set( BUILD_TESTING FALSE CACHE INTERNAL "Forceful setting of BUILD_TESTING" )
set( HIP_COMPILER "clang" )
set( HIP_CXX_COMPILER "hipcc" )

# Get it into the current directory.
FetchContent_MakeAvailable( rocThrust )
Expand Down
26 changes: 26 additions & 0 deletions extern/rocThrust/rocm-6.1.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff -ur rocThrust-rocm-6.1.1-orig/cmake/Dependencies.cmake rocThrust-rocm-6.1.1-fixed/cmake/Dependencies.cmake
--- rocThrust-rocm-6.1.1-orig/cmake/Dependencies.cmake 2024-02-07 00:12:37.000000000 +0100
+++ rocThrust-rocm-6.1.1-fixed/cmake/Dependencies.cmake 2024-05-17 09:33:52.423910609 +0200
@@ -23,7 +23,7 @@
GIT_REPOSITORY https://github.com/ROCmSoftwarePlatform/rocPRIM.git
GIT_TAG develop
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps/rocprim
- CMAKE_ARGS -DBUILD_TEST=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=/opt/rocm
+ CMAKE_ARGS -DBUILD_TEST=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=/opt/rocm -DHIP_COMPILER=${HIP_COMPILER} -DHIP_CXX_COMPILER=${HIP_CXX_COMPILER}
LOG_DOWNLOAD TRUE
LOG_CONFIGURE TRUE
LOG_BUILD TRUE
diff -ur rocThrust-rocm-6.1.1-orig/CMakeLists.txt rocThrust-rocm-6.1.1-fixed/CMakeLists.txt
--- rocThrust-rocm-6.1.1-orig/CMakeLists.txt 2024-02-07 00:12:37.000000000 +0100
+++ rocThrust-rocm-6.1.1-fixed/CMakeLists.txt 2024-05-16 16:52:07.600882025 +0200
@@ -63,10 +63,6 @@
# Get dependencies
include(cmake/Dependencies.cmake)

-# Verify that supported compilers are used
-if (NOT WIN32)
- include(cmake/VerifyCompiler.cmake)
-endif()
# Build options
# Disable -Werror
option(DISABLE_WERROR "Disable building with Werror" ON)

0 comments on commit 1c26d46

Please sign in to comment.