Files | |
file | reduction.hpp |
Enumerations | |
enum | cudf::scan_type : bool { INCLUSIVE, EXCLUSIVE } |
Enum to describe scan operation type. | |
Functions | |
std::unique_ptr< scalar > | cudf::reduce (column_view const &col, std::unique_ptr< reduce_aggregation > const &agg, data_type output_dtype, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Computes the reduction of the values in all rows of a column. More... | |
std::unique_ptr< column > | cudf::segmented_reduce (column_view const &segmented_values, device_span< size_type const > offsets, segmented_reduce_aggregation const &agg, data_type output_dtype, null_policy null_handling, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Compute reduction of each segment in the input column. More... | |
std::unique_ptr< column > | cudf::scan (const column_view &input, std::unique_ptr< scan_aggregation > const &agg, scan_type inclusive, null_policy null_handling=null_policy::EXCLUDE, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Computes the scan of a column. More... | |
std::pair< std::unique_ptr< scalar >, std::unique_ptr< scalar > > | cudf::minmax (column_view const &col, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Determines the minimum and maximum values of a column. More... | |
std::pair<std::unique_ptr<scalar>, std::unique_ptr<scalar> > cudf::minmax | ( | column_view const & | col, |
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Determines the minimum and maximum values of a column.
col | column to compute minmax |
mr | Device memory resource used to allocate the returned column's device memory |
std::unique_ptr<scalar> cudf::reduce | ( | column_view const & | col, |
std::unique_ptr< reduce_aggregation > const & | agg, | ||
data_type | output_dtype, | ||
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Computes the reduction of the values in all rows of a column.
This function does not detect overflows in reductions. Using a higher precision data_type
may prevent overflow. Only min
and max
ops are supported for reduction of non-arithmetic types (timestamp, string...). The null values are skipped for the operation. If the column is empty, the member is_valid()
of the output scalar will contain false
.
cudf::logic_error | if reduction is called for non-arithmetic output type and operator other than min and max . |
cudf::logic_error | if input column data type is not convertible to output data type. |
cudf::logic_error | if min or max reduction is called and the output type does not match the input column data type. |
cudf::logic_error | if any or all reduction is called and the output type is not bool8. |
cudf::logic_error | if mean , var , or std reduction is called and the output type is not floating point. |
If the input column has arithmetic type, output_dtype can be any arithmetic type. If the input column has non-arithmetic type, e.g. timestamp or string, the same output type must be specified.
If the reduction fails, the member is_valid of the output scalar will contain false
.
col | Input column view |
agg | Aggregation operator applied by the reduction |
output_dtype | The computation and output precision. |
mr | Device memory resource used to allocate the returned scalar's device memory |
std::unique_ptr<column> cudf::scan | ( | const column_view & | input, |
std::unique_ptr< scan_aggregation > const & | agg, | ||
scan_type | inclusive, | ||
null_policy | null_handling = null_policy::EXCLUDE , |
||
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Computes the scan of a column.
The null values are skipped for the operation, and if an input element at i
is null, then the output element at i
will also be null.
cudf::logic_error | if column datatype is not numeric type. |
[in] | input | The input column view for the scan |
[in] | agg | unique_ptr to aggregation operator applied by the scan |
[in] | inclusive | The flag for applying an inclusive scan if scan_type::INCLUSIVE, an exclusive scan if scan_type::EXCLUSIVE. |
[in] | null_handling | Exclude null values when computing the result if null_policy::EXCLUDE. Include nulls if null_policy::INCLUDE. Any operation with a null results in a null. |
[in] | mr | Device memory resource used to allocate the returned scalar's device memory |
std::unique_ptr<column> cudf::segmented_reduce | ( | column_view const & | segmented_values, |
device_span< size_type const > | offsets, | ||
segmented_reduce_aggregation const & | agg, | ||
data_type | output_dtype, | ||
null_policy | null_handling, | ||
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Compute reduction of each segment in the input column.
This function does not detect overflows in reductions. When given integral and floating point inputs, their values are promoted to int64_t
and double
respectively to compute, and casted to output_dtype
before returning.
Null values are treated as identities during reduction.
If the segment is empty, the row corresponding to the result of the segment is null.
If any index in offsets
is out of bound of segmented_values
, the behavior is undefined.
cudf::logic_error | if reduction is called for non-arithmetic output type and operator other than min and max . |
cudf::logic_error | if input column data type is not convertible to output data type. |
cudf::logic_error | if min or max reduction is called and the output type does not match the input column data type. |
cudf::logic_error | if any or all reduction is called and the output type is not bool8. |
segmented_values | Column view of segmented inputs. |
offsets | Each segment's offset of segmented_values . A list of offsets with size num_segments + 1 . The size of i th segment is offsets[i+1] - offsets[i] . |
agg | Aggregation operator applied by the reduction. |
output_dtype | The output precision. |
null_handling | If INCLUDE , the reduction is valid if all elements in a segment are valid, otherwise null. If EXCLUDE , the reduction is valid if any element in the segment is valid, otherwise null. |
mr | Device memory resource used to allocate the returned scalar's device memory |