文件 | |
文件 | interop.hpp |
类 | |
结构体 | cudf::column_metadata |
Arrow 数组的详细元数据信息。 更多... | |
结构体 | cudf::custom_view_deleter< ViewType > |
用于 custom deleter 的 functor,指向 table_view 的 unique_ptr。 更多... | |
类型定义 | |
using | cudf::unique_schema_t = std::unique_ptr< ArrowSchema, void(*)(ArrowSchema *)> |
指向带有 custom deleter 的 ArrowSchema 的 unique_ptr 的类型定义 | |
using | cudf::unique_device_array_t = std::unique_ptr< ArrowDeviceArray, void(*)(ArrowDeviceArray *)> |
指向带有 custom deleter 的 ArrowDeviceArray 的 unique_ptr 的类型定义 | |
using | cudf::owned_columns_t = std::vector< std::unique_ptr< cudf::column > > |
owning columns 的 vector 的类型定义,用于从 ArrowDeviceArray 转换 | |
using | cudf::unique_table_view_t = std::unique_ptr< cudf::table_view, custom_view_deleter< cudf::table_view > > |
指向带有 custom deleter 的 cudf::table_view 的 unique_ptr 的类型定义 | |
using | cudf::unique_column_view_t = std::unique_ptr< cudf::column_view, custom_view_deleter< cudf::column_view > > |
指向带有 custom deleter 的 cudf::column_view 的 unique_ptr 的类型定义 | |
std::unique_ptr<cudf::table> cudf::from_arrow | ( | ArrowSchema const * | schema, |
ArrowArray const * | input, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
从给定的 ArrowArray 和 ArrowSchema 输入创建 cudf::table
。
std::invalid_argument | 如果 schema 或 input 为 NULL |
cudf::data_type_error | 如果输入数组不是 struct array。 |
std::overflow_error | 如果输入 arrow 对象超出列大小限制。 |
转换不会对输入 Array 调用 release。
schema | ArrowSchema 指针,用于描述数据类型 |
input | ArrowArray 指针,需要转换为 cudf::table |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 用于分配 cudf::table 的设备内存资源 |
std::unique_ptr<cudf::column> cudf::from_arrow_column | ( | ArrowSchema const * | schema, |
ArrowArray const * | input, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
从给定的 ArrowArray 和 ArrowSchema 输入创建 cudf::column
。
std::invalid_argument | 如果 schema 或 input 为 NULL |
转换不会对输入 Array 调用 release。
schema | ArrowSchema 指针,用于描述数据类型 |
input | ArrowArray 指针,需要转换为 cudf::column |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 用于分配 cudf::column 的设备内存资源 |
unique_table_view_t cudf::from_arrow_device | ( | ArrowSchema const * | schema, |
ArrowDeviceArray const * | input, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
从给定的 ArrowDeviceArray
和 ArrowSchema
创建 cudf::table_view
使用 ArrowDeviceArray
和 ArrowSchema
构造非拥有的 cudf::table_view
,数据必须对 CUDA 设备可访问。由于生成的 cudf::table_view
不拥有数据,ArrowDeviceArray
在结果的生命周期内必须保持活动。调用者有责任确保在不再需要 ArrowDeviceArray
后对其调用 release callback,并且在此之后不访问 cudf::table_view
。
std::invalid_argument | 如果 device_type 不是 ARROW_DEVICE_CUDA 、ARROW_DEVICE_CUDA_HOST 或 ARROW_DEVICE_CUDA_MANAGED |
cudf::data_type_error | 如果输入数组不是 struct array,非 struct 数组应改为传递给 from_arrow_device_column 。 |
cudf::data_type_error | 如果输入 arrow 数据类型不受支持。 |
std::overflow_error | 如果输入 arrow 对象超出列大小限制。 |
输入 struct 的每个子项将成为结果 table_view 的列。
ArrowDeviceArray
包含非空的 sync_event,则假定它是 cudaEvent_t*
,并且将使用该 event 在传入的 stream 上调用 cudaStreamWaitEvent
。但是,此函数不会显式地在 stream 上同步。schema | ArrowSchema 指向描述 device array 类型的对象的指针 |
input | ArrowDeviceArray 指向拥有 Arrow 数据的对象的指针 |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 用于执行任何分配的设备内存资源 |
cudf::table_view
unique_column_view_t cudf::from_arrow_device_column | ( | ArrowSchema const * | schema, |
ArrowDeviceArray const * | input, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
从给定的 ArrowDeviceArray
和 ArrowSchema
创建 cudf::column_view
使用 ArrowDeviceArray
和 ArrowSchema
构造非拥有的 cudf::column_view
,数据必须对 CUDA 设备可访问。由于生成的 cudf::column_view
不拥有数据,ArrowDeviceArray
在结果的生命周期内必须保持活动。调用者有责任确保在不再需要 ArrowDeviceArray
后对其调用 release callback,并且在此之后不访问 cudf::column_view
。
std::invalid_argument | 如果 device_type 不是 ARROW_DEVICE_CUDA 、ARROW_DEVICE_CUDA_HOST 或 ARROW_DEVICE_CUDA_MANAGED |
cudf::data_type_error | 输入的 arrow 数据类型不受支持。 |
std::overflow_error | 如果输入 arrow 对象超出列大小限制。 |
ArrowDeviceArray
包含非空的 sync_event,则假定它是 cudaEvent_t*
,并且将使用该 event 在传入的 stream 上调用 cudaStreamWaitEvent
。但是,此函数不会显式地在 stream 上同步。schema | ArrowSchema 指向描述 device array 类型的对象的指针 |
input | ArrowDeviceArray 指向拥有 Arrow 数据的对象的指针 |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 用于执行任何分配的设备内存资源 |
cudf::column_view
std::unique_ptr<table> cudf::from_arrow_host | ( | ArrowSchema const * | schema, |
ArrowDeviceArray const * | input, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
从给定的 ArrowDeviceArray 输入创建 cudf::table
。
std::invalid_argument | 如果 schema 或 input 为 NULL |
std::invalid_argument | 如果 device_type 不是 ARROW_DEVICE_CPU |
std::overflow_error | 如果输入 arrow 对象超出列大小限制。 |
cudf::data_type_error | 如果输入数组不是 struct array,非 struct 数组应改为传递给 from_arrow_host_column 。 |
转换不会对输入 Array 调用 release。
schema | ArrowSchema 指针,用于描述数据类型 |
input | ArrowDeviceArray 指向拥有 Arrow 数据的对象的指针 |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 用于执行 cuda 分配的设备内存资源 |
std::unique_ptr<column> cudf::from_arrow_host_column | ( | ArrowSchema const * | schema, |
ArrowDeviceArray const * | input, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
从给定的 ArrowDeviceArray 输入创建 cudf::column
。
std::invalid_argument | 如果 schema 或 input 为 NULL |
std::invalid_argument | 如果 device_type 不是 ARROW_DEVICE_CPU |
cudf::data_type_error | 如果 cudf 不支持输入的 arrow 数据类型。 |
std::overflow_error | 如果输入 arrow 对象超出列大小限制。 |
转换不会对输入 Array 调用 release。
schema | ArrowSchema 指针,用于描述数据类型 |
input | ArrowDeviceArray 指向拥有 Arrow 数据的对象的指针 |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 用于执行 cuda 分配的设备内存资源 |
std::unique_ptr<table> cudf::from_arrow_stream | ( | ArrowArrayStream * | input, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
从给定的 ArrowArrayStream 输入创建 cudf::table
。
std::invalid_argument | 如果 input 为 NULL |
转换将释放输入的 ArrayArrayStream 及其组成 array 或 schema,因为 Arrow stream 不适合多次读取。
input | ArrowArrayStream 指向将生成 ArrowArray 数据的对象的指针 |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 用于执行 cuda 分配的设备内存资源 |
unique_device_array_t cudf::to_arrow_device | ( | cudf::column && | col, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
从 cudf 列和元数据创建 ArrowDeviceArray
。
填充 C struct ArrowDeviceArray,如果可能不执行复制。这会将数据保留在 GPU 设备上,并将 table 及其 buffer 的所有权授予 ArrowDeviceArray struct。
调用此函数后,必须对返回的 ArrowDeviceArray 调用 release callback 来清理内存。
col | 输入 column,数据的所有权将转移到结果 |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 转换过程中用于任何分配的设备内存资源 |
unique_device_array_t cudf::to_arrow_device | ( | cudf::column_view const & | col, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
从 column view 创建 ArrowDeviceArray
。
填充 C struct ArrowDeviceArray,仅在必要时执行复制。这将包装 GPU 设备上的数据,并向 ArrowDeviceArray struct 提供 column 数据视图。如果调用者释放了 column_view 引用的数据,使用返回的对象将导致未定义行为。
调用此函数后,必须对返回的 ArrowDeviceArray 调用 release callback 来清理转换期间创建的任何内存。
在 cudf 与 Arrow 不同形式的情况下将执行复制
col | 输入 column |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 转换过程中用于任何分配的设备内存资源 |
unique_device_array_t cudf::to_arrow_device | ( | cudf::table && | table, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
从 cudf table 和元数据创建 ArrowDeviceArray
。
填充 C struct ArrowDeviceArray,如果可能不执行复制。这会将数据保留在 GPU 设备上,并将 table 及其 buffer 的所有权授予 ArrowDeviceArray struct。
调用此函数后,必须对返回的 ArrowDeviceArray 调用 release callback 来清理内存。
table | 输入 table,数据的所有权将转移到结果 |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 转换过程中用于任何分配的设备内存资源 |
unique_device_array_t cudf::to_arrow_device | ( | cudf::table_view const & | table, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
从 table view 创建 ArrowDeviceArray
。
填充 C struct ArrowDeviceArray,仅在必要时执行复制。这将包装 GPU 设备上的数据,并向 ArrowDeviceArray struct 提供 table 数据视图。如果调用者释放了 table_view 引用的数据,使用返回的对象将导致未定义行为。
调用此函数后,必须对返回的 ArrowDeviceArray 调用 release callback 来清理转换期间创建的任何内存。
在 cudf 与 Arrow 不同形式的情况下将执行复制
table | 输入 table |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 转换过程中用于任何分配的设备内存资源 |
unique_device_array_t cudf::to_arrow_host | ( | cudf::column_view const & | col, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
将 column view 数据复制到 host 并为其创建 ArrowDeviceArray
。
填充 C struct ArrowDeviceArray,将 cudf 数据复制到 host。返回的 ArrowDeviceArray 的 device_type 将为 CPU,并且与传入的 column view 引用的内存没有关联。返回的 unique_ptr 的 deleter 将自动对 ArrowDeviceArray 调用 release callback。
col | 输入 column |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 转换过程中用于任何分配的设备内存资源 |
unique_device_array_t cudf::to_arrow_host | ( | cudf::table_view const & | table, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::device_async_resource_ref | mr = cudf::get_current_device_resource_ref() |
||
) |
将 table view 数据复制到 host 并为其创建 ArrowDeviceArray
。
填充 C struct ArrowDeviceArray,将 cudf 数据复制到 host。返回的 ArrowDeviceArray 的 device_type 将为 CPU,并且与传入的 table view 引用的内存没有关联。返回的 unique_ptr 的 deleter 将自动对 ArrowDeviceArray 调用 release callback。
table | 输入 table |
stream | 用于设备内存操作和内核启动的 CUDA stream |
mr | 转换过程中用于任何分配的设备内存资源 |
unique_schema_t cudf::to_arrow_schema | ( | cudf::table_view const & | input, |
cudf::host_span< column_metadata const > | metadata | ||
) |
从 cudf table 和元数据创建 ArrowSchema。
使用 table 和元数据填充并返回一个 ArrowSchema C struct。
numeric::decimal32
将被转换为精度为 9 的 Arrow decimal128,这是 32 位类型的最大精度。类似地,numeric::decimal128
将被转换为精度为 38 的 Arrow decimal128。input | 用于创建 schema 的 table |
metadata | 包含列和子项名称的层次结构 |
input
生成的 ArrowSchema