An immutable, non-owning view of device data as a column of elements that is trivially copyable and usable in CUDA device code. More...
Public Types | |
using | count_it = thrust::counting_iterator< size_type > |
Iterator for navigating this column. | |
template<typename T > | |
using | const_iterator = thrust::transform_iterator< detail::value_accessor< T >, count_it > |
template<typename T , bool has_nulls> | |
using | const_pair_iterator = thrust::transform_iterator< detail::pair_accessor< T, has_nulls >, count_it > |
Pair iterator for navigating this column. | |
Public Member Functions | |
column_device_view (column_device_view const &)=default | |
column_device_view (column_device_view &&)=default | |
column_device_view & | operator= (column_device_view const &)=default |
column_device_view & | operator= (column_device_view &&)=default |
column_device_view (column_view column, void *h_ptr, void *d_ptr) | |
Creates an instance of this class using the specified host memory pointer (h_ptr) to store child objects and the device memory pointer (d_ptr) as a base for any child object pointers. More... | |
template<typename T > | |
__device__ T const | element (size_type element_index) const noexcept |
Returns reference to element at the specified index. More... | |
template<typename T > | |
const_iterator< T > | begin () const |
Return an iterator to the first element of the column. More... | |
template<typename T > | |
const_iterator< T > | end () const |
Returns an iterator to the element following the last element of the column. More... | |
template<typename T , bool has_nulls> | |
const_pair_iterator< T, has_nulls > | pair_begin () const |
Return a pair iterator to the first element of the column. More... | |
template<typename T , bool has_nulls> | |
const_pair_iterator< T, has_nulls > | pair_end () const |
Return a pair iterator to the element following the last element of the column. More... | |
void | destroy () |
Destroy the column_device_view object. More... | |
__device__ column_device_view | child (size_type child_index) const noexcept |
Returns the specified child. More... | |
template<> | |
__device__ string_view const | element (size_type element_index) const noexcept |
Returns string_view to the string element at the specified index. More... | |
template<> | |
__device__ dictionary32 const | element (size_type element_index) const noexcept |
Returns dictionary32 element at the specified index for a dictionary column. More... | |
![]() | |
column_device_view_base (column_device_view_base const &)=default | |
column_device_view_base (column_device_view_base &&)=default | |
column_device_view_base & | operator= (column_device_view_base const &)=default |
column_device_view_base & | operator= (column_device_view_base &&)=default |
template<typename T = void> | |
__host__ __device__ T const * | head () const noexcept |
Returns pointer to the base device memory allocation casted to the specified type. More... | |
template<typename T > | |
__host__ __device__ T const * | data () const noexcept |
Returns the underlying data casted to the specified type, plus the offset. More... | |
__host__ __device__ size_type | size () const noexcept |
Returns the number of elements in the column. | |
__host__ __device__ data_type | type () const noexcept |
Returns the element type. | |
__host__ __device__ bool | nullable () const noexcept |
Indicates whether the column can contain null elements, i.e., if it has an allocated bitmask. More... | |
__host__ __device__ bitmask_type const * | null_mask () const noexcept |
Returns raw pointer to the underlying bitmask allocation. More... | |
__host__ __device__ size_type | offset () const noexcept |
Returns the index of the first element relative to the base memory allocation, i.e., what is returned from head<T>() . | |
__device__ bool | is_valid (size_type element_index) const noexcept |
Returns whether the specified element holds a valid value (i.e., not null). More... | |
__device__ bool | is_valid_nocheck (size_type element_index) const noexcept |
Returns whether the specified element holds a valid value (i.e., not null) More... | |
__device__ bool | is_null (size_type element_index) const noexcept |
Returns whether the specified element is null. More... | |
__device__ bool | is_null_nocheck (size_type element_index) const noexcept |
Returns whether the specified element is null. More... | |
__device__ bitmask_type | get_mask_word (size_type word_index) const noexcept |
Returns the the specified bitmask word from the null_mask() . More... | |
Static Public Member Functions | |
static std::unique_ptr< column_device_view, std::function< void(column_device_view *)> > | create (column_view source_view, rmm::cuda_stream_view stream=rmm::cuda_stream_default) |
Factory to construct a column view that is usable in device memory. More... | |
static std::size_t | extent (column_view const &source_view) |
Return the size in bytes of the amount of memory needed to hold a device view of the specified column and it's children. More... | |
Protected Member Functions | |
column_device_view (column_view source) | |
Construct's a column_device_view from a column_view populating all but the children. More... | |
![]() | |
column_device_view_base (data_type type, size_type size, void const *data, bitmask_type const *null_mask, size_type offset) | |
Protected Attributes | |
column_device_view * | d_children {} |
size_type | _num_children {} |
The number of child columns. | |
![]() | |
data_type | _type {type_id::EMPTY} |
Element type. | |
cudf::size_type | _size {} |
Number of elements. | |
void const * | _data {} |
Pointer to device memory containing elements. | |
bitmask_type const * | _null_mask {} |
size_type | _offset {} |
An immutable, non-owning view of device data as a column of elements that is trivially copyable and usable in CUDA device code.
Definition at line 254 of file column_device_view.cuh.
cudf::column_device_view::column_device_view | ( | column_view | column, |
void * | h_ptr, | ||
void * | d_ptr | ||
) |
Creates an instance of this class using the specified host memory pointer (h_ptr) to store child objects and the device memory pointer (d_ptr) as a base for any child object pointers.
column | Column view from which to create this instance. |
h_ptr | Host memory pointer on which to place any child data. |
d_ptr | Device memory pointer on which to base any child pointers. |
|
protected |
Construct's a column_device_view
from a column_view
populating all but the children.
column_device_view
from a column_view
, the column_device_view::create()
function should be used.
|
inline |
Return an iterator to the first element of the column.
This iterator only supports columns where has_nulls() == false
. Using it with columns where has_nulls() == true
will result in undefined behavior when accessing null elements.
For columns with null elements, use make_null_replacement_iterator
.
Definition at line 309 of file column_device_view.cuh.
|
inlinenoexcept |
Returns the specified child.
child_index | The index of the desired child |
column_view
Definition at line 418 of file column_device_view.cuh.
|
static |
Factory to construct a column view that is usable in device memory.
Allocates and copies views of source_view
's children to device memory to make them accessible in device code.
If source_view.num_children() == 0
, then no device memory is allocated.
Returns a std::unique_ptr<column_device_view>
with a custom deleter to free the device memory allocated for the children.
A column_device_view
should be passed by value into GPU kernels.
source_view | The column_view to make usable in device code |
stream | CUDA stream used for device memory operations for children columns. |
unique_ptr
to a column_device_view
that makes the data from source_view
available in device memory. void cudf::column_device_view::destroy | ( | ) |
Destroy the column_device_view
object.
|
inlinenoexcept |
Returns reference to element at the specified index.
If the element at the specified index is NULL, i.e., is_null(element_index) == true
, then any attempt to use the result will lead to undefined behavior.
This function accounts for the offset.
T | The element type |
element_index | Position of the desired element |
Definition at line 287 of file column_device_view.cuh.
|
inlinenoexcept |
Returns string_view
to the string element at the specified index.
If the element at the specified index is NULL, i.e., is_null(element_index) == true
, then any attempt to use the result will lead to undefined behavior.
This function accounts for the offset.
element_index | Position of the desired string element |
Definition at line 693 of file column_device_view.cuh.
|
inlinenoexcept |
Returns dictionary32
element at the specified index for a dictionary column.
dictionary32
is a strongly typed wrapper around an int32_t
value that holds the offset into the dictionary keys for the specified element.
For example, given a dictionary column d
with:
If the element at the specified index is NULL, i.e., is_null(element_index) == true
, then any attempt to use the result will lead to undefined behavior.
This function accounts for the offset.
element_index | Position of the desired element |
Definition at line 752 of file column_device_view.cuh.
|
inline |
Returns an iterator to the element following the last element of the column.
This iterator only supports columns where has_nulls() == false
. Using it with columns where has_nulls() == true
will result in undefined behavior when accessing null elements.
For columns with null elements, use make_null_replacement_iterator
.
Definition at line 324 of file column_device_view.cuh.
|
static |
Return the size in bytes of the amount of memory needed to hold a device view of the specified column and it's children.
source_view | The column_view to use for this calculation. |
|
inline |
Return a pair iterator to the first element of the column.
Dereferencing the returned iterator returns a thrust::pair<T, bool>
.
If an element at position i
is valid (or has_nulls == false
), then for p = *(iter + i)
, p.first
contains the value of the element at i
and p.second == true
.
Else, if the element at i
is null, then the value of p.first
is undefined and p.second == false
.
cudf::logic_error | if tparam has_nulls == true and nullable() == false |
cudf::logic_error | if column datatype and Element type mismatch. |
Definition at line 353 of file column_device_view.cuh.
|
inline |
Return a pair iterator to the element following the last element of the column.
cudf::logic_error | if tparam has_nulls == true and nullable() == false |
cudf::logic_error | if column datatype and Element type mismatch. |
Definition at line 368 of file column_device_view.cuh.
|
protected |
Array of column_device_view
objects in device memory. Based on element type, children may contain additional data
Definition at line 424 of file column_device_view.cuh.