libcudf  24.04.00
traits.cuh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021, 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/types.hpp>
21 
22 #include <cuda/std/atomic>
23 
24 namespace cudf {
25 
39 template <typename T>
40 constexpr inline bool has_atomic_support()
41 {
42  return cuda::std::atomic<T>::is_always_lock_free;
43 }
44 
45 struct has_atomic_support_impl {
46  template <typename T>
47  constexpr bool operator()()
48  {
49  return has_atomic_support<T>();
50  }
51 };
52 
60 constexpr inline bool has_atomic_support(data_type type)
61 {
62  return cudf::type_dispatcher(type, has_atomic_support_impl{});
63 }
64 
67 } // namespace cudf
Indicator for the logical data type of an element in a column.
Definition: types.hpp:241
CUDF_HOST_DEVICE constexpr decltype(auto) __forceinline__ type_dispatcher(cudf::data_type dtype, Functor f, Ts &&... args)
Invokes an operator() template with the type instantiation based on the specified cudf::data_type's i...
constexpr bool has_atomic_support()
Indicates whether the type T has support for atomics.
Definition: traits.cuh:40
cuDF interfaces
Definition: aggregation.hpp:34
Defines the mapping between cudf::type_id runtime type information and concrete C++ types.
Type declarations for libcudf.