binaryop.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2023, 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/column/column.hpp>
20 #include <cudf/scalar/scalar.hpp>
21 
23 
24 #include <memory>
25 
26 namespace cudf {
27 
38 enum class binary_operator : int32_t {
39  ADD,
40  SUB,
41  MUL,
42  DIV,
43  TRUE_DIV,
44  FLOOR_DIV,
45  MOD,
53  PMOD,
54  PYMOD,
57  POW,
58  INT_POW,
59  LOG_BASE,
61  ATAN2,
62  SHIFT_LEFT,
63  SHIFT_RIGHT,
64  SHIFT_RIGHT_UNSIGNED,
65  BITWISE_AND,
67  BITWISE_OR,
68  BITWISE_XOR,
69  LOGICAL_AND,
70  LOGICAL_OR,
71  EQUAL,
72  NOT_EQUAL,
73  LESS,
74  GREATER,
75  LESS_EQUAL,
76  GREATER_EQUAL,
77  NULL_EQUALS,
78  NULL_MAX,
80  NULL_MIN,
82  GENERIC_BINARY,
84  NULL_LOGICAL_AND,
86  NULL_LOGICAL_OR,
90 };
113 std::unique_ptr<column> binary_operation(
114  scalar const& lhs,
115  column_view const& rhs,
116  binary_operator op,
117  data_type output_type,
118  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
119 
142 std::unique_ptr<column> binary_operation(
143  column_view const& lhs,
144  scalar const& rhs,
145  binary_operator op,
146  data_type output_type,
147  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
148 
170 std::unique_ptr<column> binary_operation(
171  column_view const& lhs,
172  column_view const& rhs,
173  binary_operator op,
174  data_type output_type,
175  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
176 
199 std::unique_ptr<column> binary_operation(
200  column_view const& lhs,
201  column_view const& rhs,
202  std::string const& ptx,
203  data_type output_type,
204  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
205 
215  int32_t left_scale,
216  int32_t right_scale);
217 
227  cudf::data_type const& lhs,
228  cudf::data_type const& rhs);
229 
230 namespace binops {
231 
241 std::pair<rmm::device_buffer, size_type> scalar_col_valid_mask_and(
242  column_view const& col,
243  scalar const& s,
245  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
246 
247 namespace compiled {
248 namespace detail {
249 
262  column_view const& lhs,
263  column_view const& rhs,
264  bool is_lhs_scalar,
265  bool is_rhs_scalar,
266  binary_operator op,
267  rmm::cuda_stream_view stream);
268 } // namespace detail
269 } // namespace compiled
270 } // namespace binops
271  // end of group
273 } // namespace cudf
cudf::binary_operation
std::unique_ptr< column > binary_operation(scalar const &lhs, column_view const &rhs, binary_operator op, data_type output_type, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a binary operation between a scalar and a column.
per_device_resource.hpp
cudf::binary_operator::ADD
@ ADD
operator +
scalar.hpp
Class definitions for cudf::scalar.
column.hpp
Class definition for cudf::column.
cudf::binary_operation_fixed_point_output_type
cudf::data_type binary_operation_fixed_point_output_type(binary_operator op, cudf::data_type const &lhs, cudf::data_type const &rhs)
Computes the data_type for a fixed_point number based on given binary operator op
cudf::column_view
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
Definition: column_view.hpp:313
cudf::mutable_column_view
A non-owning, mutable view of device data as a column of elements, some of which may be null as indic...
Definition: column_view.hpp:477
rmm::cuda_stream_view
cudf::binops::compiled::detail::apply_sorting_struct_binary_op
void apply_sorting_struct_binary_op(mutable_column_view &out, column_view const &lhs, column_view const &rhs, bool is_lhs_scalar, bool is_rhs_scalar, binary_operator op, rmm::cuda_stream_view stream)
struct binary operation using NaN aware sorting physical element comparators
cudf::binary_operation_fixed_point_scale
int32_t binary_operation_fixed_point_scale(binary_operator op, int32_t left_scale, int32_t right_scale)
Computes the scale for a fixed_point number based on given binary operator op
cudf::scalar
An owning class to represent a singular value.
Definition: scalar.hpp:48
cudf::binops::scalar_col_valid_mask_and
std::pair< rmm::device_buffer, size_type > scalar_col_valid_mask_and(column_view const &col, scalar const &s, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Computes output valid mask for op between a column and a scalar.
cudf::data_type
Indicator for the logical data type of an element in a column.
Definition: types.hpp:228
cudf
cuDF interfaces
Definition: aggregation.hpp:34
cudf::weak_ordering::LESS
@ LESS
Indicates a is less than (ordered before) b
cudf::get_default_stream
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
cudf::binary_operator
binary_operator
Types of binary operations that can be performed on data.
Definition: binaryop.hpp:38
rmm::mr::device_memory_resource