Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into enh/streaming-selec…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
elstehle committed Oct 8, 2024
2 parents 8abd5e9 + 8aaeb29 commit d12f79a
Show file tree
Hide file tree
Showing 426 changed files with 7,264 additions and 5,152 deletions.
1 change: 0 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ AlwaysBreakTemplateDeclarations: Yes
AttributeMacros: [
'_CCCL_ALIGNAS_TYPE',
'_CCCL_ALIGNAS',
'_CCCL_ALWAYS_INLINE',
'_CCCL_CONSTEXPR_CXX14',
'_CCCL_CONSTEXPR_CXX17',
'_CCCL_CONSTEXPR_CXX20',
Expand Down
25 changes: 8 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ option(CCCL_ENABLE_C "Enable CUDA C Core Library." 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." ON)
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()

include(CTest)
Expand All @@ -53,26 +58,12 @@ if (CCCL_TOPLEVEL_PROJECT)
include(cmake/CCCLBuildCompilerTargets.cmake)
include(cmake/CCCLClangdCompileInfo.cmake)
include(cmake/CCCLConfigureTarget.cmake)
include(cmake/CCCLGenerateHeaderTests.cmake)
include(cmake/CCCLGetDependencies.cmake)

cccl_build_compiler_targets()
endif()

if (CCCL_ENABLE_LIBCUDACXX)
set(LIBCUDACXX_TOPLEVEL_PROJECT ${CCCL_TOPLEVEL_PROJECT})
endif()

if (CCCL_ENABLE_CUB)
set(CUB_TOPLEVEL_PROJECT ${CCCL_TOPLEVEL_PROJECT})
endif()

if (CCCL_ENABLE_THRUST)
set(THRUST_TOPLEVEL_PROJECT ${CCCL_TOPLEVEL_PROJECT})
endif()

if (CCCL_ENABLE_CUDAX)
set(cudax_TOPLEVEL_PROJECT ${CCCL_TOPLEVEL_PROJECT})
endif()

add_subdirectory(libcudacxx)
add_subdirectory(cub)
add_subdirectory(thrust)
Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"CCCL_ENABLE_EXAMPLES": false,
"libcudacxx_ENABLE_INSTALL_RULES": true,
"CUB_ENABLE_INSTALL_RULES": true,
"THRUST_ENABLE_INSTALL_RULES": true,
"Thrust_ENABLE_INSTALL_RULES": true,
"cudax_ENABLE_INSTALL_RULES": true
}
},
Expand Down
5 changes: 3 additions & 2 deletions ci/matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ workflows:
# Python jobs:
- {jobs: ['test'], project: 'pycuda', ctk: ['12.5']}
# cccl-infra:
- {jobs: ['infra'], project: 'cccl', ctk: '11.1', cxx: ['gcc6', 'clang9']}
- {jobs: ['infra'], project: 'cccl', ctk: 'curr', cxx: ['gcc', 'clang']}
- {jobs: ['infra'], project: 'cccl', ctk: '11.1', cxx: ['gcc6', 'clang9']}
- {jobs: ['infra'], project: 'cccl', ctk: '12.0', cxx: ['gcc12', 'clang14']}
- {jobs: ['infra'], project: 'cccl', ctk: 'curr', cxx: ['gcc', 'clang']}

nightly:
# Increased test coverage compared to nightlies:
Expand Down
111 changes: 111 additions & 0 deletions cmake/CCCLGenerateHeaderTests.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Usage:
# cccl_generate_header_tests(<target_name> <project_include_path>
# [cccl_configure_target options]
# [LANGUAGE <CXX|CUDA>]
# [HEADER_TEMPLATE <template>]
# [GLOBS <glob1> [glob2 ...]]
# [EXCLUDES <glob1> [glob2 ...]]
# [HEADERS <header1> [header2 ...]]
# )
#
# Options:
# target_name: The name of the meta-target that will build this set of header tests.
# project_include_path: The path to the project's include directory, relative to <CCCL_SOURCE_DIR>.
# cccl_configure_target options: Options to pass to cccl_configure_target. Must appear before any other named arguments.
# LANGUAGE: The language to use for the header tests. Defaults to CUDA.
# HEADER_TEMPLATE: A file that will be used as a template for each header test. The template will be configured for each header.
# GLOBS: All files that match these globbing patterns will be included in the header tests, unless they also match EXCLUDES.
# EXCLUDES: Files that match these globbing patterns will be excluded from the header tests.
# HEADERS: An explicit list of headers to include in the header tests.
#
# Notes:
# - The header globs are applied relative to <project_include_path>.
# - If no HEADER_TEMPLATE is provided, a default template will be used.
# - The HEADER_TEMPLATE will be configured for each header, with the following variables:
# - @header@: The path to the target header, relative to <project_include_path>.
function(cccl_generate_header_tests target_name project_include_path)
set(options)
set(oneValueArgs LANGUAGE HEADER_TEMPLATE)
set(multiValueArgs GLOBS EXCLUDES HEADERS DEFINES)
cmake_parse_arguments(CGHT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

# Setup defaults
if (NOT DEFINED CGHT_LANGUAGE)
set(CGHT_LANGUAGE CUDA)
endif()

if (NOT DEFINED CGHT_HEADER_TEMPLATE)
set(CGHT_HEADER_TEMPLATE "${CCCL_SOURCE_DIR}/cmake/header_test.cu.in")
endif()

# Derived vars:
if (${CGHT_LANGUAGE} STREQUAL "CXX")
set(extension "cpp")
elseif(${CGHT_LANGUAGE} STREQUAL "CUDA")
set(extension "cu")
else()
message(FATAL_ERROR "Unsupported language: ${CGHT_LANGUAGE}")
endif()

set(cccl_configure_target_options ${CGHT_UNPARSED_ARGUMENTS})
set(base_path "${CCCL_SOURCE_DIR}/${project_include_path}")

# Prepend the basepath to all globbing expressions:
if (DEFINED CGHT_GLOBS)
set(globs)
foreach (glob IN LISTS CGHT_GLOBS)
list(APPEND globs "${base_path}/${glob}")
endforeach()
set(CGHT_GLOBS ${globs})
endif()
if (DEFINED CGHT_EXCLUDES)
set(excludes)
foreach (exclude IN LISTS CGHT_EXCLUDES)
list(APPEND excludes "${base_path}/${exclude}")
endforeach()
set(CGHT_EXCLUDES ${excludes})
endif()

# Determine header list
set(headers)

# Add globs:
if (DEFINED CGHT_GLOBS)
file(GLOB_RECURSE headers
RELATIVE "${base_path}"
CONFIGURE_DEPENDS
${CGHT_GLOBS}
)
endif()

# Remove excludes:
if (DEFINED CGHT_EXCLUDES)
file(GLOB_RECURSE header_excludes
RELATIVE "${base_path}"
CONFIGURE_DEPENDS
${CGHT_EXCLUDES}
)
list(REMOVE_ITEM headers ${header_excludes})
endif()

# Add explicit headers:
if (DEFINED CGHT_HEADERS)
list(APPEND headers ${CGHT_HEADERS})
endif()

# Cleanup:
list(REMOVE_DUPLICATES headers)

# Configure header templates:
set(header_srcs)
foreach (header IN LISTS headers)
set(header_src "${CMAKE_CURRENT_BINARY_DIR}/headers/${target_name}/${header}.${extension}")
configure_file(${CGHT_HEADER_TEMPLATE} ${header_src} @ONLY)
list(APPEND header_srcs ${header_src})
endforeach()

# Object library that compiles each header:
add_library(${target_name} OBJECT ${header_srcs})
cccl_configure_target(${target_name} ${cccl_configure_target_options})

endfunction()
33 changes: 33 additions & 0 deletions cmake/CCCLGetDependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
set(_cccl_cpm_file "${CMAKE_CURRENT_LIST_DIR}/CPM.cmake")

macro(cccl_get_boost)
include("${_cccl_cpm_file}")
CPMAddPackage("gh:boostorg/boost#boost-1.83.0")
endmacro()

macro(cccl_get_catch2)
include("${_cccl_cpm_file}")
CPMAddPackage("gh:catchorg/[email protected]")
endmacro()

macro(cccl_get_fmt)
include("${_cccl_cpm_file}")
CPMAddPackage("gh:fmtlib/fmt#11.0.1")
endmacro()

macro(cccl_get_nvbench)
include("${_cccl_cpm_file}")
CPMAddPackage("gh:NVIDIA/nvbench#main")
endmacro()

macro(cccl_get_nvtx)
include("${_cccl_cpm_file}")
CPMAddPackage(
NAME NVTX
GITHUB_REPOSITORY NVIDIA/NVTX
GIT_TAG release-v3
DOWNLOAD_ONLY
SYSTEM
)
include("${NVTX_SOURCE_DIR}/c/nvtxImportedTargets.cmake")
endmacro()
Loading

0 comments on commit d12f79a

Please sign in to comment.