libcudf
24.04.00
|
Files | |
file | interop.hpp |
Functions | |
std::unique_ptr< table > | cudf::from_dlpack (DLManagedTensor const *managed_tensor, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Convert a DLPack DLTensor into a cudf table. More... | |
DLManagedTensor * | cudf::to_dlpack (table_view const &input, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Convert a cudf table into a DLPack DLTensor. More... | |
std::unique_ptr<table> cudf::from_dlpack | ( | DLManagedTensor const * | managed_tensor, |
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Convert a DLPack DLTensor into a cudf table.
The device_type
of the DLTensor must be kDLCPU
, kDLCuda
, or kDLCUDAHost
, and device_id
must match the current device. The ndim
must be set to 1 or 2. The dtype
must have 1 lane and the bitsize must match a supported cudf::data_type
.
cudf::logic_error | if the any of the DLTensor fields are unsupported |
managed_tensor | a 1D or 2D column-major (Fortran order) tensor |
mr | Device memory resource used to allocate the returned table's device memory |
DLManagedTensor* cudf::to_dlpack | ( | table_view const & | input, |
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Convert a cudf table into a DLPack DLTensor.
All columns must have the same data type and this type must be numeric. The columns may be nullable, but the null count must be zero. If the input table is empty or has zero rows, the result will be nullptr.
deleter
method of the returned DLManagedTensor
must be used to free the memory allocated for the tensor.cudf::logic_error | if the data types are not equal or not numeric, or if any of columns have non-zero null count |
input | Table to convert to DLPack |
mr | Device memory resource used to allocate the returned DLPack tensor's device memory |