Skip to content

New cmake infrastructure #43

@jrhemstad

Description

@jrhemstad

General

  • Bump minimum CMake version for developer build to 3.21. Enables cmake_path and other QoL fixes. Does not affect user packages (CPM, find_package, and add_subdirectory usecases are unaffected and remain at 3.15).
  • Write CCCL monorepo top layer CMakeLists.txt.
  • Update subproject minimum CMake version for developer builds.
  • Enable TOPLEVEL subproject logic when using when included from CCCL monorepo builds.
  • Verify/update subproject install rules.
  • Verify/update subproject CMake package configs.
  • Update user docs to reflect changes to configuration options.

Use native CMake support for CUDA:

  • Remove nvc++ hacks from Thrust/CUB CMake implementation
  • Rewrite architecture logic to use CMAKE_CUDA_ARCHITECTURES instead of per-arch boolean options.
  • Update logic for setting architectures on RDC vs non-RDC builds.
  • Set CUDA architecture and RDC state using per-target properties, rather than directory-wide modifications to CMAKE_CUDA_FLAGS.
  • Replace the existing RDC enable/disable options with ${PROJ}_ENABLE_RDC_TESTS (enables tests/examples that require RDC) and ${PROJ}_FORCE_RDC (Enable RDC for all targets, except those that explicit test RDC=off).

CMake Package Implementation

  • Create cccl-config.cmake and cccl-config-version.cmake in ${CCCL_SOURCE_DIR}/share/cmake/cccl/
  • Implement semantic version checks.
  • Install the CCCL CMake package to ${CMAKE_INSTALL_LIBDIR}/cmake/cccl
  • find_package(CCCL) finds all subprojects using existing subproject infrastructure.
  • find_package(CCCL COMPONENTS [Thrust] [CUB] [libcudacxx]) only loads requested components and their dependencies using existing subproject infrastructure.
  • add_subdirectory(${CCCL_SOURCE_DIR}) is effectively identical to find_package(CCCL) for users.
  • CCCL_REQUIRED_COMPONENTS and CCCL_OPTIONAL_COMPONENTS variables equivalent to the COMPONENT options in find_package.
  • add_subdirectory will continue to work directly on subproject directories (i.e. add_subdirectory(${CCCL_SOURCE_DIR}/thrust) is equivalent to find_package(CCCL COMPONENT Thrust)). This will reuse existing infrastructure.
  • find_package(Thrust|CUB|libcudacxx) will continue to work using existing infrastructure.

CMake Package Testing

  • Add automated tests for validating find_package(CCCL [COMPONENTS Thrust|CUB|libcudacxx]) for both installed CCCL and the source repo.
  • Add automated tests for validating find_package(Thrust|CUB|libcudacxx) for both installed CCCL and the source repo.
  • Add automated tests for validating add_subdirectory usecase for CCCL and all subprojects, source tree only.
  • Add automated tests for validating the CCCL_(REQUIRED|OPTIONAL)_COMPONENTS options for add_subdirectory.

Next Steps

After the monorepo is in place, the following tasks are worth considering:

  • Explore costs/benefits of using rapids-cmake across all projects.
  • Move shared infra to the CCCL repo (Thrust/CUB have a lot of redundant CMake infra).
  • Move Thrust/CUB/libcudacxx cmake packages into the same location as the CCCL package.
  • Further CDP/RDC cleanup -- FORCE_RDC should be able to build with RDC on all arches, but the CDP tests require restricted arches. This will also involve updating our CUDA/C++ implementations.

Thrust

Tasks

  • Update libcudacxx dependency to always require the same version as CUB

Metadata

Metadata

Assignees

Labels

infraShared CMake, github, etc infrastructure

Type

No type
No fields configured for issues without a type.

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions