reduction.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
8 #include <cudf/aggregation.hpp>
9 #include <cudf/scalar/scalar.hpp>
10 #include <cudf/utilities/export.hpp>
12 
13 #include <optional>
14 
20 namespace CUDF_EXPORT cudf {
29 enum class scan_type : bool { INCLUSIVE, EXCLUSIVE };
30 
31 // clang-format off
95 std::unique_ptr<scalar> reduce(
96  column_view const& col,
97  reduce_aggregation const& agg,
98  data_type output_type,
101 // clang-format on
102 
124 std::unique_ptr<scalar> reduce(
125  column_view const& col,
126  reduce_aggregation const& agg,
127  data_type output_type,
128  std::optional<std::reference_wrapper<scalar const>> init,
131 
175 std::unique_ptr<column> segmented_reduce(
176  column_view const& segmented_values,
178  segmented_reduce_aggregation const& agg,
179  data_type output_type,
180  null_policy null_handling,
183 
201 std::unique_ptr<column> segmented_reduce(
202  column_view const& segmented_values,
204  segmented_reduce_aggregation const& agg,
205  data_type output_type,
206  null_policy null_handling,
207  std::optional<std::reference_wrapper<scalar const>> init,
210 
229 std::unique_ptr<column> scan(
230  column_view const& input,
231  scan_aggregation const& agg,
233  null_policy null_handling = null_policy::EXCLUDE,
236 
247 std::pair<std::unique_ptr<scalar>, std::unique_ptr<scalar>> minmax(
248  column_view const& col,
251 
255 namespace reduction {
264 } // namespace reduction
265  // end of group
267 
268 } // namespace CUDF_EXPORT cudf
Representation for specifying desired aggregations from aggregation-based APIs, e....
Kind
Possible aggregation operations.
Definition: aggregation.hpp:78
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
Indicator for the logical data type of an element in a column.
Definition: types.hpp:278
Derived class intended for reduction usage.
Derived class intended for scan usage.
Derived class intended for segmented reduction usage.
std::unique_ptr< column > segmented_reduce(column_view const &segmented_values, device_span< size_type const > offsets, segmented_reduce_aggregation const &agg, data_type output_type, null_policy null_handling, std::optional< std::reference_wrapper< scalar const >> init, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Compute reduction of each segment in the input column with an initial value. Only SUM,...
scan_type
Enum to describe scan operation type.
Definition: reduction.hpp:29
std::unique_ptr< column > scan(column_view const &input, scan_aggregation const &agg, scan_type inclusive, null_policy null_handling=null_policy::EXCLUDE, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Computes the scan of a column.
std::unique_ptr< scalar > reduce(column_view const &col, reduce_aggregation const &agg, data_type output_type, std::optional< std::reference_wrapper< scalar const >> init, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Computes the reduction of the values in all rows of a column with an initial value.
std::pair< std::unique_ptr< scalar >, std::unique_ptr< scalar > > minmax(column_view const &col, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Determines the minimum and maximum values of a column.
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
inclusive
Enum used to define whether or not bins include their boundary points.
Definition: label_bins.hpp:28
rmm::device_async_resource_ref get_current_device_resource_ref()
Get the current device memory resource reference.
cuda::mr::resource_ref< cuda::mr::device_accessible > device_async_resource_ref
cuda::std::span< T, Extent > device_span
Device span is an alias of cuda::std::span.
Definition: span.hpp:296
null_policy
Enum to specify whether to include nulls or exclude nulls.
Definition: types.hpp:107
APIs for getting and setting the current device memory resource.
bool is_valid_aggregation(data_type source, aggregation::Kind kind)
Indicate if a reduction is supported for a source datatype.
cuDF interfaces
Definition: host_udf.hpp:26
Class definitions for cudf::scalar.