Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial monorepo setup. #88

Closed
wants to merge 408 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
408 commits
Select commit Hold shift + click to select a range
cf9c8c4
Attempt to pass per CUDA matrix to nested workflow.
jrhemstad May 30, 2023
794c1a5
Fix syntax
jrhemstad May 30, 2023
ff51fe8
Update per_cuda to pass the per_cuda_matrix to include:
jrhemstad May 30, 2023
942429d
Test if I can access field fromJSON
jrhemstad May 30, 2023
4d9fe86
Add missing runs-on
jrhemstad May 30, 2023
89d9b2d
Wrap with toJSON to get it to print.
jrhemstad May 30, 2023
8ae3755
Try passing the per_cuda_matrix to the per_cuda workflow again.
jrhemstad May 30, 2023
11b3423
Wrap with toJSON.
jrhemstad May 30, 2023
d5f1d52
Make per_cuda a matrix job on the provided matrix.
jrhemstad May 30, 2023
7ce3f0b
Remove commented code.
jrhemstad May 30, 2023
0af43bb
Add cuda version to per_cuda job.
jrhemstad May 30, 2023
9a1a6ed
Add per_compiler workflow.
jrhemstad May 30, 2023
958fa09
Add missing compiler_name input.
jrhemstad May 30, 2023
606fdd8
Don't wrap build matrix in "include{}" to avoid hard coding into the …
jrhemstad May 30, 2023
fba52e4
Correctly pass per_cuda_matrix into get_groups
jrhemstad May 30, 2023
47dfc05
Extra name field.
jrhemstad May 30, 2023
071a3c3
Wrap the inputs.per_cuda_matrix in quotes.
jrhemstad May 30, 2023
64623ff
Store input to environment variable.
jrhemstad May 30, 2023
c9e2e99
Don't use fromJSON when assigning to variable.
jrhemstad May 30, 2023
8d890d0
Use new approach where entire matrix is passed through and later filt…
jrhemstad May 30, 2023
a778156
Remove defunct dependency.
jrhemstad May 30, 2023
38689bc
Update names and add stub CUB.
jrhemstad May 30, 2023
884d817
Update thrust/cub names.
jrhemstad May 30, 2023
2eb14b8
Make per_compiler a matrix.
jrhemstad May 30, 2023
c7da9e2
Fix matrix variable name.
jrhemstad May 30, 2023
79cf0e6
Store matrix to envrionment variable first.
jrhemstad May 30, 2023
57b49dd
Single quotes the full matrix.
jrhemstad May 30, 2023
3129f60
Test is passing matrix is working correctly.
jrhemstad May 30, 2023
e0177f2
Double quotes.
jrhemstad May 30, 2023
fa66c83
Restore computing per compiler matrix.
jrhemstad May 30, 2023
79d8b0f
Use toJSON
jrhemstad May 30, 2023
0f21fec
Test matrix assignment.
jrhemstad May 30, 2023
5bb4a7b
test
jrhemstad May 30, 2023
1649795
test
jrhemstad May 30, 2023
5472ae2
test2
jrhemstad May 30, 2023
39b7a24
Use toJSON
jrhemstad May 30, 2023
1651cab
Don't quote toJSON output
jrhemstad May 30, 2023
f2ad7bc
Restore setting PER_COMPILER_MATRIX.
jrhemstad May 30, 2023
8c176ee
Make per_compiler depend on matrix job.
jrhemstad May 30, 2023
2f29d60
Fix per_compiler name.
jrhemstad May 30, 2023
986ecc8
Remove per_compiler name.
jrhemstad May 30, 2023
410b7d1
Rename to per_library.
jrhemstad May 30, 2023
ed09d7f
Update top-level matrix to explode cuda/host compiler.
jrhemstad May 30, 2023
3d8f885
Missing quotes in format call
jrhemstad May 30, 2023
9795615
Fix per_cuda name.
jrhemstad May 30, 2023
3edc03c
Fix passed compiler.
jrhemstad May 30, 2023
47cb54f
Fix thrust name.
jrhemstad May 30, 2023
c7d4168
Update per_cuda name.
jrhemstad May 30, 2023
06ba886
Fix per cuda name again.
jrhemstad May 30, 2023
af81f0f
Add C++ dialect and CPU to name.
jrhemstad May 30, 2023
fa95636
Add CUB/libcu++.
jrhemstad May 30, 2023
3a21bfb
Fix libcu++ name
jrhemstad May 30, 2023
c5a9365
Add build/test
jrhemstad May 30, 2023
ceee780
Make per_cuda call another build-and-test workflow.
jrhemstad May 31, 2023
537de60
Fix steps.
jrhemstad May 31, 2023
e5137bd
Remove unneccessary passing of cuda/compiler to per_cuda.
jrhemstad May 31, 2023
5ec9e86
missing brace
jrhemstad May 31, 2023
133b46f
Remove space.
jrhemstad May 31, 2023
db1cc0b
test hang.
jrhemstad May 31, 2023
35508bb
Test hanging workflow
jrhemstad May 31, 2023
8a451d6
Fix echo
jrhemstad May 31, 2023
4dff392
Fix passed matrix entries
jrhemstad May 31, 2023
2c9c159
Test why is it hanging
jrhemstad May 31, 2023
a36c8fd
Test cuda_version
jrhemstad May 31, 2023
f094bbf
test compiler.name
jrhemstad May 31, 2023
ecd8596
Test passing all matrix fields.
jrhemstad May 31, 2023
76d4da8
remove build archs
jrhemstad May 31, 2023
3a50521
Add random sleep to build step.
jrhemstad May 31, 2023
7502a28
Missing paren
jrhemstad May 31, 2023
08d4af1
Make cuda11 sleep for 10m
jrhemstad May 31, 2023
7ebaa9c
Fix sleep time.
jrhemstad May 31, 2023
c6787d9
Reference the right input...
jrhemstad May 31, 2023
995ec60
Make C++14 builds sleep
jrhemstad May 31, 2023
671f54c
Add a comment that explains the overlap.
jrhemstad May 31, 2023
25bc3a8
Remove sleep
jrhemstad May 31, 2023
e3558e1
Restructure workflow files
jrhemstad May 31, 2023
41bf24b
Rename per_cuda
jrhemstad May 31, 2023
a5ab85c
Update step names
jrhemstad May 31, 2023
2e16520
Only run test if build succeeded.
jrhemstad May 31, 2023
5f92657
Add references to stub build/test scripts.
jrhemstad May 31, 2023
9104134
fail-fast false
jrhemstad May 31, 2023
b6893d3
Flesh out build and test jobs.
jrhemstad May 31, 2023
7a26196
Update stub test scripts
jrhemstad May 31, 2023
4bebf4d
Factor format call into env
jrhemstad May 31, 2023
165f431
Undo factoring format into env.
jrhemstad May 31, 2023
8f0cba5
Rename matrix "include:" to "pull-request"
jrhemstad May 31, 2023
1552fb4
Factor out root workflow into reusable workflow.
jrhemstad May 31, 2023
fc460c7
Fix inputs to linux-build-and-test
jrhemstad May 31, 2023
c1a0e66
Extra brace.
jrhemstad May 31, 2023
33fee4c
Fix jq syntax
jrhemstad May 31, 2023
b85151c
Don't give root linux job a name.
jrhemstad May 31, 2023
2c2a7c5
Go back to library jobs in root workflow.
jrhemstad May 31, 2023
8504a99
Fix env
jrhemstad May 31, 2023
af1ff44
Correct swapped inputs.
jrhemstad May 31, 2023
0faba7b
Use more specific env accessor.
jrhemstad May 31, 2023
42b4427
Hardcode matrix/build type instead of env.
jrhemstad May 31, 2023
4e6582c
Fix compute-matrix name.
jrhemstad May 31, 2023
138577f
Access inputs instead of env for name.
jrhemstad May 31, 2023
c103ace
Delete unused linux-build-and-test workflow
jrhemstad May 31, 2023
63b6492
Update names
jrhemstad May 31, 2023
5ea15cb
Shorten name
jrhemstad May 31, 2023
629050f
Use cpu as name.
jrhemstad May 31, 2023
88f65d0
Fix matrix passed for thrust
jrhemstad May 31, 2023
e235125
Remove CPU from leaf job name.
jrhemstad May 31, 2023
fb4401d
Remove CPU from test name.
jrhemstad May 31, 2023
e3c09ae
Remove old test prints.
jrhemstad May 31, 2023
2808357
Merge branch 'monorepo_submodules' into monorepo-workflow
jrhemstad May 31, 2023
365fa2b
Allow TOPLEVEL_PROJECT logic to be force enabled.
alliepiper Jun 1, 2023
dc64548
Clean up some comments.
alliepiper Jun 1, 2023
fbf3bf9
Add Thrust and CUB build scripts.
jrhemstad Jun 1, 2023
ad2059f
Move source-tree location of cccl CMake package to lib/.
alliepiper Jun 1, 2023
d69ddf4
Force exact version checks when locating CCCL subprojects.
alliepiper Jun 1, 2023
21f63ef
Add devcontainers and generator script.
jrhemstad Jun 1, 2023
d7185e1
Add a root devcontainer.json instead of a template.
jrhemstad Jun 1, 2023
ad55569
Fix various issues with CMake package testing.
alliepiper Jun 1, 2023
3eb36b0
Add test after checkout
jrhemstad Jun 2, 2023
5267ea8
Forgot that I'm checking out to repo/ now.
jrhemstad Jun 2, 2023
4eadcac
Make build/test jobs conditional on input script.
jrhemstad Jun 2, 2023
8fe6326
Test only passing test script.
jrhemstad Jun 2, 2023
52196bb
Rename "build_type" to "matrix_type" to avoid confusion.
jrhemstad Jun 2, 2023
9b7700d
Try "always()" instead of !cancelled().
jrhemstad Jun 2, 2023
4949bb0
build_type -> matrix_type
jrhemstad Jun 2, 2023
9351ecc
Try !cancelled().
jrhemstad Jun 2, 2023
5dd0b0a
Try committing again?
jrhemstad Jun 2, 2023
c2adb0b
always()
jrhemstad Jun 2, 2023
d7f2372
success() || failure()
jrhemstad Jun 2, 2023
d2f743b
Try it on a single line?
jrhemstad Jun 2, 2023
0c53f87
Use expression syntax
jrhemstad Jun 2, 2023
8f1bf44
Revert checking out into repo folder for now.
jrhemstad Jun 2, 2023
270994f
Merge branch 'test-action-runner-workflows' into monorepo-workflow
jrhemstad Jun 2, 2023
898f9a0
Merge branch 'monorepo_submodules' into monorepo-workflow
jrhemstad Jun 2, 2023
57b7738
Ensure we get full path to host compiler in build script.
jrhemstad Jun 2, 2023
47af73a
Enable running thrust build on actual container.
jrhemstad Jun 2, 2023
9c1dfaa
Ubuntu typo.
jrhemstad Jun 2, 2023
e816b82
Remove fetch-depth 0 and persist-credentials.
jrhemstad Jun 2, 2023
0158c3b
Disable cub/libcu++ for now.
jrhemstad Jun 2, 2023
26d9528
echo git version in container
jrhemstad Jun 2, 2023
bdd73dc
Update git for submodule support with action checkout.
jrhemstad Jun 2, 2023
5f30e95
Update default shell to exit on first error.
jrhemstad Jun 2, 2023
84bdaa5
Ignore C++ dialect deprecation warning.
jrhemstad Jun 2, 2023
76c4455
Padd through macro to ignore deprecation warnings.
jrhemstad Jun 2, 2023
5790bd7
Set bash script to fail if any command fails.
jrhemstad Jun 2, 2023
3656d1a
Remove erroneous cmake flag
jrhemstad Jun 2, 2023
9f2a4c1
Ignore CUB deprecation warnings too.
jrhemstad Jun 2, 2023
06ba15d
clang16 isn't supported.
jrhemstad Jun 2, 2023
5ddceb9
Bump libcudacxx to address review comments.
alliepiper Jun 2, 2023
6d76b84
Make build verbose.
jrhemstad Jun 2, 2023
4bdc3ea
Pass correct GPU archs through to build script
jrhemstad Jun 2, 2023
adc8b08
Bump Thrust for RDC flag fix.
alliepiper Jun 3, 2023
007cdeb
Add name field to devcontainers.
jrhemstad Jun 5, 2023
7812265
Use cmake options for ignoring deprecation warnings.
jrhemstad Jun 5, 2023
a5feaa4
fromJSON on gpu archs
jrhemstad Jun 5, 2023
88c7875
Use string for GPU archs.
jrhemstad Jun 5, 2023
5607728
Single quotes.
jrhemstad Jun 5, 2023
0094a7f
remove the from JSON.
jrhemstad Jun 5, 2023
d405adc
Update comment on matrix
jrhemstad Jun 5, 2023
a181ef2
Remove temporary warning suppression from Thrust/CUB.
alliepiper Jun 5, 2023
fa1f8b2
Merge branch 'monorepo_submodules' into monorepo-workflow
jrhemstad Jun 5, 2023
b713ce9
Add `LANGUAGES` keyword to CMake project calls.
alliepiper Jun 5, 2023
3011b3c
Simplify some genexes and update compiler ID where needed.
alliepiper Jun 5, 2023
f778ea0
Remove unnecessary NVC++ tweaks.
alliepiper Jun 5, 2023
3a5c324
Add guards against unsupported arch options.
alliepiper Jun 5, 2023
05d2594
Enable PIC for RDC targets.
alliepiper Jun 5, 2023
c98570a
Make os in matrix more general.
jrhemstad Jun 5, 2023
d089ac0
Update os docs.
jrhemstad Jun 5, 2023
2c06500
Test build-and-test with windows support.
jrhemstad Jun 5, 2023
ef2f34e
Syntax
jrhemstad Jun 5, 2023
1294673
Factor into env.
jrhemstad Jun 5, 2023
f690335
Update to use format().
jrhemstad Jun 5, 2023
36c8342
Make the whole container line optionally empty.
jrhemstad Jun 5, 2023
7779208
All in format().
jrhemstad Jun 5, 2023
5ae412e
format
jrhemstad Jun 5, 2023
116a594
Don't specify option.
jrhemstad Jun 5, 2023
7881447
test specifying workflow as input.
jrhemstad Jun 5, 2023
2bfaabc
quotes
jrhemstad Jun 5, 2023
27c7e20
Can't dynamically specify "uses:"
jrhemstad Jun 6, 2023
ffb2d57
Set image name in env variable.
jrhemstad Jun 6, 2023
86640fd
Try specifying options even if image is empty.
jrhemstad Jun 6, 2023
40ae5f2
Remove stale "workflow:" input
jrhemstad Jun 6, 2023
dbeebb4
Actually remove the workflow: input.
jrhemstad Jun 6, 2023
4d86945
Don't change the name of the Thrust job.
jrhemstad Jun 6, 2023
af74d4e
Enable thrust test job.
jrhemstad Jun 6, 2023
fbe793f
Don't update git.
jrhemstad Jun 6, 2023
f20375e
Remove windows from the matrix for now.
jrhemstad Jun 6, 2023
4fa5573
Update git version
jrhemstad Jun 6, 2023
16e9f41
Get rid of outdated apt package.
jrhemstad Jun 6, 2023
2d472fd
Add NVIDIA_VISIBLE_DEVICES env to test job container.
jrhemstad Jun 6, 2023
8f51aaa
Update more CUDA compiler id checks.
alliepiper Jun 6, 2023
4cd24c5
Move dev build toggle to the cccl project level.
alliepiper Jun 6, 2023
d7442ea
Turn on install rules for everything.
jrhemstad Jun 7, 2023
3a8bca4
Merge branch 'monorepo_submodules' into monorepo-workflow
jrhemstad Jun 7, 2023
dfc22b3
Factor common logic out of build_thrust.sh
jrhemstad Jun 7, 2023
9e792fd
Add CUB build/test and enable in matrix.
jrhemstad Jun 7, 2023
8bef2c6
Remove install tests from Thrust/CUB.
alliepiper Jun 7, 2023
cbca5f5
Rebase submodules on upstream main branches.
alliepiper Jun 7, 2023
9dbf498
only build for sm70 for now
jrhemstad Jun 7, 2023
6f38850
Add libcu++ test script and enable libcu++ test jobs.
jrhemstad Jun 7, 2023
1472205
Merge branch 'monorepo_submodules' into monorepo-workflow
jrhemstad Jun 7, 2023
3798769
Update how RDC flags are applied to Catch2 utilities.
alliepiper Jun 7, 2023
ab23f7f
Merge branch 'monorepo_submodules' into monorepo-workflow
jrhemstad Jun 7, 2023
39dba74
Add a step to calculate sccache hit rate.
jrhemstad Jun 7, 2023
71578a6
Update sccache script to print file contents.
jrhemstad Jun 7, 2023
355611d
Add sccache to job summary.
jrhemstad Jun 7, 2023
4c1bfb5
Fix writing the hit rate to job summary.
jrhemstad Jun 7, 2023
0ed4be5
Remove set -x to only write hit_rate to stderr
jrhemstad Jun 7, 2023
2c48d27
Add final "CI" job that can be used as status check.
jrhemstad Jun 7, 2023
a4406f4
Delete old workflow files.
jrhemstad Jun 7, 2023
e00d3ae
Delete old CI scripts.
jrhemstad Jun 7, 2023
c57c6cc
Remove devcontainers from this branch.
jrhemstad Jun 8, 2023
d641186
Add devcontainers.
jrhemstad Jun 8, 2023
00ff865
Merge branch 'add_devcontainers' into monorepo-workflow
jrhemstad Jun 8, 2023
17c74a1
Make thrust/cub tests timeout after 15 seconds.
jrhemstad Jun 8, 2023
8177c03
Update permissions according to AJ's suggestion.
jrhemstad Jun 20, 2023
1c16b96
Add .cache to gitignore.
jrhemstad Jun 20, 2023
6424b79
Add overview of CI pipeline.
jrhemstad Jun 20, 2023
44dee4f
Add mermaid diagram.
jrhemstad Jun 20, 2023
ceb7fe7
Better diagram
jrhemstad Jun 20, 2023
a929f5b
Update readme.
jrhemstad Jun 20, 2023
20c7778
Fix link.
jrhemstad Jun 20, 2023
1c451aa
Add links to matrix file.
jrhemstad Jun 20, 2023
9b66bf5
Update CI doc and link to it from readme.
jrhemstad Jun 21, 2023
93b3de4
Fix bullet indentation.
jrhemstad Jun 21, 2023
e5e148b
Expand build/test.
jrhemstad Jun 21, 2023
e603fb1
Add examples.
jrhemstad Jun 21, 2023
dc762e5
Echo command to clone PR on failure.
jrhemstad Jun 21, 2023
bed0bff
Factor image name into environment variable.
jrhemstad Jun 21, 2023
121e8b1
Pass build and test job images as inputs.
jrhemstad Jun 21, 2023
f025df2
Fix notice syntax.
jrhemstad Jun 21, 2023
adeebed
Update CUDA11.0 to 11.1 in matrix.
jrhemstad Jun 21, 2023
e6f34a6
Explicitly check exit code from script.
jrhemstad Jun 21, 2023
0b4a733
Update to exit with the exit code on error.
jrhemstad Jun 21, 2023
ed32d99
Add repro instructions.
jrhemstad Jun 21, 2023
7478f9c
Update repro instructions.
jrhemstad Jun 21, 2023
f12daca
Update clone instruction to recurse submodules.
jrhemstad Jun 21, 2023
eb3778f
Don't use host networking.
jrhemstad Jun 21, 2023
fe1b66c
Disable test jobs for now.
jrhemstad Jun 21, 2023
65c328c
Update devcontainers.
jrhemstad Jun 22, 2023
69f45d6
Update devcontainers.
jrhemstad Jun 22, 2023
33bde08
Add launch script and repro instructions.
jrhemstad Jun 22, 2023
773c4a8
Update repro message.
jrhemstad Jun 22, 2023
bb785b1
Add repro instructions.
jrhemstad Jun 22, 2023
437965a
Add libcu++ build job.
jrhemstad Jun 22, 2023
c542f6f
typo
jrhemstad Jun 22, 2023
9d122cd
Merge pull request #99 from jrhemstad/monorepo-workflow
jrhemstad Jun 22, 2023
9850287
Merge pull request #105 from NVIDIA/add_devcontainers
jrhemstad Jun 22, 2023
faf9cc9
Update the libcu++ submodule
miscco Jun 22, 2023
43884f1
Fix test issues with libcu++
miscco Jun 22, 2023
f8e1511
Add fix fo gcc-7
miscco Jun 22, 2023
68e80ad
Incorporate fix for old nvcc and old gcc
miscco Jun 22, 2023
2ac1397
Update CUB to prepare for repo unification.
alliepiper Jun 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
*build*/
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "libcudacxx"]
path = libcudacxx
url = ../libcudacxx.git
[submodule "cub"]
path = cub
url = ../cub
[submodule "thrust"]
path = thrust
url = ../thrust
55 changes: 55 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 3.15 is the minimum for including the project with add_subdirectory.
Copy link
Collaborator

@jrhemstad jrhemstad May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Update to add a copyright header.

I'll add the text we need.

# 3.21 is the minimum for the developer build.
cmake_minimum_required(VERSION 3.15)

# Determine whether CCCL is the top-level project or included into
# another project via add_subdirectory()
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
alliepiper marked this conversation as resolved.
Show resolved Hide resolved
set(CCCL_TOPLEVEL_PROJECT ON)
else()
set(CCCL_TOPLEVEL_PROJECT OFF)
endif()

# TODO find_package for add_subdir usecases, use components for subprojects.
alliepiper marked this conversation as resolved.
Show resolved Hide resolved

project(CCCL NONE)

# Optionally include installation rules for non-top-level builds:
option(CCCL_ENABLE_INSTALL_RULES "Enable installation of CCCL." ${CCCL_TOPLEVEL_PROJECT})
if (CCCL_ENABLE_INSTALL_RULES)
include(cmake/CCCLInstallRules.cmake)
endif()

# Support adding Thrust to a parent project via add_subdirectory.
alliepiper marked this conversation as resolved.
Show resolved Hide resolved
# See examples/cmake/add_subdir/CMakeLists.txt for details.
if (NOT CCCL_TOPLEVEL_PROJECT)
include(cmake/CCCLAddSubdir.cmake)
return()
endif()

# We require a higher cmake version for dev builds
cmake_minimum_required(VERSION 3.21)

option(CCCL_ENABLE_LIBCUDACXX "Enable the libcu++ developer build." ON)
option(CCCL_ENABLE_CUB "Enable the CUB developer build." ON)
option(CCCL_ENABLE_THRUST "Enable the Thrust developer build." ON)
option(CCCL_ENABLE_TESTING "Enable CUDA C++ Core Library tests." ON)

include(CTest)
enable_testing()

if (CCCL_ENABLE_LIBCUDACXX)
add_subdirectory(libcudacxx)
endif()

if (CCCL_ENABLE_CUB)
add_subdirectory(cub)
endif()

if (CCCL_ENABLE_THRUST)
add_subdirectory(thrust)
endif()

if (CCCL_ENABLE_TESTING)
add_subdirectory(test)
endif()
6 changes: 6 additions & 0 deletions cmake/CCCLAddSubdir.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
find_package(CCCL REQUIRED CONFIG
alliepiper marked this conversation as resolved.
Show resolved Hide resolved
NO_DEFAULT_PATH # Only check the explicit path in HINTS:
HINTS "${CCCL_SOURCE_DIR}"
COMPONENTS ${CCCL_REQUIRED_COMPONENTS}
OPTIONAL_COMPONENTS ${CCCL_OPTIONAL_COMPONENTS}
)
10 changes: 10 additions & 0 deletions cmake/CCCLInstallRules.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Bring in CMAKE_INSTALL_LIBDIR
include(GNUInstallDirs)

# CCCL has no installable binaries, no need to build before installing:
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)

install(DIRECTORY "${CCCL_SOURCE_DIR}/share/cmake/cccl"
alliepiper marked this conversation as resolved.
Show resolved Hide resolved
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/"
PATTERN *.cmake.in EXCLUDE
)
1 change: 1 addition & 0 deletions cub
Submodule cub added at 6477d3
1 change: 1 addition & 0 deletions libcudacxx
Submodule libcudacxx added at c9a2d6
23 changes: 23 additions & 0 deletions share/cmake/cccl/cccl-config-version.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# TODO How should we encode this as a source of truth?
set(CCCL_VERSION_MAJOR 2)
set(CCCL_VERSION_MINOR 2)
set(CCCL_VERSION_PATCH 0)
set(CCCL_VERSION_TWEAK 0)

set(CCCL_VERSION "${CCCL_VERSION_MAJOR}.${CCCL_VERSION_MINOR}.${CCCL_VERSION_PATCH}.${CCCL_VERSION_TWEAK}")

set(PACKAGE_VERSION ${CCCL_VERSION})
set(PACKAGE_VERSION_COMPATIBLE FALSE)
set(PACKAGE_VERSION_EXACT FALSE)
set(PACKAGE_VERSION_UNSUITABLE FALSE)

# Semantic versioning:
if(PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION)
if(CCCL_VERSION_MAJOR VERSION_EQUAL PACKAGE_FIND_VERSION_MAJOR)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
alliepiper marked this conversation as resolved.
Show resolved Hide resolved
endif()

if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
59 changes: 59 additions & 0 deletions share/cmake/cccl/cccl-config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
# find_package(CCCL) config file.
#
# Imports the Thrust, CUB, and libcudacxx components of the NVIDIA
# CUDA/C++ Core Libraries.

unset(cccl_version) # TODO
alliepiper marked this conversation as resolved.
Show resolved Hide resolved

set(cccl_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")

if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
set(cccl_quiet_flag "QUIET")
else()
set(cccl_quiet_flag "")
endif()

foreach(component ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS})
alliepiper marked this conversation as resolved.
Show resolved Hide resolved
unset(req)
alliepiper marked this conversation as resolved.
Show resolved Hide resolved
if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${component})
set(cccl_comp_required_flag "REQUIRED")
endif()

if(component STREQUAL "libcudacxx")
alliepiper marked this conversation as resolved.
Show resolved Hide resolved
find_package(libcudacxx ${cccl_version} CONFIG
${cccl_quiet_flag}
${cccl_comp_required_flag}
NO_DEFAULT_PATH # Only check the explicit HINTS below:
HINTS
"${cccl_cmake_dir}/../../../libcudacxx/lib/cmake/" # Source layout (GitHub)
"${cccl_cmake_dir}/.." # Install layout
)
elseif(component STREQUAL "CUB")
find_package(CUB ${cccl_version} CONFIG
${cccl_quiet_flag}
${cccl_comp_required_flag}
NO_DEFAULT_PATH # Only check the explicit HINTS below:
HINTS
"${cccl_cmake_dir}/../../../cub/cub/cmake/" # Source layout (GitHub)
"${cccl_cmake_dir}/.." # Install layout
)
elseif(component STREQUAL "Thrust")
find_package(Thrust ${cccl_version} CONFIG
${cccl_quiet_flag}
${cccl_comp_required_flag}
NO_DEFAULT_PATH # Only check the explicit HINTS below:
HINTS
"${cccl_cmake_dir}/../../../thrust/thrust/cmake/" # Source layout (GitHub)
"${cccl_cmake_dir}/.." # Install layout
)
else()
message(FATAL_ERROR "Invalid CCCL component requested: '${component}'")
endif()
endforeach()

include(FindPackageHandleStandardArgs)
if (NOT CCCL_CONFIG)
set(CCCL_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
endif()
find_package_handle_standard_args(CCCL CONFIG_MODE)
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(cmake)
81 changes: 81 additions & 0 deletions test/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
set(cmake_opts
-D "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
-D "CMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}"
-D "CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
)

# Temporary installation prefix for tests against installed project:
set(tmp_install_prefix "${CMAKE_CURRENT_BINARY_DIR}/test_install")

# Add a build-and-test CTest.
# - full_test_name_var will be set to the full name of the test.
# - subdir is the relative path to the test project directory.
# - test_id is used to generate a unique name for this test, allowing the
# subdir to be reused.
# - Any additional args will be passed to the project configure step.
function(cccl_add_compile_test full_test_name_var subdir test_id)
set(test_name cccl.test.cmake.${subdir}.${test_id})
set(src_dir "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}")
set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/${subdir}/${test_id}")
add_test(NAME ${test_name}
COMMAND "${CMAKE_CTEST_COMMAND}"
--build-and-test "${src_dir}" "${build_dir}"
--build-generator "${CMAKE_GENERATOR}"
--build-options
${cmake_opts}
${ARGN}
--test-command "${CMAKE_CTEST_COMMAND}" --output-on-failure
)
set(${full_test_name_var} ${test_name} PARENT_SCOPE)
endfunction()

foreach (root_type IN ITEMS SOURCE INSTALL)
if (root_type STREQUAL "INSTALL")
set(cccl_root "${tmp_install_prefix}")
else()
set(cccl_root "${CCCL_SOURCE_DIR}")
endif()

foreach (components IN ITEMS DEFAULT Thrust CUB libcudacxx)
set(package_types CCCL)
if (NOT components STREQUAL "DEFAULT")
list(APPEND package_types NATIVE)
endif()
if (root_type STREQUAL "SOURCE")
list(APPEND package_types SUBDIR)
endif()
foreach (package_type IN LISTS package_types)
string(TOLOWER "${root_type}.${package_type}.${components}" suffix)
cccl_add_compile_test(test_name
test_export
"${suffix}"
-D "CCCL_ROOT=${cccl_root}"
-D "ROOT_TYPE=${root_type}"
-D "COMPONENTS=${components}"
-D "PACKAGE_TYPE=${package_type}"
)

if (root_type STREQUAL "INSTALL")
set_tests_properties(${test_name} PROPERTIES FIXTURES_REQUIRED install_tree)
endif()
endforeach() # package_type
endforeach() # components
endforeach() # root_type

################################################################################
# Install tree fixtures
add_test(NAME cccl.test.cmake.install_tree.install
COMMAND "${CMAKE_COMMAND}"
--install "${CCCL_BINARY_DIR}"
--prefix "${tmp_install_prefix}"
)
set_tests_properties(cccl.test.cmake.install_tree.install PROPERTIES
FIXTURES_SETUP install_tree
)

add_test(NAME cccl.test.cmake.install_tree.cleanup
COMMAND "${CMAKE_COMMAND}" -E rm -rf "${tmp_install_prefix}"
)
set_tests_properties(cccl.test.cmake.install_tree.cleanup PROPERTIES
FIXTURES_CLEANUP install_tree
)
Loading