文件 | |
文件 | type_dispatcher.hpp |
定义了 cudf::type_id 运行时类型信息与具体的 C++ 类型之间的映射。 | |
类 | |
结构体 | cudf::dispatch_storage_type< Id > |
当您只需要对底层存储类型进行操作时,请使用 type_dispatcher 的此特化版本。 更多... | |
宏 | |
#define | CUDF_TYPE_MAPPING(Type, Id) |
用于定义具体 C++ 类型与 cudf::type_id 枚举之间映射的宏。 更多... | |
#define | MAP_NUMERIC_SCALAR(Type) |
用于定义 cudf::numeric_scalar 模板类中数值 C++ 类型的标量类型和设备标量类型的宏。 更多... | |
#define | MAP_TIMESTAMP_SCALAR(Type) |
用于定义 cudf::timestamp_scalar 模板类中时间戳 C++ 类型的标量类型和设备标量类型的宏。 更多... | |
#define | MAP_DURATION_SCALAR(Type) |
用于定义 cudf::duration_scalar 模板类中持续时间 C++ 类型的标量类型和设备标量类型的宏。 更多... | |
类型定义 | |
template<cudf::type_id Id> | |
使用 | cudf::id_to_type = typename id_to_type_impl< Id >::type |
将 cudf::type_id 映射到其对应的具体 C++ 类型。 更多... | |
template<typename T > | |
使用 | cudf::device_storage_type_t = std::conditional_t< std::is_same_v< numeric::decimal32, T >, int32_t, std::conditional_t< std::is_same_v< numeric::decimal64, T >, int64_t, std::conditional_t< std::is_same_v< numeric::decimal128, T >, __int128_t, T > >> |
使用 cudf::column 时,“返回”存储在设备上的相应类型。 更多... | |
template<typename T > | |
使用 | cudf::scalar_type_t = typename type_to_scalar_type_impl< T >::ScalarType |
将 C++ 类型映射到保存其值所需的标量类型。 更多... | |
template<typename T > | |
使用 | cudf::scalar_device_type_t = typename type_to_scalar_type_impl< T >::ScalarDeviceType |
将 C++ 类型映射到保存其值所需的设备标量类型。 更多... | |
函数 | |
template<typename T > | |
constexpr CUDF_HOST_DEVICE type_id | cudf::base_type_to_id () |
将 C++ 类型映射到其对应的 cudf::type_id 更多... | |
template<typename T > | |
constexpr type_id | cudf::type_to_id () |
将 C++ 类型映射到其对应的 cudf::type_id 更多... | |
template<> | |
constexpr type_id | cudf::base_type_to_id< char > () |
将 'char' 类型映射到 type_id::INT8 的特化。 更多... | |
template<typename T > | |
constexpr bool | cudf::type_id_matches_device_storage_type (type_id id) |
检查类似 fixed_point 的类型是否具有与列的存储类型 ID 匹配的模板类型 T 。 更多... | |
template<template< cudf::type_id > typename IdTypeMap = id_to_type_impl, typename Functor , typename... Ts> | |
CUDF_HOST_DEVICE constexpr decltype(auto) __forceinline__ | cudf::type_dispatcher (cudf::data_type dtype, Functor f, Ts &&... args) |
根据指定的 cudf::data_type 的 id() ,使用类型实例化调用 operator() 模板。 更多... | |
template<template< cudf::type_id > typename IdTypeMap = id_to_type_impl, typename F , typename... Ts> | |
CUDF_HOST_DEVICE constexpr decltype(auto) __forceinline__ | cudf::double_type_dispatcher (cudf::data_type type1, cudf::data_type type2, F &&f, Ts &&... args) |
将两个类型模板参数调度到可调用对象。 更多... | |
std::string | cudf::type_to_name (data_type type) |
返回给定类型的名称。 更多... | |
#define CUDF_TYPE_MAPPING | ( | Type, | |
Id | |||
) |
用于定义具体 C++ 类型与 cudf::type_id
枚举之间映射的宏。
Type | 具体的 C++ 类型 |
Id | cudf::type_id 枚举 |
定义于文件 type_dispatcher.hpp 的第 145 行。
#define MAP_DURATION_SCALAR | ( | Type | ) |
用于定义 cudf::duration_scalar
模板类中持续时间 C++ 类型的标量类型和设备标量类型的宏。
Type | 持续时间 C++ 类型 |
定义于文件 type_dispatcher.hpp 的第 346 行。
#define MAP_NUMERIC_SCALAR | ( | Type | ) |
用于定义 cudf::numeric_scalar
模板类中数值 C++ 类型的标量类型和设备标量类型的宏。
Type | 数值 C++ 类型 |
定义于文件 type_dispatcher.hpp 的第 248 行。
#define MAP_TIMESTAMP_SCALAR | ( | Type | ) |
用于定义 cudf::timestamp_scalar
模板类中时间戳 C++ 类型的标量类型和设备标量类型的宏。
Type | 时间戳 C++ 类型 |
定义于文件 type_dispatcher.hpp 的第 325 行。
using cudf::device_storage_type_t = typedef std::conditional_t<std::is_same_v<numeric::decimal32, T>, int32_t, std::conditional_t<std::is_same_v<numeric::decimal64, T>, int64_t, std::conditional_t<std::is_same_v<numeric::decimal128, T>, __int128_t, T> >> |
使用 cudf::column
时,“返回”存储在设备上的相应类型。
对于 decimal32
,存储类型为 int32_t
。对于 decimal64
,存储类型为 int64_t
。对于 decimal128
,存储类型为 __int128_t
。
将此“类型函数”与 using
类型别名一起使用
T | 存储在主机上的字面类型 |
定义于文件 type_dispatcher.hpp 的第 110 行。
using cudf::id_to_type = typedef typename id_to_type_impl<Id>::type |
将 cudf::type_id
映射到其对应的具体 C++ 类型。
示例
t | 要映射的 cudf::type_id |
定义于文件 type_dispatcher.hpp 的第 92 行。
using cudf::scalar_device_type_t = typedef typename type_to_scalar_type_impl<T>::ScalarDeviceType |
using cudf::scalar_type_t = typedef typename type_to_scalar_type_impl<T>::ScalarType |
|
inlineconstexpr |
将 C++ 类型映射到其对应的 cudf::type_id
当明确传递给定类型的模板参数时,返回指定 C++ 类型的相应 type_id
枚举。
示例
T | 要映射到 cudf::type_id 的非 cv 类型 |
cudf::type_id
定义于文件 type_dispatcher.hpp 的第 56 行。
|
inlineconstexpr |
将 'char' 类型映射到 type_id::INT8
的特化。
将 device_uvector<char> 传递给列构造函数时需要。在 PR 14202 合并后可能可以移除。
定义于文件 type_dispatcher.hpp 的第 201 行。
|
constexpr |
将两个类型模板参数调度到可调用对象。
此函数需要一个可调用对象 f
,它包含一个接受两个 typename 模板参数 T1
和 T2
的 operator()
模板。
type1 | 用于调度可调用对象 F 的第一个模板参数类型的 data_type |
type2 | 用于调度可调用对象 F 的第二个模板参数类型的 data_type |
f | 其 operator() 模板被调用的可调用对象 |
args | 转发到 F 的 operator() 调用的参数包。 |
f.template operator(args)
的结果定义于文件 type_dispatcher.hpp 的第 627 行。
|
constexpr |
根据指定的 cudf::data_type
的 id()
,使用类型实例化调用 operator()
模板。
使用返回调度类型大小的 Functor 示例用法
type_dispatcher
使用 cudf::type_to_id
提供 cudf::type_id
到调度 C++ 类型的默认映射。但是,可以通过明确指定用户定义的 IdTypeMap
特征结构体来定制此映射。例如,始终调度 int32_t
有时需要为不同的类型定制调度 Functor 的 operator()
。这可以通过几种方式完成。
第一种方法是使用显式模板特化。这对于针对单一类型进行特化行为非常有用。例如,一个 Functor 在使用 int32_t
或 double
调用时打印相应的类型名称,否则打印 unhandled type
第二种方法是使用带有 std::enable_if_t
的 SFINAE。这对于针对共享某些属性的类型集合进行特化非常有用。例如,一个 Functor 对于整型或浮点型打印 integral
或 floating point
有关 SFINAE 和 std::enable_if
的更多信息,请参阅 https://eli.thegreenplace.net/2014/sfinae-and-enable_if/
Functor 的“operator()” lambda 的所有模板实例化必须具有相同的返回类型,否则编译器会报错,因为您正在尝试从同一函数返回不同类型。
id_to_type_impl | 将 cudf::type_id 映射到其调度的 C++ 类型 |
Functor | 可调用对象的类型 |
Ts | 可变参数包类型 |
dtype | cudf::data_type ,其 id() 确定调用哪个模板实例化 |
f | 其 operator() 模板被调用的可调用对象 |
args | 转发到 operator() 调用的参数包 |
operator()
返回的任何值定义于文件 type_dispatcher.hpp 的第 476 行。
|
constexpr |
检查类似 fixed_point
的类型是否具有与列的存储类型 ID 匹配的模板类型 T
。
T | 存储在设备上的类型 |
id | 列的 data_type::id |
true
如果 T 与存储的列 type_id
匹配false
如果 T 与存储的列 type_id
不匹配定义于文件 type_dispatcher.hpp 的第 216 行。
|
inlineconstexpr |
将 C++ 类型映射到其对应的 cudf::type_id
当明确传递给定类型的模板参数时,返回指定 C++ 类型的相应 type_id
枚举。
示例
T | 要映射到 cudf::type_id 的类型 |
cudf::type_id
定义于文件 type_dispatcher.hpp 的第 132 行。