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
111 lines
3.4 KiB
Plaintext
111 lines
3.4 KiB
Plaintext
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of libcu++, the C++ Standard Library for your entire system,
|
|
// 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) 2025 NVIDIA CORPORATION & AFFILIATES.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef _CUDA_STD_CSTRING
|
|
#define _CUDA_STD_CSTRING
|
|
|
|
#include <cuda/std/detail/__config>
|
|
|
|
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
|
# pragma GCC system_header
|
|
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
|
# pragma clang system_header
|
|
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
|
# pragma system_header
|
|
#endif // no system header
|
|
|
|
#include <cuda/std/__cstring/memcpy.h>
|
|
#include <cuda/std/__cstring/memset.h>
|
|
#include <cuda/std/__string/constexpr_c_functions.h>
|
|
|
|
#if _CCCL_HOSTED()
|
|
# include <cstring>
|
|
#endif // _CCCL_HOSTED()
|
|
|
|
#include <cuda/std/__cccl/prologue.h>
|
|
|
|
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
|
|
|
using ::size_t;
|
|
|
|
_CCCL_API constexpr char* strcpy(char* _CCCL_RESTRICT __dst, const char* _CCCL_RESTRICT __src)
|
|
{
|
|
return ::cuda::std::__cccl_strcpy(__dst, __src);
|
|
}
|
|
|
|
_CCCL_API constexpr char* strncpy(char* _CCCL_RESTRICT __dst, const char* _CCCL_RESTRICT __src, size_t __n)
|
|
{
|
|
return ::cuda::std::__cccl_strncpy(__dst, __src, __n);
|
|
}
|
|
|
|
[[nodiscard]] _CCCL_API constexpr size_t strlen(const char* __ptr)
|
|
{
|
|
return ::cuda::std::__cccl_strlen(__ptr);
|
|
}
|
|
|
|
[[nodiscard]] _CCCL_API constexpr int strcmp(const char* __lhs, const char* __rhs)
|
|
{
|
|
return ::cuda::std::__cccl_strcmp(__lhs, __rhs);
|
|
}
|
|
|
|
[[nodiscard]] _CCCL_API constexpr int strncmp(const char* __lhs, const char* __rhs, size_t __n)
|
|
{
|
|
return ::cuda::std::__cccl_strncmp(__lhs, __rhs, __n);
|
|
}
|
|
|
|
[[nodiscard]] _CCCL_API constexpr const char* strchr(const char* __ptr, int __c)
|
|
{
|
|
return ::cuda::std::__cccl_strchr<const char>(__ptr, static_cast<char>(__c));
|
|
}
|
|
|
|
[[nodiscard]] _CCCL_API constexpr char* strchr(char* __ptr, int __c)
|
|
{
|
|
return ::cuda::std::__cccl_strchr(__ptr, static_cast<char>(__c));
|
|
}
|
|
|
|
[[nodiscard]] _CCCL_API constexpr const char* strrchr(const char* __ptr, int __c)
|
|
{
|
|
return ::cuda::std::__cccl_strrchr<const char>(__ptr, static_cast<char>(__c));
|
|
}
|
|
|
|
[[nodiscard]] _CCCL_API constexpr char* strrchr(char* __ptr, int __c)
|
|
{
|
|
return ::cuda::std::__cccl_strrchr(__ptr, static_cast<char>(__c));
|
|
}
|
|
|
|
_CCCL_API inline const void* memchr(const void* __ptr, int __c, size_t __n) noexcept
|
|
{
|
|
return ::cuda::std::__cccl_memchr<const unsigned char>(
|
|
reinterpret_cast<const unsigned char*>(__ptr), static_cast<unsigned char>(__c), __n);
|
|
}
|
|
|
|
_CCCL_API inline void* memchr(void* __ptr, int __c, size_t __n) noexcept
|
|
{
|
|
return ::cuda::std::__cccl_memchr(reinterpret_cast<unsigned char*>(__ptr), static_cast<unsigned char>(__c), __n);
|
|
}
|
|
|
|
_CCCL_API inline void* memmove(void* __dst, const void* __src, size_t __n) noexcept
|
|
{
|
|
return ::cuda::std::__cccl_memmove(
|
|
reinterpret_cast<unsigned char*>(__dst), reinterpret_cast<const unsigned char*>(__src), __n);
|
|
}
|
|
|
|
[[nodiscard]] _CCCL_API inline int memcmp(const void* __lhs, const void* __rhs, size_t __n) noexcept
|
|
{
|
|
return ::cuda::std::__cccl_memcmp(
|
|
reinterpret_cast<const unsigned char*>(__lhs), reinterpret_cast<const unsigned char*>(__rhs), __n);
|
|
}
|
|
|
|
_CCCL_END_NAMESPACE_CUDA_STD
|
|
|
|
#include <cuda/std/__cccl/epilogue.h>
|
|
|
|
#endif // _CUDA_STD_CSTRING
|