This repository was archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 455
Initial port to new monorepo build system. #704
Draft
alliepiper
wants to merge
14
commits into
NVIDIA:main
Choose a base branch
from
alliepiper:monorepo_submodules
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9b5602b
Initial port to new monorepo build system.
alliepiper 5a9f2f5
Update CMake option docs.
alliepiper 1c50fa1
Allow TOPLEVEL_PROJECT logic to be force enabled.
alliepiper ee11618
Version lock CUB with other CCCL libraries.
alliepiper e270c96
Remove temporary warning suppression.
alliepiper c01ca1c
Add `LANGUAGES` keyword to CMake project calls.
alliepiper 531d17a
Simplify some genexes and update compiler ID where needed.
alliepiper fe632ba
Remove unnecessary NVC++ tweaks.
alliepiper 0e82f72
Add guards against unsupported arch options.
alliepiper 33259c1
Enable PIC for RDC targets.
alliepiper 2a20a0e
Update more CUDA compiler ID checks.
alliepiper 7ec9756
Move dev build toggle to the cccl project level.
alliepiper 3079077
Remove install tests from Thrust/CUB.
alliepiper b729edb
Update how RDC settings are applied to Catch2 utilities.
alliepiper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,16 @@ | ||
# Set up compiler paths and apply temporary hacks to support NVC++. | ||
# This file must be included before enabling any languages. | ||
|
||
# Temporary hacks to make NVC++ work; this requires you to define | ||
# `CMAKE_CUDA_COMPILER_ID=NVCXX` and `CMAKE_CUDA_COMPILER_FORCED=ON`. | ||
if ("NVCXX" STREQUAL "${CMAKE_CUDA_COMPILER_ID}") | ||
# If using NVC++, don't set CXX compiler | ||
if (NOT "${CMAKE_CXX_COMPILER}" STREQUAL "") | ||
unset(CMAKE_CXX_COMPILER CACHE) | ||
message(FATAL_ERROR "You are using NVC++ as your CUDA C++ compiler, but have" | ||
" specified a different ISO C++ compiler; NVC++ acts as both, so please" | ||
" unset the CMAKE_CXX_COMPILER variable." | ||
) | ||
endif() | ||
|
||
# We don't set CMAKE_CUDA_HOST_COMPILER for NVC++; if we do, CMake tries to | ||
# pass `-ccbin ${CMAKE_CUDA_HOST_COMPILER}` to NVC++, which it doesn't | ||
# understand. | ||
if (NOT "${CMAKE_CUDA_HOST_COMPILER}" STREQUAL "") | ||
unset(CMAKE_CUDA_HOST_COMPILER CACHE) | ||
message(FATAL_ERROR "You are using NVC++ as your CUDA C++ compiler, but have" | ||
" specified a different host ISO C++ compiler; NVC++ acts as both, so" | ||
" please unset the CMAKE_CUDA_HOST_COMPILER variable." | ||
) | ||
endif() | ||
|
||
set(CMAKE_CXX_COMPILER "${CMAKE_CUDA_COMPILER}") | ||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -cuda") | ||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${CMAKE_CUDA_COMPILER}") | ||
set(CMAKE_CUDA_LINK_EXECUTABLE | ||
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") | ||
endif () | ||
|
||
# We don't set CMAKE_CUDA_HOST_COMPILER for NVC++; if we do, CMake tries to | ||
# pass `-ccbin ${CMAKE_CUDA_HOST_COMPILER}` to NVC++, which it doesn't | ||
# understand. | ||
if ((NOT "NVCXX" STREQUAL "${CMAKE_CUDA_COMPILER_ID}")) | ||
if (NOT ("${CMAKE_CUDA_HOST_COMPILER}" STREQUAL "" OR | ||
"${CMAKE_CUDA_HOST_COMPILER}" STREQUAL "${CMAKE_CXX_COMPILER}")) | ||
set(tmp "${CMAKE_CUDA_HOST_COMPILER}") | ||
unset(CMAKE_CUDA_HOST_COMPILER CACHE) | ||
message(FATAL_ERROR | ||
"For convenience, CUB's test harness uses CMAKE_CXX_COMPILER for the " | ||
"CUDA host compiler. Refusing to overwrite specified " | ||
"CMAKE_CUDA_HOST_COMPILER -- please reconfigure without setting this " | ||
"variable. Currently:\n" | ||
"CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}\n" | ||
"CMAKE_CUDA_HOST_COMPILER=${tmp}" | ||
) | ||
endif () | ||
set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}") | ||
endif () | ||
|
||
# Temporary hacks to make NVC++ work; this requires you to define | ||
# `CMAKE_CUDA_COMPILER_ID=NVCXX` and `CMAKE_CUDA_COMPILER_FORCED=ON`. | ||
if ("NVCXX" STREQUAL "${CMAKE_CUDA_COMPILER_ID}") | ||
# Need 3.17 for the properties used below. | ||
cmake_minimum_required(VERSION 3.17) | ||
|
||
set(CMAKE_CUDA_STANDARD_DEFAULT 03) | ||
|
||
set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "-std=c++03") | ||
set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "-std=c++03") | ||
set(CMAKE_CUDA03_STANDARD__HAS_FULL_SUPPORT TRUE) | ||
set_property(GLOBAL PROPERTY CMAKE_CUDA03_KNOWN_FEATURES) | ||
|
||
set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11") | ||
set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11") | ||
set(CMAKE_CUDA11_STANDARD__HAS_FULL_SUPPORT TRUE) | ||
set_property(GLOBAL PROPERTY CMAKE_CUDA11_KNOWN_FEATURES) | ||
|
||
set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14") | ||
set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14") | ||
set(CMAKE_CUDA14_STANDARD__HAS_FULL_SUPPORT TRUE) | ||
set_property(GLOBAL PROPERTY CMAKE_CUDA14_KNOWN_FEATURES) | ||
|
||
set(CMAKE_CUDA17_STANDARD_COMPILE_OPTION "-std=c++17") | ||
set(CMAKE_CUDA17_EXTENSION_COMPILE_OPTION "-std=c++17") | ||
set(CMAKE_CUDA17_STANDARD__HAS_FULL_SUPPORT TRUE) | ||
set_property(GLOBAL PROPERTY CMAKE_CUDA17_KNOWN_FEATURES) | ||
|
||
include(Internal/FeatureTesting) | ||
include(Compiler/CMakeCommonCompilerMacros) | ||
cmake_record_cuda_compile_features() | ||
|
||
set(CMAKE_CUDA_COMPILE_FEATURES | ||
${CMAKE_CUDA03_COMPILE_FEATURES} | ||
${CMAKE_CUDA11_COMPILE_FEATURES} | ||
${CMAKE_CUDA14_COMPILE_FEATURES} | ||
${CMAKE_CUDA17_COMPILE_FEATURES} | ||
${CMAKE_CUDA20_COMPILE_FEATURES} | ||
if (NOT ("${CMAKE_CUDA_HOST_COMPILER}" STREQUAL "" OR | ||
"${CMAKE_CUDA_HOST_COMPILER}" STREQUAL "${CMAKE_CXX_COMPILER}")) | ||
set(tmp "${CMAKE_CUDA_HOST_COMPILER}") | ||
unset(CMAKE_CUDA_HOST_COMPILER CACHE) | ||
message(FATAL_ERROR | ||
"For convenience, CUB's test harness uses CMAKE_CXX_COMPILER for the " | ||
"CUDA host compiler. Refusing to overwrite specified " | ||
"CMAKE_CUDA_HOST_COMPILER -- please reconfigure without setting this " | ||
"variable. Currently:\n" | ||
"CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}\n" | ||
"CMAKE_CUDA_HOST_COMPILER=${tmp}" | ||
) | ||
endif () | ||
set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,34 @@ | ||
enable_language(CUDA) | ||
|
||
if (NOT CUB_IN_THRUST) | ||
message(FATAL_ERROR | ||
"Building CUB as a standalone project is no longer supported. " | ||
"Use the Thrust repo instead.") | ||
endif() | ||
|
||
set(CUB_CUDA_FLAGS_BASE "${THRUST_CUDA_FLAGS_BASE}") | ||
set(CUB_CUDA_FLAGS_RDC "${THRUST_CUDA_FLAGS_RDC}") | ||
set(CUB_CUDA_FLAGS_NO_RDC "${THRUST_CUDA_FLAGS_NO_RDC}") | ||
|
||
# Update the enabled architectures list from thrust | ||
foreach (arch IN LISTS THRUST_KNOWN_COMPUTE_ARCHS) | ||
if (THRUST_ENABLE_COMPUTE_${arch}) | ||
set(CUB_ENABLE_COMPUTE_${arch} True) | ||
string(APPEND arch_message " sm_${arch}") | ||
else() | ||
set(CUB_ENABLE_COMPUTE_${arch} False) | ||
endif() | ||
endforeach() | ||
|
||
message(STATUS ${arch_message}) | ||
|
||
# | ||
# RDC options: | ||
# Architecture options: | ||
# | ||
|
||
# RDC is off by default in NVCC and on by default in NVC++. Turning off RDC | ||
# isn't currently supported by NVC++. So, we default to RDC off for NVCC and | ||
# RDC on for NVC++. | ||
set(option_init OFF) | ||
if ("NVCXX" STREQUAL "${CMAKE_CUDA_COMPILER_ID}") | ||
set(option_init ON) | ||
# Since we have to filter the arch list based on target features, we don't | ||
# currently support the convenience arch flags: | ||
if ("all" IN_LIST CMAKE_CUDA_ARCHITECTURES OR | ||
"all-major" IN_LIST CMAKE_CUDA_ARCHITECTURES OR | ||
"native" IN_LIST CMAKE_CUDA_ARCHITECTURES) | ||
message(FATAL_ERROR | ||
"The CUB dev build requires an explicit list of architectures in CMAKE_CUDA_ARCHITECTURES. " | ||
"The convenience flags of 'all', 'all-major', and 'native' are not supported.\n" | ||
"CMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES}") | ||
endif() | ||
|
||
option(CUB_ENABLE_TESTS_WITH_RDC | ||
"Build all CUB tests with RDC; tests that require RDC are not affected by this option." | ||
${option_init} | ||
) | ||
|
||
option(CUB_ENABLE_EXAMPLES_WITH_RDC | ||
"Build all CUB examples with RDC; examples which require RDC are not affected by this option." | ||
${option_init} | ||
) | ||
# Create a new arch list that only contains arches that support CDP: | ||
set(CUB_CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES}) | ||
set(CUB_CUDA_ARCHITECTURES_RDC ${CUB_CUDA_ARCHITECTURES}) | ||
list(FILTER CUB_CUDA_ARCHITECTURES_RDC EXCLUDE REGEX "53|62|72|90") | ||
|
||
# Check for RDC/SM compatibility and error/warn if necessary | ||
set(rdc_supported True) | ||
foreach (arch IN LISTS no_rdc_archs) | ||
if (CUB_ENABLE_COMPUTE_${arch}) | ||
set(rdc_supported False) | ||
break() | ||
endif() | ||
endforeach() | ||
message(STATUS "CUB_CUDA_ARCHITECTURES: ${CUB_CUDA_ARCHITECTURES}") | ||
message(STATUS "CUB_CUDA_ARCHITECTURES_RDC: ${CUB_CUDA_ARCHITECTURES_RDC}") | ||
|
||
set(rdc_opts | ||
CUB_ENABLE_TESTS_WITH_RDC | ||
CUB_ENABLE_EXAMPLES_WITH_RDC | ||
) | ||
set(rdc_requested False) | ||
foreach (rdc_opt IN LISTS rdc_opts) | ||
if (${rdc_opt}) | ||
set(rdc_requested True) | ||
break() | ||
endif() | ||
endforeach() | ||
option(CUB_ENABLE_RDC_TESTS "Enable tests that require separable compilation." ON) | ||
option(CUB_FORCE_RDC "Enable separable compilation on all targets that support it." OFF) | ||
|
||
if (rdc_requested AND NOT rdc_supported) | ||
string(JOIN ", " no_rdc ${no_rdc_archs}) | ||
string(JOIN "\n" opts ${rdc_opts}) | ||
message(FATAL_ERROR | ||
"Architectures {${no_rdc}} do not support RDC and are incompatible with " | ||
"these options:\n${opts}" | ||
) | ||
endif() | ||
|
||
|
||
# | ||
# | ||
# Clang CUDA options | ||
# | ||
if ("Clang" STREQUAL "${CMAKE_CUDA_COMPILER_ID}") | ||
set(CUB_CUDA_FLAGS_BASE "${CUB_CUDA_FLAGS_BASE} -Wno-unknown-cuda-version -Xclang=-fcuda-allow-variadic-functions") | ||
endif() | ||
|
||
|
||
# By default RDC is not used: | ||
set(CMAKE_CUDA_FLAGS "${CUB_CUDA_FLAGS_BASE} ${CUB_CUDA_FLAGS_NO_RDC}") | ||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-unknown-cuda-version -Xclang=-fcuda-allow-variadic-functions") | ||
endif () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.