reduction.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2024, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cudf/aggregation.hpp>
20 #include <cudf/scalar/scalar.hpp>
21 
22 #include <rmm/mr/device/per_device_resource.hpp>
23 #include <rmm/resource_ref.hpp>
24 
25 #include <optional>
26 
27 namespace cudf {
37 enum class scan_type : bool { INCLUSIVE, EXCLUSIVE };
38 
82 std::unique_ptr<scalar> reduce(
83  column_view const& col,
84  reduce_aggregation const& agg,
85  data_type output_dtype,
86  rmm::cuda_stream_view stream = cudf::get_default_stream(),
87  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
88 
105 std::unique_ptr<scalar> reduce(
106  column_view const& col,
107  reduce_aggregation const& agg,
108  data_type output_dtype,
109  std::optional<std::reference_wrapper<scalar const>> init,
110  rmm::cuda_stream_view stream = cudf::get_default_stream(),
111  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
112 
156 std::unique_ptr<column> segmented_reduce(
157  column_view const& segmented_values,
159  segmented_reduce_aggregation const& agg,
160  data_type output_dtype,
161  null_policy null_handling,
162  rmm::cuda_stream_view stream = cudf::get_default_stream(),
163  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
164 
182 std::unique_ptr<column> segmented_reduce(
183  column_view const& segmented_values,
185  segmented_reduce_aggregation const& agg,
186  data_type output_dtype,
187  null_policy null_handling,
188  std::optional<std::reference_wrapper<scalar const>> init,
189  rmm::cuda_stream_view stream = cudf::get_default_stream(),
190  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
191 
210 std::unique_ptr<column> scan(
211  column_view const& input,
212  scan_aggregation const& agg,
214  null_policy null_handling = null_policy::EXCLUDE,
215  rmm::cuda_stream_view stream = cudf::get_default_stream(),
216  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
217 
228 std::pair<std::unique_ptr<scalar>, std::unique_ptr<scalar>> minmax(
229  column_view const& col,
230  rmm::cuda_stream_view stream = cudf::get_default_stream(),
231  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
232  // end of group
234 
235 } // namespace cudf
Representation for specifying desired aggregations from aggregation-based APIs, e....
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:241
Derived class intended for reduction usage.
Derived class intended for scan usage.
Derived class intended for segmented reduction usage.
scan_type
Enum to describe scan operation type.
Definition: reduction.hpp:37
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=rmm::mr::get_current_device_resource())
Determines the minimum and maximum values of a column.
std::unique_ptr< scalar > reduce(column_view const &col, reduce_aggregation const &agg, data_type output_dtype, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
Computes the reduction of the values in all rows of a column.
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=rmm::mr::get_current_device_resource())
Computes the scan of a column.
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_dtype, null_policy null_handling, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
Compute reduction of each segment in the input 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:39
null_policy
Enum to specify whether to include nulls or exclude nulls.
Definition: types.hpp:124
@ EXCLUDE
exclude null elements
cuDF interfaces
Definition: aggregation.hpp:34
Class definitions for cudf::scalar.
Device version of C++20 std::span with reduced feature set.
Definition: span.hpp:291