Skip to content

Commit

Permalink
cmake,scripts: Improve thrust detection and upgrade used version in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
stotko committed Jun 19, 2024
1 parent 3cd032b commit 383fa48
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 11 deletions.
35 changes: 33 additions & 2 deletions cmake/Findthrust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ find_path(THRUST_INCLUDE_DIR
NAMES
"thrust/version.h")

list(APPEND THRUST_INCLUDE_DIR_VARS THRUST_INCLUDE_DIR)

if(THRUST_INCLUDE_DIR)
file(STRINGS "${THRUST_INCLUDE_DIR}/thrust/version.h"
THRUST_VERSION_STRING
Expand All @@ -20,19 +22,48 @@ if(THRUST_INCLUDE_DIR)
unset(THRUST_VERSION_STRING)

set(THRUST_VERSION "${THRUST_VERSION_MAJOR}.${THRUST_VERSION_MINOR}.${THRUST_VERSION_PATCH}")


if(THRUST_VERSION VERSION_GREATER_EQUAL "2.0.0")
find_path(LIBCUDACXX_INCLUDE_DIR
HINTS
"${THRUST_INCLUDE_DIR}/../libcudacxx/include"
${STDGPU_THRUST_PATHS}
NAMES
"cuda/std/version")

find_path(CUB_INCLUDE_DIR
HINTS
"${THRUST_INCLUDE_DIR}/../cub"
${STDGPU_THRUST_PATHS}
NAMES
"cub/version.cuh")

list(APPEND THRUST_INCLUDE_DIR_VARS LIBCUDACXX_INCLUDE_DIR CUB_INCLUDE_DIR)

mark_as_advanced(LIBCUDACXX_INCLUDE_DIR
CUB_INCLUDE_DIR)
endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(thrust
REQUIRED_VARS THRUST_INCLUDE_DIR
REQUIRED_VARS ${THRUST_INCLUDE_DIR_VARS}
VERSION_VAR THRUST_VERSION)


if(thrust_FOUND)
foreach(inc IN LISTS THRUST_INCLUDE_DIR_VARS)
list(APPEND THRUST_INCLUDE_DIRS "${${inc}}")
endforeach()
list(REMOVE_DUPLICATES THRUST_INCLUDE_DIRS)

add_library(thrust::thrust INTERFACE IMPORTED)
set_target_properties(thrust::thrust PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${THRUST_INCLUDE_DIR}")
set_target_properties(thrust::thrust PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${THRUST_INCLUDE_DIRS}")

mark_as_advanced(THRUST_INCLUDE_DIR
THRUST_INCLUDE_DIR_VARS
THRUST_INCLUDE_DIRS
THRUST_VERSION
THRUST_VERSION_MAJOR
THRUST_VERSION_MINOR
Expand Down
2 changes: 1 addition & 1 deletion tools/backend/check_install_openmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ sh tools/backend/helper/create_empty_directory.sh build_install_test

# Compile dependent project
cmake -E cmake_echo_color --blue ">>>>> Check installation ($CONFIG)"
cmake -B build_install_test -S tests/install_test -DCMAKE_BUILD_TYPE=$CONFIG -Dstdgpu_ROOT=bin -Dthrust_ROOT=external/thrust $@
cmake -B build_install_test -S tests/install_test -DCMAKE_BUILD_TYPE=$CONFIG -Dstdgpu_ROOT=bin -Dthrust_ROOT=external/cccl/thrust $@
cmake --build build_install_test --config ${CONFIG} --parallel 13
2 changes: 1 addition & 1 deletion tools/backend/configure_openmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ fi
sh tools/backend/helper/create_empty_directory.sh build

# Configure project
sh tools/backend/helper/configure.sh $CONFIG -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/thrust -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON $@
sh tools/backend/helper/configure.sh $CONFIG -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/cccl/thrust -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON $@
2 changes: 1 addition & 1 deletion tools/backend/configure_openmp_clang_tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -e
sh tools/backend/helper/create_empty_directory.sh build

# Configure project
sh tools/backend/helper/configure.sh Debug -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_ANALYZE_WITH_CLANG_TIDY=ON -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/thrust
sh tools/backend/helper/configure.sh Debug -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_ANALYZE_WITH_CLANG_TIDY=ON -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/cccl/thrust
2 changes: 1 addition & 1 deletion tools/backend/configure_openmp_cppcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -e
sh tools/backend/helper/create_empty_directory.sh build

# Configure project
sh tools/backend/helper/configure.sh Debug -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_ANALYZE_WITH_CPPCHECK=ON -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/thrust
sh tools/backend/helper/configure.sh Debug -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_ANALYZE_WITH_CPPCHECK=ON -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/cccl/thrust
2 changes: 1 addition & 1 deletion tools/backend/configure_openmp_documentation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -e
sh tools/backend/helper/create_empty_directory.sh build

# Configure project
sh tools/backend/helper/configure.sh Release -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_BUILD_DOCUMENTATION=ON -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/thrust
sh tools/backend/helper/configure.sh Release -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_BUILD_DOCUMENTATION=ON -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/cccl/thrust
2 changes: 1 addition & 1 deletion tools/backend/configure_openmp_lcov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -e
sh tools/backend/helper/create_empty_directory.sh build

# Configure project
sh tools/backend/helper/configure.sh Debug -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_BUILD_TEST_COVERAGE=ON -Dthrust_ROOT=external/thrust
sh tools/backend/helper/configure.sh Debug -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_BUILD_TEST_COVERAGE=ON -Dthrust_ROOT=external/cccl/thrust
6 changes: 3 additions & 3 deletions tools/dev/download_thrust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
set -e

cmake -E cmake_echo_color --blue ">>>>> Download thrust"
cmake -E chdir external git clone https://github.com/NVIDIA/thrust
cmake -E chdir external/thrust git fetch --all --tags --prune
cmake -E chdir external/thrust git checkout tags/1.17.2
cmake -E chdir external git clone https://github.com/NVIDIA/cccl
cmake -E chdir external/cccl git fetch --all --tags --prune
cmake -E chdir external/cccl git checkout tags/v2.2.0

0 comments on commit 383fa48

Please sign in to comment.