实用跨度#

group utility_span

变量

constexpr std::size_t dynamic_extent = std::numeric_limits<std::size_t>::max()#

用于区分静态和动态范围的std::span的常量。

template<typename T>
struct is_host_span_supported_container : public std::false_type#
template<typename T, typename Alloc>
struct is_host_span_supported_container<std::vector<T, Alloc>> : public std::true_type#
template<typename T, typename Alloc>
struct is_host_span_supported_container<thrust::host_vector<T, Alloc>> : public std::true_type#
template<typename T, typename Alloc>
struct is_host_span_supported_container<std::basic_string<T, std::char_traits<T>, Alloc>> : public std::true_type#
template<typename T, std::size_t Extent = cudf::dynamic_extent>
struct host_span : public cudf::detail::span_base<T, cudf::dynamic_extent, host_span<T, cudf::dynamic_extent>>#
#include <span.hpp>

C++20 std::span 具有减少的功能集。

公共类型

using base = cudf::detail::span_base<T, Extent, host_span<T, Extent>>#

基本类型。

公共函数

inline constexpr host_span(T *data, std::size_t size, bool is_device_accessible)#

从指针和大小构造

Parameters:
  • data – 指向跨度中第一个元素的指针

  • size – span 中的元素数量

  • is_device_accessible – 数据是否可被设备访问(例如固定内存)

template<typename C>
inline constexpr host_span(C &in)#

从容器构造

Parameters:

in – 用于构建跨度的容器

template<typename C>
inline constexpr host_span(C const &in)#

从常量容器构造

Parameters:

in – 用于构造跨度的容器

template<typename OtherT>
inline constexpr host_span(cudf::detail::host_vector<OtherT> &in)#

从 host_vector 构造函数

Parameters:

in – 用于构造span的主机向量

template<typename OtherT>
inline constexpr host_span(cudf::detail::host_vector<OtherT> const &in)#

从常量 host_vector 构造函数

Parameters:

in – 用于构造span的主机向量

template<typename OtherT, std::size_t OtherExtent>
inline constexpr host_span(host_span<OtherT, OtherExtent> const &other) noexcept#
Parameters:

other – 要复制的跨度

inline bool is_device_accessible() const#

返回数据是否可被设备访问(例如固定内存)

Returns:

如果数据是设备可访问的,则为 true

inline constexpr host_span subspan(typename base::size_type offset, typename base::size_type count) const noexcept#

获取一个跨度,该跨度是从偏移量开始的此跨度的count个元素的视图。

Parameters:
  • offset – 子跨度中第一个元素的偏移量

  • count – 子跨度中的元素数量

Returns:

序列的子跨度,具有请求的计数和偏移量

template<typename T>
struct is_device_span_supported_container : public std::false_type#
template<typename T, typename Alloc>
struct is_device_span_supported_container<thrust::device_vector<T, Alloc>> : public std::true_type#
template<typename T>
struct is_device_span_supported_container<rmm::device_vector<T>> : public std::true_type#
template<typename T>
struct is_device_span_supported_container<rmm::device_uvector<T>> : public std::true_type#
template<typename T, std::size_t Extent = cudf::dynamic_extent>
struct device_span : public cudf::detail::span_base<T, cudf::dynamic_extent, device_span<T, cudf::dynamic_extent>>#
#include <span.hpp>

C++20 std::span 的设备版本,功能集有所减少。

公共类型

using base = cudf::detail::span_base<T, Extent, device_span<T, Extent>>#

基本类型。

公共函数

template<typename C>
inline constexpr device_span(C &in)#

从容器构造

Parameters:

in – 用于构造跨度的容器

template<typename C>
inline constexpr device_span(C const &in)#

从常量容器构造

Parameters:

in – 用于构造跨度的容器

template<typename OtherT, std::size_t OtherExtent>
inline constexpr device_span(device_span<OtherT, OtherExtent> const &other) noexcept#
Parameters:

other – 要复制的跨度

inline constexpr device_span subspan(typename base::size_type offset, typename base::size_type count) const noexcept#

获取一个跨度,该跨度是从偏移量开始的此跨度的count个元素的视图。

Parameters:
  • offset – 子跨度中第一个元素的偏移量

  • count – 子跨度中的元素数量

Returns:

序列的子跨度,具有请求的计数和偏移量