interop.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-2022, 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 // We disable warning 611 because the `arrow::TableBatchReader` only partially
20 // override the `ReadNext` method of `arrow::RecordBatchReader::ReadNext`
21 // triggering warning 611-D from nvcc.
22 #pragma nv_diag_suppress 611
23 #pragma nv_diag_suppress 2810
24 #include <arrow/api.h>
25 #pragma nv_diag_default 611
26 #pragma nv_diag_default 2810
27 
28 #include <cudf/column/column.hpp>
29 #include <cudf/detail/transform.hpp>
30 #include <cudf/table/table.hpp>
32 #include <cudf/types.hpp>
33 
35 
36 struct DLManagedTensor;
37 
38 namespace cudf {
62 std::unique_ptr<table> from_dlpack(
63  DLManagedTensor const* managed_tensor,
64  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
65 
84 DLManagedTensor* to_dlpack(
85  table_view const& input,
86  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
87  // end of group
89 
103  std::string name;
104  std::vector<column_metadata> children_meta;
105 
111  column_metadata(std::string const& _name) : name(_name) {}
112  column_metadata() = default;
113 };
114 
128 std::shared_ptr<arrow::Table> to_arrow(table_view input,
129  std::vector<column_metadata> const& metadata = {},
130  arrow::MemoryPool* ar_mr = arrow::default_memory_pool());
131 
140 std::unique_ptr<table> from_arrow(
141  arrow::Table const& input,
142  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
143  // end of group
145 } // namespace cudf
per_device_resource.hpp
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::column_metadata::children_meta
std::vector< column_metadata > children_meta
Metadata of children of the column.
Definition: interop.hpp:104
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:187
cudf
cuDF interfaces
Definition: aggregation.hpp:34
cudf::column_metadata::name
std::string name
Name of the column.
Definition: interop.hpp:103
table.hpp
Class definition for cudf::table.
cudf::column_metadata::column_metadata
column_metadata(std::string const &_name)
Construct a new column metadata object.
Definition: interop.hpp:111
cudf::column_metadata
Detailed metadata information for arrow array.
Definition: interop.hpp:102
rmm::mr::device_memory_resource