[CCCL] 瘦身 + 补全: 移除 cudax/python/libcudacxx-tests 冗余文件, 新增 c2h 测试助手 + cmake 构建系统 + 8 个 CUDA thrust examples

变更摘要:
- 删除: cudax/ (783 files, 7.2M) — 实验性组件,竞赛不需要
- 删除: python/ (226 files, 2.0M) — Python 绑定,竞赛不需要
- 删除: libcudacxx/{test,benchmarks,codegen,cmake,share} (4432 files, 31M)
  保留: libcudacxx/include/ (1463 headers, cuda::std 编译依赖)
- 新增: c2h/ (27 files) — CUB Catch2 测试辅助头文件,编译 243 个测试必需
- 新增: cmake/ (29 files) — CCCL 原生 CMake 构建系统
- 新增: thrust/examples/cuda/ (7 files) + cpp_integration/ (1 file)
  async_reduce, custom_temporary_allocation, explicit_cuda_stream,
  global_device_vector, range_view, unwrap_pointer, wrap_pointer, device

结果: cccl_upstream 从 74M→35M (瘦身 53%), 核心内容 100% 保留:
  27/27 tuning headers, 78 benchmarks, 243 tests,
  60 thrust examples, 18 CUB examples, 全部编译头文件
This commit is contained in:
muh-bot
2026-08-03 12:39:26 +00:00
parent a2a5dd8f00
commit 24ef6a91b5
5439 changed files with 0 additions and 719516 deletions

View File

@@ -1,131 +0,0 @@
// SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
// SPDX-License-Identifier: SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <thrust/device_vector.h>
#include <cuda/std/cstddef>
#include <cuda/std/cstdint>
#include <cuda/experimental/__cuco/hash_functions.cuh>
#include <nvbench/nvbench.cuh>
#include <nvbench/range.cuh>
namespace cudax = cuda::experimental;
// repeat hash computation n times
static constexpr auto n_repeats = 100;
template <cuda::std::int32_t Words>
struct large_key
{
constexpr __host__ __device__ large_key(cuda::std::int32_t seed) noexcept
{
for (cuda::std::int32_t i = 0; i < Words; ++i)
{
data_[i] = seed;
}
}
private:
cuda::std::int32_t data_[Words];
};
template <cuda::std::int32_t BlockSize, typename Key, typename Hasher, typename OutputIt>
__global__ void hash_bench_kernel(Hasher hash, size_t n, OutputIt out, bool materialize_result)
{
size_t const gid = static_cast<size_t>(BlockSize) * blockIdx.x + threadIdx.x;
size_t const loop_stride = static_cast<size_t>(gridDim.x) * BlockSize;
size_t idx = gid;
using result_t = decltype(hash(0));
result_t agg{};
while (idx < n)
{
Key key(idx);
for (cuda::std::int32_t i = 0; i < n_repeats; ++i)
{ // execute hash func n times
agg += hash(key);
}
idx += loop_stride;
}
if (materialize_result)
{
out[gid] = agg;
}
}
// benchmark evaluating performance of various hash functions
template <typename HasherTag, typename Key>
void hash_eval(nvbench::state& state, nvbench::type_list<HasherTag, Key>)
{
using Hash = typename HasherTag::template fn<Key>;
bool const materialize_result = false;
constexpr auto block_size = 128;
auto const num_keys = state.get_int64("NumInputs");
auto const grid_size = (num_keys + block_size * 16 - 1) / block_size * 16;
using result_t = decltype(std::declval<Hash>()(std::declval<cuda::std::int32_t>()));
thrust::device_vector<result_t> hash_values((materialize_result) ? num_keys : 1);
state.add_element_count(num_keys);
state.exec([&](nvbench::launch& launch) {
hash_bench_kernel<block_size, Key>
<<<grid_size, block_size, 0, launch.get_stream()>>>(Hash{}, num_keys, hash_values.begin(), materialize_result);
});
}
struct xxhash_32_tag
{
template <typename Key>
using fn = cudax::cuco::hash<Key, cudax::cuco::hash_algorithm::xxhash_32>;
};
struct xxhash_64_tag
{
template <typename Key>
using fn = cudax::cuco::hash<Key, cudax::cuco::hash_algorithm::xxhash_64>;
};
struct murmurhash3_32_tag
{
template <typename Key>
using fn = cudax::cuco::hash<Key, cudax::cuco::hash_algorithm::murmurhash3_32>;
};
#if _CCCL_HAS_INT128()
struct murmurhash3_x86_128_tag
{
template <typename Key>
using fn = cudax::cuco::hash<Key, cudax::cuco::hash_algorithm::murmurhash3_x86_128>;
};
struct murmurhash3_x64_128_tag
{
template <typename Key>
using fn = cudax::cuco::hash<Key, cudax::cuco::hash_algorithm::murmurhash3_x64_128>;
};
#endif // _CCCL_HAS_INT128()
NVBENCH_BENCH_TYPES(
hash_eval,
NVBENCH_TYPE_AXES(
nvbench::type_list<xxhash_32_tag,
xxhash_64_tag,
murmurhash3_32_tag
#if _CCCL_HAS_INT128()
,
murmurhash3_x86_128_tag,
murmurhash3_x64_128_tag
#endif // _CCCL_HAS_INT128()
>,
nvbench::type_list<cuda::std::int32_t, large_key<4>, large_key<8>, large_key<16>, large_key<32>>))
.set_name("hash_function_eval")
.set_type_axes_names({"Hash", "Key"})
.add_int64_power_of_two_axis("NumInputs", nvbench::range(18, 26, 4));