8 #include <cudf/detail/utilities/cuda_memcpy.hpp>
9 #include <cudf/detail/utilities/vector_factories.hpp>
26 namespace CUDF_EXPORT
cudf {
45 template <
typename ColumnDeviceView,
typename HostTableView>
70 __device__ ColumnDeviceView*
begin() const noexcept {
return _columns; }
80 __device__ ColumnDeviceView*
end() const noexcept {
return _columns + _num_columns; }
90 assert(column_index >= 0);
91 assert(column_index < _num_columns);
92 return _columns[column_index];
103 assert(column_index >= 0);
104 assert(column_index < _num_columns);
105 return _columns[column_index];
131 ColumnDeviceView* _columns{};
230 template <
typename ColumnDeviceView,
typename HostTableView>
236 std::size_t views_size_bytes = std::accumulate(
237 source_view.begin(), source_view.end(), std::size_t{0}, [](std::size_t init,
auto col) {
238 return init + ColumnDeviceView::extent(col);
241 auto padded_views_size_bytes = views_size_bytes + std::size_t{
alignof(ColumnDeviceView) - 1};
245 auto h_buffer = cudf::detail::make_host_vector<int8_t>(padded_views_size_bytes, stream);
254 auto descendant_storage = std::make_unique<rmm::device_buffer>(padded_views_size_bytes, stream);
255 void* h_ptr = detail::align_ptr_for_type<ColumnDeviceView>(h_buffer.data());
256 void* d_ptr = detail::align_ptr_for_type<ColumnDeviceView>(descendant_storage->data());
257 auto d_columns = detail::child_columns_to_device_array<ColumnDeviceView>(
258 source_view.begin(), source_view.end(), h_ptr, d_ptr);
261 static_cast<int8_t const*
>(h_ptr) - h_buffer.data(), views_size_bytes);
263 cudf::detail::cuda_memcpy(d_span, h_span, stream);
264 return std::make_tuple(std::move(descendant_storage), d_columns);
An immutable, non-owning view of device data as a column of elements that is trivially copyable and u...
Base class for a device table of ColumnDeviceViews.
size_type num_rows() const noexcept
Returns the number of rows.
ColumnDeviceView const & column(size_type column_index) const noexcept
Returns a reference to the view of the specified column.
table_device_view_base(table_device_view_base &&)=default
Move constructor.
ColumnDeviceView * begin() const noexcept
Returns an iterator to the first view in the table.
void destroy()
Destroy the table_device_view object.
table_device_view_base(table_device_view_base const &)=default
Copy constructor.
size_type num_columns() const noexcept
Returns the number of columns.
table_device_view_base & operator=(table_device_view_base const &)=default
Copy assignment operator.
ColumnDeviceView * end() const noexcept
Returns an iterator one past the last column view in the table.
table_device_view_base(HostTableView source_view, rmm::cuda_stream_view stream)
Construct a new table device view base object from host table_view.
table_device_view_base & operator=(table_device_view_base &&)=default
Move assignment operator.
ColumnDeviceView & column(size_type column_index) noexcept
Returns a reference to the view of the specified column.
A mutable, non-owning view of device data as a column of elements that is trivially copyable and usab...
Mutable table device view that is usable in device memory.
static auto create(mutable_table_view source_view, rmm::cuda_stream_view stream=cudf::get_default_stream())
Factory to construct a mutable table device view that is usable in device memory.
A set of mutable_column_views of the same size.
Table device view that is usable in device memory.
static auto create(table_view source_view, rmm::cuda_stream_view stream=cudf::get_default_stream())
Factory to construct a table device view that is usable in device memory.
A set of cudf::column_view's of the same size.
Column device view class definitions.
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
int32_t size_type
Row index type for columns and tables.
auto contiguous_copy_column_device_views(HostTableView source_view, rmm::cuda_stream_view stream)
Copies the contents of a table_view to a column device view in contiguous device memory.
Device version of C++20 std::span with reduced feature set.
C++20 std::span with reduced feature set.
constexpr CUDF_HOST_DEVICE host_span subspan(typename base::size_type offset, typename base::size_type count) const noexcept
Obtains a span that is a view over the count elements of this span starting at offset.
Class definitions for (mutable)_table_view
Type declarations for libcudf.