lists_column_device_view.cuh
1 /*
2  * 版权所有 (c) 2020-2024, NVIDIA CORPORATION.
3  *
4  * 根据 Apache 许可证 2.0 版 (以下简称“许可证”) 获得许可;
5  * 除非符合许可证的规定,否则您不得使用此文件。
6  * 您可在以下网址获取许可证副本:
7  *
8  * https://apache.ac.cn/licenses/LICENSE-2.0
9  *
10  * 除非适用法律要求或书面同意,否则根据许可证分发的软件
11  * 是基于“现状”分发的,
12  * 不附带任何形式的明示或默示担保或条件。
13  * 请参见许可证以了解具体管理权限和
14  * 限制。
15  */
16 #pragma once
17 
20 #include <cudf/types.hpp>
21 
22 #include <cuda_runtime.h>
23 
24 namespace cudf::detail {
25 
32  public
33  lists_column_device_view() = delete;
34  ~lists_column_device_view() = default;
49 
56  : column_device_view(underlying_)
57  {
58 #ifdef __CUDA_ARCH__
59  cudf_assert(underlying_.type().id() == type_id::LIST and
60  "lists_column_device_view 仅支持列表");
61 #else
62  CUDF_EXPECTS(underlying_.type().id() == type_id::LIST,
63  "lists_column_device_view 仅支持列表");
64 #endif
65  }
66 
71 
77  [[nodiscard]] __device__ inline column_device_view offsets() const
78  {
80  }
81 
89  [[nodiscard]] __device__ inline size_type offset_at(size_type idx) const
90  {
91  return offsets().size() > 0 ? offsets().element<size_type>(offset() + idx) : 0;
92  }
93 
99  [[nodiscard]] __device__ inline column_device_view child() const
100  {
102  }
103 
109  [[nodiscard]] __device__ inline column_device_view get_sliced_child() const
110  {
111  auto start = offset_at(0);
112  auto end = offset_at(size());
113  return child().slice(start, end - start);
114  }
115 };
116 
117 } // 命名空间 cudf::detail
设备数据的不可变、非拥有视图,表示为元素列,易于复制且...
column_device_view child(size_type child_index) const noexcept
返回指定的子列。
T element(size_type element_index) const noexcept
返回指定索引处元素的引用。
CUDF_HOST_DEVICE column_device_view slice(size_type offset, size_type size) const noexcept
获取一个新的 column_device_view,它是当前列的一个切片。
const_iterator< T > end() const
返回指向列中最后一个元素之后元素的迭代器。
constexpr CUDF_HOST_DEVICE type_id id() const noexcept
返回类型标识符。
定义: types.hpp:287
CUDF_HOST_DEVICE data_type type() const noexcept
返回元素类型。
CUDF_HOST_DEVICE size_type size() const noexcept
返回列中的元素数量。
bool is_null(size_type element_index) const noexcept
返回指定元素是否为空。
CUDF_HOST_DEVICE size_type offset() const noexcept
返回第一个元素相对于基础内存分配的索引,即...
CUDF_HOST_DEVICE bool nullable() const noexcept
指示列是否可以包含空元素,即是否已分配位掩码。
给定一个 column_device_view,此类实例为此复合列提供了一个包装器,用于...
column_device_view offsets() const
获取底层列表列的偏移量列。
CUDF_HOST_DEVICE lists_column_device_view(column_device_view const &underlying_)
从 column device view 构造一个新的 lists column device view 对象。
lists_column_device_view(lists_column_device_view &&)=default
移动构造函数。
column_device_view get_sliced_child() const
获取底层列表列的子列,并应用了偏移量和大小。
lists_column_device_view & operator=(lists_column_device_view const &)=default
复制赋值运算符。
lists_column_device_view & operator=(lists_column_device_view &&)=default
移动赋值运算符。
size_type offset_at(size_type idx) const
获取给定行索引处的列表偏移值,同时考虑列偏移量。
lists_column_device_view(lists_column_device_view const &)=default
复制构造函数。
column_device_view child() const
获取底层列表列的子列。
static constexpr size_type child_column_index
子列的索引。
static constexpr size_type offsets_column_index
偏移量列的索引。
Column device view 类定义。
#define CUDF_EXPECTS(...)
用于检查 (前置) 条件的宏,当条件不满足时抛出异常。
定义: error.hpp:178
int32_t size_type
列和表的行索引类型。
定义: types.hpp:95
@ LIST
列表元素。
cudf::lists_column_view 的类定义。
libcudf 的类型声明。
#define CUDF_HOST_DEVICE
指示函数或方法可在主机和设备上使用。
定义: types.hpp:32