Skip to content

Commit

Permalink
Merge branch 'main' into any_resource_constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Sep 19, 2024
2 parents 7bec153 + 2496571 commit 0a30054
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 146 deletions.
1 change: 1 addition & 0 deletions .github/actions/workflow-run-job-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ runs:
--env "CI=$CI" \
--env "VAULT_HOST=" \
--env "COMMAND=$COMMAND" \
--env "SCCACHE_IDLE_TIMEOUT=0" \
--env "GITHUB_ENV=$GITHUB_ENV" \
--env "GITHUB_SHA=$GITHUB_SHA" \
--env "GITHUB_PATH=$GITHUB_PATH" \
Expand Down
76 changes: 34 additions & 42 deletions .github/workflows/build-rapids.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,37 @@ jobs:
#! /usr/bin/env bash
set -eo pipefail
. ~/cccl/ci/rapids/post-create-command.sh;
declare -a failures
declare -A failures_map
_print_err_exit_msg() {
local code=$?
if test $code -ne 0; then
echo "::error:: Failures: ${failures[*]}"
echo -e "::group::️❗ \e[1;31mInstructions to Reproduce CI Failure Locally\e[0m"
echo "::error:: To replicate this failure locally, follow the steps below:"
echo "1. Clone the repository, and navigate to the correct branch and commit:"
echo " git clone --branch $GITHUB_REF_NAME --single-branch https://github.com/$GITHUB_REPOSITORY.git && cd $(echo $GITHUB_REPOSITORY | cut -d'/' -f2) && git checkout $GITHUB_SHA"
echo ""
echo "2. Run the failed command inside the same Docker container used by this CI job:"
cat <<____EOF
RAPIDS_LIBS='${RAPIDS_LIBS}'$(for lib in cmake ${RAPIDS_LIBS}; do var=RAPIDS_${lib//-/_}_GIT_REPO; if test -v "$var" && test -n "${!var}"; then echo -n " $var='${!var}'"; fi; done) \\
.devcontainer/launch.sh -d -c ${{matrix.cuda}} -H rapids-conda -- ./ci/rapids/rapids-entrypoint.sh \\
/bin/bash -li -c 'uninstall-all -j -qqq && clean-all -j && build-all -j -v || exec /bin/bash -li'
____EOF
echo ""
echo "For additional information, see:"
echo " - DevContainer Documentation: https://github.com/NVIDIA/cccl/blob/main/.devcontainer/README.md"
echo " - Continuous Integration (CI) Overview: https://github.com/NVIDIA/cccl/blob/main/ci-overview.md"
fi
exit $code
}
# Print failures and exit
trap '_print_err_exit_msg' EXIT;
. ~/cccl/ci/rapids/post-create-command.sh;
# Configure and build each lib with -DBUILD_TESTS=OFF, then again with -DBUILD_TESTS=ON
for RAPIDS_ENABLE_TESTS in OFF ON; do
_apply_manifest_modifications;
Expand All @@ -109,54 +135,20 @@ jobs:
sccache --show-adv-stats
done
done
# Print failures and exit
if test ${#failures[@]} -gt 0; then
echo "::error:: Failures: ${failures[*]}"
echo -e "::group::️❗ \e[1;31mInstructions to Reproduce CI Failure Locally\e[0m"
echo "::error:: To replicate this failure locally, follow the steps below:"
echo "1. Clone the repository, and navigate to the correct branch and commit:"
echo " git clone --branch $GITHUB_REF_NAME --single-branch https://github.com/$GITHUB_REPOSITORY.git && cd $(echo $GITHUB_REPOSITORY | cut -d'/' -f2) && git checkout $GITHUB_SHA"
echo ""
echo "2. Run the failed command inside the same Docker container used by this CI job:"
cat <<__EOF
RAPIDS_LIBS='${RAPIDS_LIBS}'$(for lib in cmake ${RAPIDS_LIBS}; do var=RAPIDS_${lib//-/_}_GIT_REPO; if test -v "$var" && test -n "${!var}"; then echo -n " $var='${!var}'"; fi; done) \\
.devcontainer/launch.sh -d -c ${{matrix.cuda}} -H rapids-conda -- ./ci/rapids/rapids-entrypoint.sh \\
/bin/bash -li -c 'uninstall-all -j -qqq && clean-all -j && build-all -j -v || exec /bin/bash -li'
__EOF
echo ""
echo "For additional information, see:"
echo " - DevContainer Documentation: https://github.com/NVIDIA/cccl/blob/main/.devcontainer/README.md"
echo " - Continuous Integration (CI) Overview: https://github.com/NVIDIA/cccl/blob/main/ci-overview.md"
exit 1
fi
EOF
chmod +x "$RUNNER_TEMP"/ci{,-entrypoint}.sh
mkdir -p .aws
cat <<EOF > .aws/config
[default]
bucket=rapids-sccache-devs
region=us-east-2
EOF
cat <<EOF > .aws/credentials
[default]
aws_access_key_id=$AWS_ACCESS_KEY_ID
aws_session_token=$AWS_SESSION_TOKEN
aws_secret_access_key=$AWS_SECRET_ACCESS_KEY
EOF
chmod 0600 .aws/credentials
chmod 0664 .aws/config
.devcontainer/launch.sh \
--docker \
--cuda ${{matrix.cuda}} \
--host rapids-conda \
--env VAULT_HOST= \
--env "VAULT_HOST=" \
--env "AWS_REGION=$AWS_REGION" \
--env "SCCACHE_REGION=$AWS_REGION" \
--env "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" \
--env "AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN" \
--env "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" \
--env "GITHUB_SHA=$GITHUB_SHA" \
--env "GITHUB_REF_NAME=$GITHUB_REF_NAME" \
--env "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" \
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ enable_testing()
if (CCCL_TOPLEVEL_PROJECT)
include(cmake/AppendOptionIfAvailable.cmake)
include(cmake/CCCLUtilities.cmake) # include this before other CCCL helpers

include(cmake/CCCLBuildCompilerTargets.cmake)
include(cmake/CCCLClangdCompileInfo.cmake)
include(cmake/CCCLConfigureTarget.cmake)

cccl_build_compiler_targets()
endif()
Expand Down
2 changes: 1 addition & 1 deletion ci/rapids/post-create-command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ _run_post_create_command() {
gh config set git_protocol ssh;
gh config set git_protocol ssh --host github.com;

clone-all -j "$(nproc --all)" -v -q --clone-upstream --single-branch --shallow-submodules;
clone-all -j "$(nproc --all)" -v -q --clone-upstream --single-branch --shallow-submodules --no-update-env;
}

if [ "$(basename "${BASH_SOURCE[${#BASH_SOURCE[@]}-1]}")" = post-create-command.sh ]; then
Expand Down
4 changes: 2 additions & 2 deletions ci/windows/build_cudax.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Param(
[Parameter(Mandatory = $false)]
[Alias("std")]
[ValidateNotNullOrEmpty()]
[ValidateSet(17, 20)]
[int]$CXX_STANDARD = 17
[ValidateSet(20)]
[int]$CXX_STANDARD = 20
)

$CURRENT_PATH = Split-Path $pwd -leaf
Expand Down
57 changes: 57 additions & 0 deletions cmake/CCCLConfigureTarget.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
set(CCCL_EXECUTABLE_OUTPUT_DIR "${CCCL_BINARY_DIR}/bin")
set(CCCL_LIBRARY_OUTPUT_DIR "${CCCL_BINARY_DIR}/lib")

# Setup common properties for all test/example/etc targets.
function(cccl_configure_target target_name)
set(options)
set(oneValueArgs DIALECT)
set(multiValueArgs)
cmake_parse_arguments(CCT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

get_target_property(type ${target_name} TYPE)

if (DEFINED CCT_DIALECT)
set_target_properties(${target_name}
PROPERTIES
CXX_STANDARD ${CCT_DIALECT}
CUDA_STANDARD ${CCT_DIALECT}
# Must manually request that the standards above are actually respected
# or else CMake will silently fail to configure the targets correctly...
# Note that this doesn't actually work as of CMake 3.16:
# https://gitlab.kitware.com/cmake/cmake/-/issues/20953
# We'll leave these properties enabled in hopes that they will someday
# work.
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD_REQUIRED ON
)

get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES)
set(dialect_features)
if (CUDA IN_LIST langs)
list(APPEND dialect_features cuda_std_${CCT_DIALECT})
endif()
if (CXX IN_LIST langs)
list(APPEND dialect_features cxx_std_${CCT_DIALECT})
endif()

get_target_property(type ${target_name} TYPE)
if (${type} STREQUAL "INTERFACE_LIBRARY")
target_compile_features(${target_name} INTERFACE
${dialect_features}
)
else()
target_compile_features(${target_name} PUBLIC
${dialect_features}
)
endif()
endif()

if (NOT ${type} STREQUAL "INTERFACE_LIBRARY")
set_target_properties(${target_name}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CCCL_LIBRARY_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${CCCL_LIBRARY_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${CCCL_EXECUTABLE_OUTPUT_DIR}"
)
endif()
endfunction()
5 changes: 0 additions & 5 deletions cub/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ endif ()

set(CMAKE_CXX_EXTENSIONS OFF)

# Where to put build outputs. Use CMAKE_BINARY_DIR so they'll show up alongside
# Thrust targets when building as part of Thrust.
set(CUB_LIBRARY_OUTPUT_DIR "${CMAKE_BINARY_DIR}/lib")
set(CUB_EXECUTABLE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin")

cub_build_compiler_targets()
cub_build_target_list()

Expand Down
8 changes: 1 addition & 7 deletions cub/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,8 @@ function(add_bench target_name bench_name bench_src)
set(${target_name} ${bench_target} PARENT_SCOPE)

add_executable(${bench_target} "${bench_src}")
cccl_configure_target(${bench_target} DIALECT 17)
target_link_libraries(${bench_target} PRIVATE nvbench_helper nvbench::main)
set_target_properties(${bench_target}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CUB_LIBRARY_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${CUB_LIBRARY_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${CUB_EXECUTABLE_OUTPUT_DIR}"
CUDA_STANDARD 17
CXX_STANDARD 17)
endfunction()

function(add_bench_dir bench_dir)
Expand Down
8 changes: 1 addition & 7 deletions cub/benchmarks/nvbench_helper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,11 @@ if (CUB_ENABLE_NVBENCH_HELPER_TESTS)
test/gen_uniform_distribution.cu
test/gen_power_law_distribution.cu
test/main.cpp)
cccl_configure_target(${nvbench_helper_test_target} DIALECT 17)
target_link_libraries(${nvbench_helper_test_target} PRIVATE nvbench_helper Catch2::Catch2 Boost::math)
if ("${device_system}" STREQUAL "cpp")
target_compile_definitions(${nvbench_helper_test_target} PRIVATE THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CPP)
endif()
set_target_properties(${nvbench_helper_test_target}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CUB_LIBRARY_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${CUB_LIBRARY_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${CUB_EXECUTABLE_OUTPUT_DIR}"
CUDA_STANDARD 17
CXX_STANDARD 17)
endfunction()

add_nvbench_helper_test(cpp)
Expand Down
14 changes: 2 additions & 12 deletions cub/cmake/CubBuildTargetList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,13 @@ define_property(TARGET PROPERTY _CUB_PREFIX
)

function(cub_set_target_properties target_name dialect prefix)
cccl_configure_target(${target_name} DIALECT ${dialect})

set_target_properties(${target_name}
PROPERTIES
_CUB_DIALECT ${dialect}
_CUB_PREFIX ${prefix}
)

get_target_property(type ${target_name} TYPE)
if (NOT ${type} STREQUAL "INTERFACE_LIBRARY")
set_target_properties(${target_name}
PROPERTIES
CXX_STANDARD ${dialect}
CUDA_STANDARD ${dialect}
ARCHIVE_OUTPUT_DIRECTORY "${CUB_LIBRARY_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${CUB_LIBRARY_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${CUB_EXECUTABLE_OUTPUT_DIR}"
)
endif()
endfunction()

# Get a cub property from a target and store it in var_name
Expand Down
18 changes: 2 additions & 16 deletions cudax/cmake/cudaxBuildTargetList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
# to ensure that dialect information is updated correctly, e.g.
# `_cn_clone_target_properties(${my_cudax_test} ${some_cudax_target})`

# Place build outputs in the root project dir:
set(cudax_LIBRARY_OUTPUT_DIR "${CMAKE_BINARY_DIR}/lib")
set(cudax_EXECUTABLE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin")

# Define available dialects:
set(cudax_CPP_DIALECT_OPTIONS
17 20
Expand Down Expand Up @@ -66,23 +62,13 @@ define_property(TARGET PROPERTY _cudax_PREFIX
)

function(cudax_set_target_properties target_name dialect prefix)
cccl_configure_target(${target_name} DIALECT ${dialect})

set_target_properties(${target_name}
PROPERTIES
_cudax_DIALECT ${dialect}
_cudax_PREFIX ${prefix}
)

get_target_property(type ${target_name} TYPE)
if (NOT ${type} STREQUAL "INTERFACE_LIBRARY")
set_target_properties(${target_name}
PROPERTIES
CXX_STANDARD ${dialect}
CUDA_STANDARD ${dialect}
ARCHIVE_OUTPUT_DIRECTORY "${cudax_LIBRARY_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${cudax_LIBRARY_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${cudax_EXECUTABLE_OUTPUT_DIR}"
)
endif()
endfunction()

# Get a cudax property from a target and store it in var_name
Expand Down
5 changes: 0 additions & 5 deletions thrust/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@ endif ()
# Disable compiler extensions:
set(CMAKE_CXX_EXTENSIONS OFF)

# Where to put build outputs. Use CMAKE_BINARY_DIR so they'll show up in the
# top-level project's dir when building Thrust via add_subdirectory.
set(THRUST_LIBRARY_OUTPUT_DIR "${CMAKE_BINARY_DIR}/lib")
set(THRUST_EXECUTABLE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin")

thrust_configure_multiconfig()
thrust_find_thrust()
thrust_build_compiler_targets()
Expand Down
9 changes: 1 addition & 8 deletions thrust/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@ function(add_bench target_name bench_name bench_src)
set(${target_name} ${bench_target} PARENT_SCOPE)

add_executable(${bench_target} "${bench_src}")

set_target_properties(${bench_target}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${THRUST_LIBRARY_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${THRUST_LIBRARY_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${THRUST_EXECUTABLE_OUTPUT_DIR}"
CUDA_STANDARD 17
CXX_STANDARD 17)
cccl_configure_target(${bench_target} DIALECT 17)
target_link_libraries(${bench_target} PRIVATE nvbench_helper nvbench::main)
endfunction()

Expand Down
38 changes: 2 additions & 36 deletions thrust/cmake/ThrustBuildTargetList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,49 +52,15 @@ define_property(TARGET PROPERTY _THRUST_PREFIX
)

function(thrust_set_target_properties target_name host device dialect prefix)
cccl_configure_target(${target_name} DIALECT ${dialect})

set_target_properties(${target_name}
PROPERTIES
_THRUST_HOST ${host}
_THRUST_DEVICE ${device}
_THRUST_DIALECT ${dialect}
_THRUST_PREFIX ${prefix}
)

get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES)
set(standard_features)
if (CUDA IN_LIST langs)
list(APPEND standard_features cuda_std_${dialect})
endif()
if (CXX IN_LIST langs)
list(APPEND standard_features cxx_std_${dialect})
endif()

get_target_property(type ${target_name} TYPE)
if (${type} STREQUAL "INTERFACE_LIBRARY")
target_compile_features(${target_name} INTERFACE
${standard_features}
)
else()
target_compile_features(${target_name} PUBLIC
${standard_features}
)
set_target_properties(${target_name}
PROPERTIES
CXX_STANDARD ${dialect}
CUDA_STANDARD ${dialect}
# Must manually request that the standards above are actually respected
# or else CMake will silently fail to configure the targets correctly...
# Note that this doesn't actually work as of CMake 3.16:
# https://gitlab.kitware.com/cmake/cmake/-/issues/20953
# We'll leave these properties enabled in hopes that they will someday
# work.
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD_REQUIRED ON
ARCHIVE_OUTPUT_DIRECTORY "${THRUST_LIBRARY_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${THRUST_LIBRARY_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${THRUST_EXECUTABLE_OUTPUT_DIR}"
)
endif()
endfunction()

# Get a thrust property from a target and store it in var_name
Expand Down
Loading

0 comments on commit 0a30054

Please sign in to comment.