CCCL (CUDA C++ Core Libraries) provides: - CUB: device/block/warp-level GPU primitives (reduce, scan, sort, topk) - Thrust: high-level parallel algorithms (transform_reduce, sort, scan) - libcudacxx: CUDA C++ standard library (atomics, barriers, memory) - cudax: experimental features (memory resources, allocators) - Tuning policies: per-SM hardware-specific algorithm parameters Competition optimization vectors mapped to CCCL: - Output TPS (83% weight): warp_reduce, block_reduce, device_topk - Input TPS (14% weight): device_scan, block_load, prefetch - Cache TPS (3% weight): prefix caching strategy patterns - Memory (0.9 util): pooled/cached/buddy allocators Source: https://github.com/NVIDIA/cccl (shallow clone, HEAD only) License: Apache-2.0
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
// SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
#include <sstream>
|
|
|
|
#include "test_util.h"
|
|
#include <c2h/catch2_test_helper.h>
|
|
|
|
template <typename T>
|
|
std::string print(T val)
|
|
{
|
|
std::stringstream ss;
|
|
ss << val;
|
|
return ss.str();
|
|
}
|
|
|
|
#if TEST_INT128()
|
|
TEST_CASE("Test utils can print __int128", "[test][utils]")
|
|
{
|
|
REQUIRE(print(__int128_t{0}) == "0");
|
|
REQUIRE(print(__int128_t{42}) == "42");
|
|
REQUIRE(print(__int128_t{-1}) == "-1");
|
|
REQUIRE(print(__int128_t{-42}) == "-42");
|
|
REQUIRE(print(-1 * (__int128_t{1} << 120)) == "-1329227995784915872903807060280344576");
|
|
}
|
|
|
|
TEST_CASE("Test utils can print __uint128", "[test][utils]")
|
|
{
|
|
REQUIRE(print(__uint128_t{0}) == "0");
|
|
REQUIRE(print(__uint128_t{1}) == "1");
|
|
REQUIRE(print(__uint128_t{42}) == "42");
|
|
REQUIRE(print(__uint128_t{1} << 120) == "1329227995784915872903807060280344576");
|
|
}
|
|
#endif
|
|
|
|
TEST_CASE("Test utils can print KeyValuePair", "[test][utils]")
|
|
{
|
|
REQUIRE(print(cub::KeyValuePair<int, int>{42, -42}) == "(42,-42)");
|
|
}
|