Skip to content

Commit

Permalink
Convert libcudacxx to CCCL
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffburdick committed Oct 6, 2023
1 parent 3aea0e9 commit 1a17890
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
14 changes: 9 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,15 @@ if (CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.4)
message(FATAL_ERROR "MatX requires CUDA 11.4 or higher. Please update before using.")
endif()

# We typically need newer versions libcudacxx than availabled in the toolkit. pull down specific version here
message(STATUS "Need libcuda++. Finding...")
set(LIBCUDACXX_VERSION "2.1.0" CACHE STRING "Version of libcudacxx to use")
include(cmake/FindLibcudacxx.cmake)
target_include_directories(matx INTERFACE "$<BUILD_INTERFACE:${LIBCUDACXX_INCLUDE_DIR}>")
# libcudacxx is now part of CCCL, so grab that repo if needed
message(STATUS "Need CCCL. Finding...")
set(CCCL_VERSION "v2.2.0" CACHE STRING "Version of CCCL to use")
include(cmake/FindCCCL.cmake)

target_include_directories(matx SYSTEM INTERFACE
$<BUILD_INTERFACE:${CCCL_SOURCE_DIR}/libcudacxx>
$<BUILD_INTERFACE:${CCCL_SOURCE_DIR}/cub>
$<BUILD_INTERFACE:${CCCL_SOURCE_DIR}/thrust>)

# Set flags for compiling tests faster
set(MATX_CUDA_FLAGS ${CMAKE_CUDA_FLAGS} --threads 0 -ftemplate-backtrace-limit=0)
Expand Down
33 changes: 11 additions & 22 deletions cmake/FindLibcudacxx.cmake → cmake/FindCCCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,20 @@
# // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# /////////////////////////////////////////////////////////////////////////////////

function(find_and_configure_libcudacxx version)
function(find_and_configure_cccl version)

list(APPEND CMAKE_MESSAGE_CONTEXT "libcudacxx")
list(APPEND CMAKE_MESSAGE_CONTEXT "cccl")

rapids_cpm_find(libcudacxx ${version}
GLOBAL_TARGETS
libcudacxx libcudacxx::libcudacxx cxx_static
BUILD_EXPORT_SET
${PROJECT_NAME}-exports
INSTALL_EXPORT_SET
${PROJECT_NAME}-exports
CPM_ARGS
GIT_REPOSITORY https://github.com/NVIDIA/libcudacxx.git
GIT_TAG ${version}
GIT_SHALLOW TRUE
DOWNLOAD_ONLY TRUE
OPTIONS "LIBCXX_INCLUDE_BENCHMARKS OFF"
"LIBCXX_INCLUDE_TESTS OFF"
"LIBCXX_ENABLE_SHARED OFF"
"LIBCXX_ENABLE_STATIC OFF"
)
CPMAddPackage(
NAME CCCL
GITHUB_REPOSITORY nvidia/cccl
GIT_TAG ${version}
)

set(LIBCUDACXX_INCLUDE_DIR "${libcudacxx_SOURCE_DIR}/include" PARENT_SCOPE)
set(LIBCXX_INCLUDE_DIR "${libcudacxx_SOURCE_DIR}/libcxx/include" PARENT_SCOPE)

set(CCCL_INCLUDE_DIR "${cccl_SOURCE_DIR}/include" PARENT_SCOPE)
set(LIBCXX_INCLUDE_DIR "${cccl_SOURCE_DIR}/libcxx/include" PARENT_SCOPE)

endfunction()

find_and_configure_libcudacxx(${LIBCUDACXX_VERSION})
find_and_configure_cccl(${CCCL_VERSION})

0 comments on commit 1a17890

Please sign in to comment.