Files
project_6/cccl_upstream/thrust/thrust/universal_vector.h
EngineX CI 56fd68e7dd [INFRA] Import NVIDIA/CCCL upstream as optimization reference library
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
2026-07-30 09:35:51 +00:00

72 lines
2.4 KiB
C++

// SPDX-FileCopyrightText: Copyright (c) 2008-2020, NVIDIA Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
/*! \file
* \brief A dynamically-sizable array of elements which resides in memory
* accessible to both hosts and devices.
*/
#pragma once
#include <thrust/detail/config.h>
#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 <thrust/universal_allocator.h>
// Some build systems need a hint to know which files we could include
#if 0
# include <thrust/system/cpp/vector.h>
# include <thrust/system/cuda/vector.h>
# include <thrust/system/omp/vector.h>
# include <thrust/system/tbb/vector.h>
#endif
// #include the device system's vector header
#define __THRUST_DEVICE_SYSTEM_VECTOR_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/vector.h>
#include __THRUST_DEVICE_SYSTEM_VECTOR_HEADER
#undef __THRUST_DEVICE_SYSTEM_VECTOR_HEADER
THRUST_NAMESPACE_BEGIN
/*! \addtogroup containers Containers
* \{
*/
/*! A \p universal_vector is a container that supports random access to elements,
* constant time removal of elements at the end, and linear time insertion
* and removal of elements at the beginning or in the middle. The number of
* elements in a \p universal_vector may vary dynamically; memory management is
* automatic. The memory associated with a \p universal_vector resides in memory
* accessible to hosts and devices.
*
* \see https://en.cppreference.com/w/cpp/container/vector
* \see host_vector For the documentation of the complete interface which is
* shared by \p universal_vector.
* \see device_vector
* \see universal_host_pinned_vector
*
* \verbatim embed:rst:leading-asterisk
* .. versionadded:: 2.2.0
* \endverbatim
*/
template <typename T, typename Allocator = universal_allocator<T>>
using universal_vector = thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::universal_vector<T, Allocator>;
//! Like \ref universal_vector but uses pinned memory when the system supports it.
//! \see device_vector
//! \see universal_vector
template <typename T>
using universal_host_pinned_vector = thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::universal_host_pinned_vector<T>;
/*! \} // containers
*/
THRUST_NAMESPACE_END