公共成员函数 | 所有成员列表
cudf::segmented_reduce_host_udf 结构体参考抽象类

基于主机端的 UDF 实现用于分段归约的接口。更多...

#include <host_udf.hpp>

cudf::segmented_reduce_host_udf 的继承图
cudf::host_udf_base

公共成员函数

virtual std::unique_ptr< columnoperator() (column_view const &input, device_span< size_type const > offsets, data_type output_dtype, null_policy null_handling, std::optional< std::reference_wrapper< scalar const >> init, rmm::cuda_stream_view stream, rmm::device_async_resource_ref mr) const =0
 执行分段归约操作。更多...
 
- 继承自 cudf::host_udf_base 的公共成员函数
virtual ~host_udf_base ()=default
 默认析构函数。
 
virtual std::size_t do_hash () const
 计算实例的哈希值。更多...
 
virtual bool is_equal (host_udf_base const &other) const =0
 比较派生类的两个实例是否相等。更多...
 
virtual std::unique_ptr< host_udf_baseclone () const =0
 克隆实例。更多...
 

详细描述

基于主机端的 UDF 实现用于分段归约的接口。

用于分段归约的主机端 UDF 实现需要派生自此结构体。除了实现基类 host_udf_base 中声明的虚函数外,此类派生类还必须定义 operator() 函数以执行分段归约。

示例

struct my_udf_aggregation : cudf::segmented_reduce_host_udf {
my_udf_aggregation() = default;
[[nodiscard]] std::unique_ptr<column> operator()(
column_view const& input,
device_span<size_type const> offsets,
data_type output_dtype,
null_policy null_handling,
std::optional<std::reference_wrapper<scalar const>> init,
rmm::device_async_resource_ref mr) const override
{
// 使用输入数据执行计算并返回结果。
// 这是实际实现分段归约逻辑的地方。
}
[[nodiscard]] bool is_equal(host_udf_base const& other) const override
{
// 检查另一个对象是否也是此类的一个实例。
// 如果有内部状态变量,也可能需要检查它们是否相等。
return dynamic_cast<my_udf_aggregation const*>(&other) != nullptr;
}
[[nodiscard]] std::unique_ptr<host_udf_base> clone() const override
{
return std::make_unique<my_udf_aggregation>();
}
};
virtual bool is_equal(host_udf_base const &other) const =0
比较派生类的两个实例是否相等。
virtual std::unique_ptr< host_udf_base > clone() const =0
克隆实例。
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
null_policy
用于指定是否包含或排除空值的枚举。
定义: types.hpp:126
基于主机端的 UDF 实现用于分段归约的接口。
virtual std::unique_ptr< column > operator()(column_view const &input, device_span< size_type const > offsets, data_type output_dtype, null_policy null_handling, std::optional< std::reference_wrapper< scalar const >> init, rmm::cuda_stream_view stream, rmm::device_async_resource_ref mr) const =0
执行分段归约操作。

定义于文件 host_udf.hpp 的第 189 行。

成员函数文档

◆ operator()()

virtual std::unique_ptr<column> cudf::segmented_reduce_host_udf::operator() ( column_view const &  input,
device_span< size_type const >  offsets,
data_type  output_dtype,
null_policy  null_handling,
std::optional< std::reference_wrapper< scalar const >>  init,
rmm::cuda_stream_view  stream,
rmm::device_async_resource_ref  mr 
) const
纯虚函数

执行分段归约操作。

参数
input用于归约的输入列
offsets定义归约分段的偏移量列表
output_dtype最终输出列的数据类型
null_handling如果为 INCLUDE,则仅当分段中的所有元素都有效时归约结果才有效;如果为 EXCLUDE,则分段中只要有任何一个元素有效,归约结果就有效
init归约的初始值
stream用于任何内核启动的 CUDA 流
mr用于任何内存分配的设备内存资源
返回值
聚合的输出结果

此结构体的文档生成自以下文件