[INFRA] Import NVIDIA/CCCL upstream as optimization reference library
CCCL (CUDA C++ Core Libraries) provides: - CUB: device/block/warp-level GPU primitives (reduce, scan, sort, topk) - Thrust: high-level parallel algorithms (transform_reduce, sort, scan) - libcudacxx: CUDA C++ standard library (atomics, barriers, memory) - cudax: experimental features (memory resources, allocators) - Tuning policies: per-SM hardware-specific algorithm parameters Competition optimization vectors mapped to CCCL: - Output TPS (83% weight): warp_reduce, block_reduce, device_topk - Input TPS (14% weight): device_scan, block_load, prefetch - Cache TPS (3% weight): prefix caching strategy patterns - Memory (0.9 util): pooled/cached/buddy allocators Source: https://github.com/NVIDIA/cccl (shallow clone, HEAD only) License: Apache-2.0
This commit is contained in:
163
cccl_upstream/CMakeLists.txt
Normal file
163
cccl_upstream/CMakeLists.txt
Normal file
@@ -0,0 +1,163 @@
|
||||
# 3.18 is the minimum for including the project with add_subdirectory.
|
||||
# 3.21 is the minimum for the developer build.
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
|
||||
# sccache cannot handle the -Fd option generating pdb files:
|
||||
if (POLICY CMP0141)
|
||||
cmake_policy(SET CMP0141 NEW)
|
||||
endif()
|
||||
|
||||
# Determine whether CCCL is the top-level project or included into
|
||||
# another project via add_subdirectory()
|
||||
|
||||
if (NOT DEFINED CCCL_TOPLEVEL_PROJECT)
|
||||
# DO NOT REMOVE THE FOLLOWING LINE
|
||||
set(CCCL_TOPLEVEL_PROJECT OFF)
|
||||
# REQUIRED FOR CCCL TO WORK VIA CPM WITH INSTALL RULES
|
||||
|
||||
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
|
||||
set(CCCL_TOPLEVEL_PROJECT ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Enable CXX so CMake can configure install paths
|
||||
project(CCCL LANGUAGES CXX)
|
||||
|
||||
# Enable CCCL specific platform files
|
||||
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
include(cmake/CCCLInstallRules.cmake)
|
||||
|
||||
# Support adding CCCL to a parent project via add_subdirectory.
|
||||
include(cmake/CCCLAddSubdirHelper.cmake) # Always include, this is used by subprojects as well.
|
||||
if (NOT CCCL_TOPLEVEL_PROJECT)
|
||||
include(cmake/CCCLAddSubdir.cmake)
|
||||
endif()
|
||||
|
||||
if (CCCL_TOPLEVEL_PROJECT AND NOT CCCL_SKIP_BUILD_CHECKS)
|
||||
# We require a higher cmake version for dev builds
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
|
||||
# Handle special CCCL values for CMAKE_CUDA_ARCHITECTURES
|
||||
include(cmake/CCCLCheckCudaArchitectures.cmake)
|
||||
cccl_check_cuda_architectures()
|
||||
|
||||
# Perform developer build checks
|
||||
include(cmake/CCCLDevBuildChecks.cmake)
|
||||
cccl_dev_build_checks()
|
||||
endif()
|
||||
|
||||
option(CCCL_ENABLE_LIBCUDACXX "Enable the libcu++ developer build." OFF)
|
||||
option(CCCL_ENABLE_CUB "Enable the CUB developer build." OFF)
|
||||
option(CCCL_ENABLE_THRUST "Enable the Thrust developer build." OFF)
|
||||
option(CCCL_ENABLE_TESTING "Enable CUDA C++ Core Library tests." OFF)
|
||||
option(CCCL_ENABLE_EXAMPLES "Enable CUDA C++ Core Library examples." OFF)
|
||||
option(CCCL_ENABLE_C_PARALLEL "Enable CUDA C Parallel Library." OFF)
|
||||
option(
|
||||
CCCL_ENABLE_C_PARALLEL_V2
|
||||
"Enable CUDA C Parallel Library v2 (HostJIT-based)."
|
||||
OFF
|
||||
)
|
||||
option(CCCL_ENABLE_C_EXPERIMENTAL_STF "Enable CUDA C CUDASTF Library." OFF)
|
||||
option(CCCL_ENABLE_NVBENCH_HELPER "Enable the NVBench Helper Dev Build." OFF)
|
||||
|
||||
if ("NVHPC" STREQUAL "${CMAKE_CXX_COMPILER_ID}")
|
||||
set(CCCL_ENABLE_BENCHMARKS OFF)
|
||||
else()
|
||||
option(CCCL_ENABLE_BENCHMARKS "Enable CUDA C++ Core Library benchmarks." OFF)
|
||||
endif()
|
||||
|
||||
option(CCCL_ENABLE_TILE "Enable tile support" OFF)
|
||||
|
||||
option(
|
||||
CCCL_ENABLE_UNSTABLE
|
||||
"Enable targets and developer build options for unstable projects."
|
||||
OFF
|
||||
)
|
||||
if (CCCL_ENABLE_UNSTABLE)
|
||||
option(
|
||||
CCCL_ENABLE_CUDAX
|
||||
"Enable the CUDA Experimental developer build."
|
||||
${CCCL_TOPLEVEL_PROJECT}
|
||||
)
|
||||
else()
|
||||
# Always off if unstable disabled:
|
||||
# Note that this doesn't override the cache variable, but rather creates a new
|
||||
# directory-scoped variable that shadows it. This is sufficient for our purposes.
|
||||
set(CCCL_ENABLE_CUDAX OFF)
|
||||
endif()
|
||||
|
||||
option(CCCL_ENABLE_CLANG_TIDY "Enable clang-tidy" OFF)
|
||||
mark_as_advanced(CCCL_ENABLE_CLANG_TIDY)
|
||||
|
||||
if (CCCL_TOPLEVEL_PROJECT)
|
||||
include(cmake/CCCLAddTidyTarget.cmake)
|
||||
|
||||
if (CCCL_ENABLE_CLANG_TIDY)
|
||||
cccl_tidy_init()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
|
||||
option(CCCL_USE_LIBCXX "Use libc++ when compiling and linking" OFF)
|
||||
|
||||
if (CCCL_TOPLEVEL_PROJECT)
|
||||
include(cmake/AppendOptionIfAvailable.cmake)
|
||||
include(cmake/CCCLUtilities.cmake) # include this before other CCCL helpers
|
||||
|
||||
include(cmake/CCCLAddExecutable.cmake)
|
||||
include(cmake/CCCLBuildCompilerTargets.cmake)
|
||||
include(cmake/CCCLClangdCompileInfo.cmake)
|
||||
include(cmake/CCCLConfigureTarget.cmake)
|
||||
include(cmake/CCCLEnsureMetaTargets.cmake)
|
||||
include(cmake/CCCLGenerateHeaderTests.cmake)
|
||||
include(cmake/CCCLGetDependencies.cmake)
|
||||
include(cmake/CCCLTestParams.cmake)
|
||||
|
||||
cccl_build_compiler_targets()
|
||||
endif()
|
||||
|
||||
option(
|
||||
CCCL_ENABLE_CUDA_SMOKE_TESTS
|
||||
"Build the CUDA runtime smoke test (cccl.test.cuda_runtime_smoke)."
|
||||
OFF
|
||||
)
|
||||
set(CCCL_CUDA_SMOKE_TARGET cccl.test.cuda_runtime_smoke)
|
||||
|
||||
add_subdirectory(libcudacxx)
|
||||
add_subdirectory(cub)
|
||||
add_subdirectory(thrust)
|
||||
|
||||
if (CCCL_ENABLE_UNSTABLE)
|
||||
add_subdirectory(cudax)
|
||||
endif()
|
||||
|
||||
if (
|
||||
CCCL_ENABLE_C_PARALLEL
|
||||
OR CCCL_ENABLE_C_PARALLEL_V2
|
||||
OR CCCL_ENABLE_C_EXPERIMENTAL_STF
|
||||
)
|
||||
add_subdirectory(c)
|
||||
endif()
|
||||
|
||||
if (CCCL_ENABLE_TESTING)
|
||||
add_subdirectory("ci")
|
||||
add_subdirectory("test")
|
||||
endif()
|
||||
|
||||
if (CCCL_ENABLE_CUDA_SMOKE_TESTS AND CCCL_TOPLEVEL_PROJECT)
|
||||
add_subdirectory(test/cuda_smoke)
|
||||
endif()
|
||||
|
||||
if (CCCL_ENABLE_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
if (CCCL_ENABLE_NVBENCH_HELPER)
|
||||
add_subdirectory(nvbench_helper)
|
||||
endif()
|
||||
|
||||
# Must stay at the end of this file.
|
||||
include(cmake/CCCLHideThirdPartyOptions.cmake)
|
||||
Reference in New Issue
Block a user