-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate c/parallel with CCCL build system and CI. (#2514)
Integrate c/parallel into CCCL, setup CI, etc.
- Loading branch information
1 parent
951c822
commit e149e86
Showing
29 changed files
with
177 additions
and
64 deletions.
There are no files selected for viewing
This file contains 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 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,25 +1 @@ | ||
cmake_minimum_required(VERSION 3.30) | ||
|
||
project(cccl.c LANGUAGES CUDA CXX) | ||
|
||
add_library(cccl.c SHARED | ||
src/reduce.cu src/for.cu | ||
src/for/for_op_helper.cpp | ||
src/util/errors.cpp src/util/types.cpp src/util/context.cpp) | ||
|
||
set_property(TARGET cccl.c PROPERTY POSITION_INDEPENDENT_CODE ON) | ||
set_property(TARGET cccl.c PROPERTY CXX_STANDARD 20) | ||
set_property(TARGET cccl.c PROPERTY CUDA_STANDARD 20) | ||
|
||
find_package(CUDAToolkit REQUIRED) | ||
|
||
# TODO Use static versions of cudart, nvrtc, and nvJitLink | ||
target_link_libraries(cccl.c PRIVATE CUDA::cudart | ||
CUDA::nvrtc | ||
CUDA::nvJitLink | ||
CUDA::cuda_driver) | ||
target_compile_definitions(cccl.c PRIVATE NVRTC_GET_TYPE_NAME=1 CCCL_C_EXPERIMENTAL=1) | ||
target_include_directories(cccl.c PUBLIC "include") | ||
target_include_directories(cccl.c PRIVATE "src") | ||
|
||
add_subdirectory(test) | ||
add_subdirectory(parallel) |
This file contains 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
cmake_minimum_required(VERSION 3.21) | ||
|
||
project(CCCL_C_Parallel LANGUAGES CUDA CXX) | ||
|
||
option(CCCL_C_Parallel_ENABLE_TESTING "Build CUDA Experimental's tests." OFF) | ||
option(CCCL_C_Parallel_ENABLE_HEADER_TESTING "Build CUDA Experimental's standalone headers." OFF) | ||
|
||
# FIXME Ideally this would be handled by presets and install rules, but for now | ||
# consumers may override this to control the target location of cccl.c.parallel. | ||
set(CCCL_C_PARALLEL_LIBRARY_OUTPUT_DIRECTORY "" CACHE PATH "Override output directory for the cccl.c.parallel library") | ||
mark_as_advanced(CCCL_C_PARALLEL_LIBRARY_OUTPUT_DIRECTORY) | ||
|
||
file(GLOB_RECURSE srcs | ||
RELATIVE "${CMAKE_CURRENT_LIST_DIR}" | ||
CONFIGURE_DEPENDS | ||
"src/*.cu" "src/*.cpp" | ||
) | ||
|
||
add_library(cccl.c.parallel SHARED ${srcs}) | ||
set_property(TARGET cccl.c.parallel PROPERTY POSITION_INDEPENDENT_CODE ON) | ||
cccl_configure_target(cccl.c.parallel DIALECT 20) | ||
|
||
# Override the properties set by cccl_configure_target: | ||
if (CCCL_C_PARALLEL_LIBRARY_OUTPUT_DIRECTORY) | ||
set_target_properties(cccl.c.parallel PROPERTIES | ||
LIBRARY_OUTPUT_DIRECTORY "${CCCL_C_PARALLEL_LIBRARY_OUTPUT_DIRECTORY}" | ||
ARCHIVE_OUTPUT_DIRECTORY "${CCCL_C_PARALLEL_LIBRARY_OUTPUT_DIRECTORY}" | ||
) | ||
endif() | ||
|
||
find_package(CUDAToolkit REQUIRED) | ||
|
||
# TODO Use static versions of cudart, nvrtc, and nvJitLink | ||
target_link_libraries(cccl.c.parallel PRIVATE | ||
CUDA::cudart | ||
CUDA::nvrtc | ||
CUDA::nvJitLink | ||
CUDA::cuda_driver | ||
cccl.compiler_interface_cpp20 | ||
) | ||
target_compile_definitions(cccl.c.parallel PUBLIC CCCL_C_EXPERIMENTAL=1) | ||
target_compile_definitions(cccl.c.parallel PRIVATE NVRTC_GET_TYPE_NAME=1) | ||
|
||
target_include_directories(cccl.c.parallel PUBLIC "include") | ||
target_include_directories(cccl.c.parallel PRIVATE "src") | ||
|
||
if (CCCL_C_Parallel_ENABLE_TESTING) | ||
add_subdirectory(test) | ||
endif() | ||
|
||
if (CCCL_C_Parallel_ENABLE_HEADER_TESTING) | ||
include(cmake/CParallelHeaderTesting.cmake) | ||
endif() |
This file contains 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# For every public header, build a translation unit containing `#include <header>` | ||
# to let the compiler try to figure out warnings in that header if it is not otherwise | ||
# included in tests, and also to verify if the headers are modular enough. | ||
# .inl files are not globbed for, because they are not supposed to be used as public | ||
# entrypoints. | ||
|
||
cccl_generate_header_tests(cccl.c.parallel.headers c/parallel/include | ||
DIALECT 20 | ||
GLOBS "cccl/c/*.h" | ||
) | ||
target_link_libraries(cccl.c.parallel.headers PUBLIC cccl.c.parallel) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 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
File renamed without changes.
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
cccl_get_catch2() | ||
|
||
function(cccl_c_parallel_add_test target_name_var source) | ||
string(REGEX REPLACE "test_([^.]*)" "cccl.c.parallel.test.\\1" target_name "${source}") | ||
set(target_name_var ${target_name} PARENT_SCOPE) | ||
|
||
add_executable(${target_name} | ||
"${source}" | ||
test_main.cpp | ||
) | ||
cccl_configure_target(${target_name} DIALECT 20) | ||
|
||
target_link_libraries(${target_name} PRIVATE | ||
cccl.c.parallel | ||
CUDA::cudart | ||
CUDA::nvrtc | ||
Catch2::Catch2 | ||
cccl.compiler_interface_cpp20 | ||
) | ||
|
||
target_compile_definitions(${target_name} PRIVATE | ||
TEST_CUB_PATH="-I${CCCL_SOURCE_DIR}/cub" | ||
TEST_THRUST_PATH="-I${CCCL_SOURCE_DIR}/cub" | ||
TEST_LIBCUDACXX_PATH="-I${CCCL_SOURCE_DIR}/libcudacxx/include" | ||
TEST_CTK_PATH="-I${CUDAToolkit_INCLUDE_DIRS}" | ||
) | ||
|
||
add_test(NAME ${target_name} COMMAND ${target_name}) | ||
endfunction() | ||
|
||
file(GLOB test_srcs | ||
RELATIVE "${CMAKE_CURRENT_LIST_DIR}" | ||
CONFIGURE_DEPENDS | ||
*.cu *.cpp | ||
) | ||
list(REMOVE_ITEM test_srcs test_main.cpp) | ||
|
||
foreach(test_src IN LISTS test_srcs) | ||
cccl_c_parallel_add_test(test_target "${test_src}") | ||
endforeach() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
source "$(dirname "$0")/build_common.sh" | ||
|
||
print_environment_details | ||
|
||
PRESET="cccl-c-parallel" | ||
|
||
CMAKE_OPTIONS="" | ||
|
||
configure_and_build_preset "CCCL C Parallel Library" "$PRESET" "$CMAKE_OPTIONS" | ||
|
||
print_time_summary |
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
source "$(dirname "$0")/build_common.sh" | ||
|
||
print_environment_details | ||
|
||
./build_cccl_c_parallel.sh "$@" | ||
|
||
PRESET="cccl-c-parallel" | ||
|
||
test_preset "CCCL C Parallel Library" ${PRESET} | ||
|
||
print_time_summary |
This file contains 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.