feat(cccl): integrate missing CCCL directories — python/, ci/, .agent/, docs/, test/
Sparse-checkout from NVIDIA/cccl main branch to complete cccl_upstream: Added: - python/cuda_cccl/ (226 files) — Python bindings for device-level algorithms Critical for muh toolchain: cuda.compute.reduce_into, scan, radix_sort, etc. Includes 204 .py files with full test coverage for all 27 algorithms - ci/ (163 files) — Build/test infrastructure build_cub.sh, test_cub.sh, build_and_test_targets.sh, matrix.yaml Directly maps to our [INFRA-CI] and [INFRA-BUILD] items - .agent/skills/ (7 files) — NVIDIA's own agent skills for CCCL cccl-style/SKILL.md, cccl-test/SKILL.md, sass-diff/SKILL.md - docs/ (491 files) — Official CCCL documentation CI references, CMake guides, Python compute docs, libcudacxx PTX docs - test/ (12 files) — Top-level integration tests (cuda_smoke, stdpar) - Root configs: .clang-format, .clang-tidy, CONTRIBUTING.md, pyproject.toml - CLAUDE.md symlink → AGENTS.md (NVIDIA's standard) cccl_upstream now mirrors full NVIDIA/cccl structure: Before: 42M (cub + thrust + libcudacxx + cudax + c + examples + benchmarks) After: 53M (+python +ci +docs +.agent +test +configs) This completes the CCCL base needed for: - [muh-bench] items: ci/util/build_and_test_targets.sh for targeted builds - [CCCL-verify] items: python/cuda_cccl/tests/ as reference implementations - [CCCL-test] items: ci/test_cub.sh, ci/test_thrust.sh - Agent workflow: .agent/skills/ for consistent style and test patterns
This commit is contained in:
54
cccl_upstream/test/stdpar/CMakeLists.txt
Normal file
54
cccl_upstream/test/stdpar/CMakeLists.txt
Normal file
@@ -0,0 +1,54 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
|
||||
# NOTE: this is build outside of the libcu++ test harness
|
||||
project(CCCL_STDPAR_TESTS LANGUAGES CXX)
|
||||
|
||||
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL NVHPC)
|
||||
message(FATAL_ERROR "The stdpar tests require nvc++ for CMAKE_CXX_COMPILER.")
|
||||
endif()
|
||||
|
||||
# Enable testing for the project
|
||||
enable_testing()
|
||||
|
||||
find_package(
|
||||
CCCL
|
||||
CONFIG
|
||||
REQUIRED
|
||||
NO_DEFAULT_PATH # Only check the explicit HINTS below:
|
||||
HINTS "${CMAKE_CURRENT_LIST_DIR}/../../lib/cmake/cccl/"
|
||||
)
|
||||
|
||||
file(
|
||||
GLOB test_files
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${CMAKE_CURRENT_LIST_DIR}"
|
||||
CONFIGURE_DEPENDS
|
||||
"tests/*.cpp"
|
||||
)
|
||||
|
||||
function(cccl_add_stdpar_test test_file)
|
||||
get_filename_component(test_name ${test_file} NAME_WE)
|
||||
|
||||
add_executable(stdpar_test_${test_name} ${test_file})
|
||||
target_link_libraries(stdpar_test_${test_name} PUBLIC CCCL::CCCL)
|
||||
|
||||
# Ensure that we are testing with GPU support
|
||||
target_compile_options(stdpar_test_${test_name} PUBLIC -stdpar=gpu)
|
||||
target_link_options(stdpar_test_${test_name} PUBLIC -stdpar=gpu)
|
||||
|
||||
# Ensure that we are indeed testing the same CCCL version
|
||||
target_compile_definitions(
|
||||
stdpar_test_${test_name}
|
||||
PUBLIC
|
||||
CMAKE_CCCL_VERSION_MAJOR=${CCCL_VERSION_MAJOR}
|
||||
CMAKE_CCCL_VERSION_MINOR=${CCCL_VERSION_MINOR}
|
||||
CMAKE_CCCL_VERSION_PATCH=${CCCL_VERSION_PATCH}
|
||||
)
|
||||
|
||||
# Register with ctest
|
||||
add_test(NAME stdpar_test_${test_name} COMMAND stdpar_test_${test_name})
|
||||
endfunction()
|
||||
|
||||
foreach (test IN LISTS test_files)
|
||||
cccl_add_stdpar_test(${test})
|
||||
endforeach()
|
||||
52
cccl_upstream/test/stdpar/tests/adjacent_difference.cpp
Normal file
52
cccl_upstream/test/stdpar/tests/adjacent_difference.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <execution>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
|
||||
int main()
|
||||
{
|
||||
constexpr std::size_t N = 1 << 16;
|
||||
|
||||
auto all_one = [](const int val) {
|
||||
return val == 1;
|
||||
};
|
||||
|
||||
std::vector<int> in(N);
|
||||
std::vector<int> out(N);
|
||||
std::iota(in.begin(), in.end(), 0);
|
||||
|
||||
// Default op (difference)
|
||||
std::adjacent_difference(std::execution::par, in.begin(), in.end(), out.begin());
|
||||
|
||||
if (out[0] != in[0])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (!std::all_of(out.begin() + 1, out.end(), all_one))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Custom binary op: sum of neighbors: out[0] = in[0]
|
||||
std::fill(out.begin(), out.end(), 0);
|
||||
std::adjacent_difference(std::execution::par, in.begin(), in.end(), out.begin(), [](int x, int y) {
|
||||
return x + y;
|
||||
});
|
||||
|
||||
if (out[0] != in[0])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (std::size_t i = 1; i < N; ++i)
|
||||
{
|
||||
const int expected = in[i] + in[i - 1];
|
||||
if (out[i] != expected)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
38
cccl_upstream/test/stdpar/tests/all_of.cpp
Normal file
38
cccl_upstream/test/stdpar/tests/all_of.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <execution>
|
||||
#include <vector>
|
||||
|
||||
// Ensure that we are indeed using the correct CCCL version
|
||||
static_assert(CCCL_MAJOR_VERSION == CMAKE_CCCL_VERSION_MAJOR);
|
||||
static_assert(CCCL_MINOR_VERSION == CMAKE_CCCL_VERSION_MINOR);
|
||||
static_assert(CCCL_PATCH_VERSION == CMAKE_CCCL_VERSION_PATCH);
|
||||
|
||||
int main()
|
||||
{
|
||||
constexpr std::size_t N = 1 << 16;
|
||||
std::vector<int> v(N, 1);
|
||||
|
||||
// All elements are 1, so this should be true
|
||||
const bool all_ones = std::all_of(std::execution::par, v.begin(), v.end(), [](int x) {
|
||||
return x == 1;
|
||||
});
|
||||
|
||||
if (!all_ones)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Flip a single element in the middle, now all elements are not 1
|
||||
v[N / 2] = 2;
|
||||
const bool still_all_ones = std::all_of(std::execution::par, v.begin(), v.end(), [](int x) {
|
||||
return x == 1;
|
||||
});
|
||||
|
||||
if (still_all_ones)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
47
cccl_upstream/test/stdpar/tests/any_of.cpp
Normal file
47
cccl_upstream/test/stdpar/tests/any_of.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDA C++ Core Libraries, under the Apache License v2.0 with
|
||||
// LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <cuda/version>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <execution>
|
||||
#include <vector>
|
||||
|
||||
// Ensure that we are indeed using the correct CCCL version
|
||||
static_assert(CCCL_MAJOR_VERSION == CMAKE_CCCL_VERSION_MAJOR);
|
||||
static_assert(CCCL_MINOR_VERSION == CMAKE_CCCL_VERSION_MINOR);
|
||||
static_assert(CCCL_PATCH_VERSION == CMAKE_CCCL_VERSION_PATCH);
|
||||
|
||||
int main()
|
||||
{
|
||||
constexpr std::size_t num_items = 1 << 16;
|
||||
std::vector<int> values(num_items, 0);
|
||||
|
||||
constexpr auto is_one = [](const int value) {
|
||||
return value == 1;
|
||||
};
|
||||
|
||||
const bool initially_contains_one = std::any_of(std::execution::par, values.begin(), values.end(), is_one);
|
||||
if (initially_contains_one)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
values[num_items / 2] = 1;
|
||||
const bool contains_one = std::any_of(std::execution::par, values.begin(), values.end(), is_one);
|
||||
const bool empty_has_a_one = std::any_of(std::execution::par, values.begin(), values.begin(), is_one);
|
||||
|
||||
if (!contains_one || empty_has_a_one)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
26
cccl_upstream/test/stdpar/tests/reduce.cpp
Normal file
26
cccl_upstream/test/stdpar/tests/reduce.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <execution>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
|
||||
// Ensure that we are indeed using the correct CCCL version
|
||||
static_assert(CCCL_MAJOR_VERSION == CMAKE_CCCL_VERSION_MAJOR);
|
||||
static_assert(CCCL_MINOR_VERSION == CMAKE_CCCL_VERSION_MINOR);
|
||||
static_assert(CCCL_PATCH_VERSION == CMAKE_CCCL_VERSION_PATCH);
|
||||
|
||||
constexpr int N = 1000;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::vector<int> v(N);
|
||||
std::fill(std::execution::par_unseq, v.begin(), v.end(), 42);
|
||||
|
||||
int sum = std::reduce(std::execution::par_unseq, v.begin(), v.end(), 100, [](int a, int b) {
|
||||
return a + b;
|
||||
});
|
||||
assert(sum == (42 * N) + 100);
|
||||
|
||||
sum = std::reduce(std::execution::par_unseq, v.begin(), v.end(), 100);
|
||||
assert(sum == (42 * N) + 100);
|
||||
}
|
||||
80
cccl_upstream/test/stdpar/tests/transform.cpp
Normal file
80
cccl_upstream/test/stdpar/tests/transform.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDA C++ Core Libraries, under the Apache License v2.0 with
|
||||
// LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <cuda/version>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <execution>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
|
||||
// Ensure that we are indeed using the correct CCCL version
|
||||
static_assert(CCCL_MAJOR_VERSION == CMAKE_CCCL_VERSION_MAJOR);
|
||||
static_assert(CCCL_MINOR_VERSION == CMAKE_CCCL_VERSION_MINOR);
|
||||
static_assert(CCCL_PATCH_VERSION == CMAKE_CCCL_VERSION_PATCH);
|
||||
|
||||
int main()
|
||||
{
|
||||
constexpr std::size_t num_items = 1 << 16;
|
||||
std::vector<int> values(num_items);
|
||||
const std::vector<int> offsets(num_items, 5);
|
||||
std::vector<int> output(num_items, 0);
|
||||
std::iota(values.begin(), values.end(), 0);
|
||||
|
||||
constexpr auto double_value = [](const int value) {
|
||||
return value * 2;
|
||||
};
|
||||
|
||||
constexpr auto add_values = [](const int lhs, const int rhs) {
|
||||
return lhs + rhs;
|
||||
};
|
||||
|
||||
const auto unary_end =
|
||||
std::transform(std::execution::par, values.begin(), values.end(), output.begin(), double_value);
|
||||
|
||||
if (unary_end != output.end())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < num_items; ++i)
|
||||
{
|
||||
if (output[i] != values[i] * 2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
const auto binary_end =
|
||||
std::transform(std::execution::par, values.begin(), values.end(), offsets.begin(), output.begin(), add_values);
|
||||
|
||||
if (binary_end != output.end())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < num_items; ++i)
|
||||
{
|
||||
if (output[i] != values[i] + offsets[i])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
const auto empty_end =
|
||||
std::transform(std::execution::par, values.begin(), values.begin(), output.begin(), double_value);
|
||||
|
||||
if (empty_end != output.begin())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user