contiguous_split.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
8 #include <cudf/packed_types.hpp>
9 #include <cudf/types.hpp>
10 #include <cudf/utilities/export.hpp>
12 
13 #include <memory>
14 #include <vector>
15 
16 namespace CUDF_EXPORT cudf {
17 
65 std::vector<packed_table> contiguous_split(
66  cudf::table_view const& input,
67  std::vector<size_type> const& splits,
70 
71 namespace detail {
72 
78 struct contiguous_split_state;
79 } // namespace detail
80 
139  public:
150  explicit chunked_pack(
151  cudf::table_view const& input,
152  std::size_t user_buffer_size,
155 
161 
167  [[nodiscard]] std::size_t get_total_contiguous_size() const;
168 
174  [[nodiscard]] bool has_next() const;
175 
189  [[nodiscard]] std::size_t next(cudf::device_span<uint8_t> const& user_buffer);
190 
196  [[nodiscard]] std::unique_ptr<std::vector<uint8_t>> build_metadata() const;
197 
217  [[nodiscard]] static std::unique_ptr<chunked_pack> create(
218  cudf::table_view const& input,
219  std::size_t user_buffer_size,
222 
223  private:
224  // internal state of contiguous split
225  std::unique_ptr<detail::contiguous_split_state> state;
226 };
227 
244 
258 std::vector<uint8_t> pack_metadata(table_view const& table,
259  uint8_t const* contiguous_buffer,
260  size_t buffer_size);
261 
277 
295 table_view unpack(uint8_t const* metadata, uint8_t const* gpu_data);
296 
298 } // namespace CUDF_EXPORT cudf
Perform a chunked "pack" operation of the input table_view using a user provided buffer of size user_...
std::size_t get_total_contiguous_size() const
Obtain the total size of the contiguously packed table_view.
std::size_t next(cudf::device_span< uint8_t > const &user_buffer)
Packs the next chunk into user_buffer. This should be called as long as has_next returns true....
~chunked_pack()
Destructor that will be implemented as default. Declared with definition here because contiguous_spli...
chunked_pack(cudf::table_view const &input, std::size_t user_buffer_size, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref temp_mr=cudf::get_current_device_resource_ref())
Construct a chunked_pack class.
std::unique_ptr< std::vector< uint8_t > > build_metadata() const
Build the opaque metadata for all added columns.
static std::unique_ptr< chunked_pack > create(cudf::table_view const &input, std::size_t user_buffer_size, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref temp_mr=cudf::get_current_device_resource_ref())
Creates a chunked_pack instance to perform a "pack" of the table_view "input", where a buffer of user...
bool has_next() const
Function to check if there are chunks left to be copied.
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:189
A set of cudf::column's of the same size.
Definition: table.hpp:29
std::vector< packed_table > contiguous_split(cudf::table_view const &input, std::vector< size_type > const &splits, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Performs a deep-copy split of a table_view into a vector of packed_table where each packed_table is u...
packed_columns pack(cudf::table_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Deep-copy a table_view into a serialized contiguous memory format.
table_view unpack(uint8_t const *metadata, uint8_t const *gpu_data)
Deserialize the result of cudf::pack.
std::vector< uint8_t > pack_metadata(table_view const &table, uint8_t const *contiguous_buffer, size_t buffer_size)
Produce the metadata used for packing a table stored in a contiguous buffer.
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
rmm::device_async_resource_ref get_current_device_resource_ref()
Get the current device memory resource reference.
detail::cccl_async_resource_ref< cuda::mr::resource_ref< cuda::mr::device_accessible > > device_async_resource_ref
cuDF interfaces
Definition: host_udf.hpp:26
Packed table and column types for serialization.
Device version of C++20 std::span with reduced feature set.
Definition: span.hpp:323
Column data in a serialized format.
Type declarations for libcudf.