公共成员函数 | 所有成员列表
cudf::reduce_host_udf Struct Reference抽象

基于主机(host-based)的用户自定义函数(UDF)用于归约(reduction)上下文的接口。更多...

#include <host_udf.hpp>

cudf::reduce_host_udf 的继承图
cudf::host_udf_base

公共成员函数

virtual std::unique_ptr< scalaroperator() (column_view const &input, data_type output_dtype, 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
 克隆实例。更多...
 

详细描述

基于主机(host-based)的用户自定义函数(UDF)用于归约(reduction)上下文的接口。

归约操作的基于主机 UDF 实现需要从此类派生。除了实现基类 host_udf_base 中声明的虚函数外,此类派生类还必须定义 operator() 函数来执行归约操作。

示例

struct my_udf_aggregation : cudf::reduce_host_udf {
my_udf_aggregation() = default;
[[nodiscard]] std::unique_ptr<scalar> operator()(
column_view const& input,
data_type output_dtype,
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
基于主机(host-based)的用户自定义函数(UDF)用于归约(reduction)上下文的接口。
virtual std::unique_ptr< scalar > operator()(column_view const &input, data_type output_dtype, std::optional< std::reference_wrapper< scalar const >> init, rmm::cuda_stream_view stream, rmm::device_async_resource_ref mr) const =0
执行归约操作。

定义于文件 host_udf.hpp131 行。

成员函数文档

◆ operator()()

virtual std::unique_ptr<scalar> cudf::reduce_host_udf::operator() ( column_view const &  input,
data_type  output_dtype,
std::optional< std::reference_wrapper< scalar const >>  init,
rmm::cuda_stream_view  stream,
rmm::device_async_resource_ref  mr 
) const
纯虚函数

执行归约操作。

参数
input用于归约的输入列
output_dtype最终输出标量的数据类型
init归约的初始值
stream用于启动任何核函数的 CUDA 流
mr用于任何分配的设备内存资源
返回值
聚合的输出结果

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