Files | Classes | Functions

Files

file  copying.hpp
 Column APIs for gather, scatter, split, slice, etc.
 

Classes

struct  cudf::packed_columns::metadata
 Host-side metadata buffer used for reconstructing columns via unpack. More...
 
struct  cudf::packed_columns
 Column data in a serialized format. More...
 
struct  cudf::packed_table
 The result(s) of a contiguous_split More...
 

Functions

std::vector< column_viewcudf::split (column_view const &input, std::vector< size_type > const &splits)
 Splits a column_view into a set of column_views according to a set of indices derived from expected splits. More...
 
std::vector< table_viewcudf::split (table_view const &input, std::vector< size_type > const &splits)
 Splits a table_view into a set of table_views according to a set of indices derived from expected splits. More...
 
std::vector< packed_tablecudf::contiguous_split (cudf::table_view const &input, std::vector< size_type > const &splits, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Performs a deep-copy split of a table_view into a set of table_views into a single contiguous block of memory. More...
 

Detailed Description

Function Documentation

◆ contiguous_split()

std::vector<packed_table> cudf::contiguous_split ( cudf::table_view const &  input,
std::vector< size_type > const &  splits,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Performs a deep-copy split of a table_view into a set of table_views into a single contiguous block of memory.

The memory for the output views is allocated in a single contiguous rmm::device_buffer returned in the packed_table. There is no top-level owning table.

The returned views of input are constructed from a vector of indices, that indicate where each split should occur. The ith returned table_view is sliced as [0, splits[i]) if i=0, else [splits[i], input.size()) if i is the last view and [splits[i-1], splits[i]] otherwise.

For all i it is expected splits[i] <= splits[i+1] <= input.size() For a splits size N, there will always be N+1 splits in the output

Note
It is the caller's responsibility to ensure that the returned views do not outlive the viewed device memory contained in the all_data field of the returned packed_table.
Example:
input: [{10, 12, 14, 16, 18, 20, 22, 24, 26, 28},
{50, 52, 54, 56, 58, 60, 62, 64, 66, 68}]
splits: {2, 5, 9}
output: [{{10, 12}, {14, 16, 18}, {20, 22, 24, 26}, {28}},
{{50, 52}, {54, 56, 58}, {60, 62, 64, 66}, {68}}]
Exceptions
cudf::logic_errorif splits has end index > size of input.
cudf::logic_errorWhen the value in splits is not in the range [0, input.size()).
cudf::logic_errorWhen the values in the splits are 'strictly decreasing'.
Parameters
inputView of a table to split
splitsA vector of indices where the view will be split
[in]mrDevice memory resource used to allocate the returned result's device memory
Returns
The set of requested views of input indicated by the splits and the viewed memory buffer.

◆ split() [1/2]

std::vector<column_view> cudf::split ( column_view const &  input,
std::vector< size_type > const &  splits 
)

Splits a column_view into a set of column_views according to a set of indices derived from expected splits.

The returned view's of input are constructed from vector of splits, which indicates where the split should occur. The ith returned column_view is sliced as [0, splits[i]) if i=0, else [splits[i], input.size()) if i is the last view and [splits[i-1], splits[i]] otherwise.

For all i it is expected splits[i] <= splits[i+1] <= input.size() For a splits size N, there will always be N+1 splits in the output

Note
It is the caller's responsibility to ensure that the returned views do not outlive the viewed device memory.
Example:
input: {10, 12, 14, 16, 18, 20, 22, 24, 26, 28}
splits: {2, 5, 9}
output: {{10, 12}, {14, 16, 18}, {20, 22, 24, 26}, {28}}
Exceptions
cudf::logic_errorif splits has end index > size of input.
cudf::logic_errorWhen the value in splits is not in the range [0, input.size()).
cudf::logic_errorWhen the values in the splits are 'strictly decreasing'.
Parameters
inputView of column to split
splitsA vector of indices where the view will be split
Returns
The set of requested views of input indicated by the splits.

◆ split() [2/2]

std::vector<table_view> cudf::split ( table_view const &  input,
std::vector< size_type > const &  splits 
)

Splits a table_view into a set of table_views according to a set of indices derived from expected splits.

The returned views of input are constructed from vector of splits, which indicates where the split should occur. The ith returned table_view is sliced as [0, splits[i]) if i=0, else [splits[i], input.size()) if i is the last view and [splits[i-1], splits[i]] otherwise.

For all i it is expected splits[i] <= splits[i+1] <= input.size() For a splits size N, there will always be N+1 splits in the output

Note
It is the caller's responsibility to ensure that the returned views do not outlive the viewed device memory.
Example:
input: [{10, 12, 14, 16, 18, 20, 22, 24, 26, 28},
{50, 52, 54, 56, 58, 60, 62, 64, 66, 68}]
splits: {2, 5, 9}
output: [{{10, 12}, {14, 16, 18}, {20, 22, 24, 26}, {28}},
{{50, 52}, {54, 56, 58}, {60, 62, 64, 66}, {68}}]
Exceptions
cudf::logic_errorif splits has end index > size of input.
cudf::logic_errorWhen the value in splits is not in the range [0, input.size()).
cudf::logic_errorWhen the values in the splits are 'strictly decreasing'.
Parameters
inputView of a table to split
splitsA vector of indices where the view will be split
Returns
The set of requested views of input indicated by the splits.