traits.cuh
前往此文件的文档。
1 /*
2  * 版权所有 (c) 2021-2024, NVIDIA CORPORATION。
3  *
4  * 根据 Apache 许可证 2.0 版(“许可证”)获得许可;
5  * 除非遵守许可证,否则您不得使用此文件。
6  * 您可以获得许可证的副本,地址是
7  *
8  * https://apache.ac.cn/licenses/LICENSE-2.0
9  *
10  * 除非适用法律要求或书面同意,否则根据许可证分发的软件按“原样”分发,
11  * 不附带任何明示或暗示的保证或条件。
12  * 请参阅许可证中关于特定语言的权限和限制的说明。
13  *
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_EXPORT cudf {
25 
39 /** \brief 指示类型 T 是否支持原子操作。对于内置类型通常为 true。 *//** @ingroup utility_types */
40 template <typename T>
41 constexpr inline bool has_atomic_support()
42 {
43  return cuda::std::atomic<T>::is_always_lock_free;
44 }
45 
46 struct has_atomic_support_impl {
47  template <typename T>
48  constexpr bool operator()()
49  {
50  return has_atomic_support<T>();
51  }
52 };
60 /** \brief 指示类型是否支持原子操作。 *//** @ingroup utility_types */
61 constexpr inline bool has_atomic_support(data_type type)
62 {
63  return cudf::type_dispatcher(type, has_atomic_support_impl{});
64 }
67 } // namespace CUDF_EXPORT cudf
表示列中元素的逻辑数据类型。
CUDF_HOST_DEVICE constexpr decltype(auto) __forceinline__ type_dispatcher(cudf::data_type dtype, Functor f, Ts &&... args)
根据指定的 cudf::data_type 的...调用带有类型实例化的 operator() 模板。
constexpr bool has_atomic_support(data_type type)
指示类型是否支持原子操作。
cuDF 接口
定义 cudf::type_id 运行时类型信息与具体 C++ 类型之间的映射。
libcudf 的类型声明。