interop.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, 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 <arrow/api.h>
20 #include <cudf/column/column.hpp>
21 #include <cudf/detail/transform.hpp>
22 #include <cudf/table/table.hpp>
24 #include <cudf/types.hpp>
25 
26 struct DLManagedTensor;
27 
28 namespace cudf {
52 std::unique_ptr<table> from_dlpack(
53  DLManagedTensor const* managed_tensor,
54  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
55 
74 DLManagedTensor* to_dlpack(
75  table_view const& input,
76  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
77  // end of group
79 
93  std::string name;
94  std::vector<column_metadata> children_meta;
95 
96  column_metadata(std::string const& _name) : name(_name) {}
97  column_metadata() = default;
98 };
99 
113 std::shared_ptr<arrow::Table> to_arrow(table_view input,
114  std::vector<column_metadata> const& metadata = {},
115  arrow::MemoryPool* ar_mr = arrow::default_memory_pool());
116 
125 std::unique_ptr<table> from_arrow(
126  arrow::Table const& input,
127  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
128  // end of group
130 } // namespace cudf
table_view.hpp
Class definitions for (mutable)_table_view
column.hpp
Class definition for cudf::column.
types.hpp
Type declarations for libcudf.
cudf::from_arrow
std::unique_ptr< table > from_arrow(arrow::Table const &input, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Create cudf::table from given arrow Table input.
cudf::from_dlpack
std::unique_ptr< table > 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.
cudf::to_arrow
std::shared_ptr< arrow::Table > to_arrow(table_view input, std::vector< column_metadata > const &metadata={}, arrow::MemoryPool *ar_mr=arrow::default_memory_pool())
Create arrow::Table from cudf table input
cudf::to_dlpack
DLManagedTensor * 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.
cudf::table_view
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:154
cudf
cuDF interfaces
Definition: aggregation.hpp:34
table.hpp
Class definition for cudf::table.
cudf::column_metadata
Detailed meta data information for arrow array.
Definition: interop.hpp:92
rmm::mr::device_memory_resource