[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,15 +0,0 @@
#===----------------------------------------------------------------------===##
#
# Part of CUDA Experimental in 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.
#
#===----------------------------------------------------------------------===##
file(GLOB test_srcs LIST_DIRECTORIES FALSE CONFIGURE_DEPENDS *.cu *.cpp)
foreach (src IN LISTS test_srcs)
cudax_add_multi_gpu_test("concepts" test_target "${src}")
endforeach()

View File

@@ -1,66 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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.
//
//===----------------------------------------------------------------------===//
#ifndef _CUDAX_TEST_MULTI_GPU_COLLECTIVE_CONCEPTS_COMMON_CUH
#define _CUDAX_TEST_MULTI_GPU_COLLECTIVE_CONCEPTS_COMMON_CUH
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include "concepts_common.cuh"
namespace cudax_multi_gpu_concepts
{
struct collective_communicator_model : communicator_model
{
template <class Tp, class Op>
void reduce(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, Op, ::cuda::std::int32_t, ::cuda::stream_ref);
template <class Tp, class Op>
void all_reduce(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, Op, ::cuda::stream_ref);
template <class Tp>
void gather(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
template <class Tp>
void gather_v(
group_guard_type&,
Tp*,
::cuda::std::size_t,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
::cuda::std::int32_t,
::cuda::stream_ref);
template <class Tp>
void all_gather(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::stream_ref);
template <class Tp>
void broadcast(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
template <class Tp>
void all_to_all(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::stream_ref);
template <class Tp>
void all_to_all_v(
group_guard_type&,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
::cuda::stream_ref);
};
} // namespace cudax_multi_gpu_concepts
#endif // _CUDAX_TEST_MULTI_GPU_COLLECTIVE_CONCEPTS_COMMON_CUH

View File

@@ -1,44 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct no_send : types::basic_communicator_model
{
template <class Tp>
void recv(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
struct no_recv : types::basic_communicator_model
{
template <class Tp>
void send(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("communicator concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__communicator<types::communicator_model>);
STATIC_REQUIRE(!cudax::__communicator<no_send>);
STATIC_REQUIRE(!cudax::__communicator<no_recv>);
}

View File

@@ -1,43 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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.
//
//===----------------------------------------------------------------------===//
#ifndef _CUDAX_TEST_MULTI_GPU_CONCEPTS_COMMON_CUH
#define _CUDAX_TEST_MULTI_GPU_CONCEPTS_COMMON_CUH
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
namespace cudax_multi_gpu_concepts
{
struct group_guard
{};
struct basic_communicator_model
{
using native_handle_type = int;
using group_guard_type = group_guard;
native_handle_type native_handle() noexcept;
::cuda::std::int32_t rank() noexcept;
::cuda::std::int32_t size() noexcept;
group_guard_type group_guard();
};
struct communicator_model : basic_communicator_model
{
template <class Tp>
void send(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
template <class Tp>
void recv(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
} // namespace cudax_multi_gpu_concepts
#endif // _CUDAX_TEST_MULTI_GPU_CONCEPTS_COMMON_CUH

View File

@@ -1,43 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct all_gather_returns_int : types::communicator_model
{
template <class Tp>
int all_gather(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_all_gather concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_all_gather<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_all_gather<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_all_gather<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_all_gather<all_gather_returns_int>);
}

View File

@@ -1,53 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/__type_traits/enable_if.h>
#include <cuda/std/__type_traits/is_void.h>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct all_reduce_rejects_void : types::communicator_model
{
template <class Tp, class Op, ::cuda::std::enable_if_t<!::cuda::std::is_void_v<Tp>, int> = 0>
void all_reduce(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, Op, ::cuda::stream_ref);
};
struct all_reduce_returns_int : types::communicator_model
{
template <class Tp, class Op>
int all_reduce(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, Op, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_all_reduce concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_all_reduce<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_all_reduce<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_all_reduce<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_all_reduce<all_reduce_returns_int>);
STATIC_REQUIRE(cudax::__has_all_reduce<all_reduce_rejects_void, int*>);
STATIC_REQUIRE(!cudax::__has_all_reduce<all_reduce_rejects_void, void*>);
}

View File

@@ -1,43 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct all_to_all_returns_int : types::communicator_model
{
template <class Tp>
int all_to_all(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_all_to_all concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_all_to_all<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_all_to_all<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_all_to_all<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_all_to_all<all_to_all_returns_int>);
}

View File

@@ -1,51 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct all_to_all_v_returns_int : types::communicator_model
{
template <class Tp>
int all_to_all_v(
group_guard_type&,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_all_to_all_v concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_all_to_all_v<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_all_to_all_v<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_all_to_all_v<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_all_to_all_v<all_to_all_v_returns_int>);
}

View File

@@ -1,44 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct broadcast_returns_int : types::communicator_model
{
template <class Tp>
int broadcast(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_broadcast concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_broadcast<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_broadcast<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_broadcast<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_broadcast<broadcast_returns_int>);
}

View File

@@ -1,44 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct gather_returns_int : types::communicator_model
{
template <class Tp>
int gather(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_gather concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_gather<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_gather<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_gather<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_gather<gather_returns_int>);
}

View File

@@ -1,51 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct gather_v_returns_int : types::communicator_model
{
template <class Tp>
int gather_v(group_guard_type&,
Tp*,
::cuda::std::size_t,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
::cuda::std::int32_t,
::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_gather_v concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_gather_v<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_gather_v<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_gather_v<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_gather_v<gather_v_returns_int>);
}

View File

@@ -1,50 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct recv_returns_int : types::basic_communicator_model
{
template <class Tp>
int recv(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
struct no_recv : types::basic_communicator_model
{
template <class Tp>
void send(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_recv concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_recv<types::communicator_model>);
STATIC_REQUIRE(cudax::__has_recv<types::communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_recv<no_recv>);
STATIC_REQUIRE(!cudax::__has_recv<recv_returns_int>);
}

View File

@@ -1,44 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct reduce_returns_int : types::communicator_model
{
template <class Tp, class Op>
int reduce(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, Op, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_reduce concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_reduce<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_reduce<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_reduce<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_reduce<reduce_returns_int>);
}

View File

@@ -1,50 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in 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/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct no_send : types::basic_communicator_model
{
template <class Tp>
void send_sync(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t);
};
struct send_returns_int : no_send
{
template <class Tp>
int send(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_send concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_send<types::communicator_model>);
STATIC_REQUIRE(cudax::__has_send<types::communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_send<no_send>);
STATIC_REQUIRE(!cudax::__has_send<send_returns_int>);
}