Skip to content

Commit 4c8591b

Browse files
committed
change the type of the owner of offsets and buff_addrs
Signed-off-by: Jigao Luo <[email protected]>
1 parent 852e64e commit 4c8591b

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

cpp/src/io/parquet/page_data.cu

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -579,20 +579,9 @@ void write_final_offsets(host_span<size_type const> offsets,
579579
host_span<size_type* const> buff_addrs,
580580
rmm::cuda_stream_view stream)
581581
{
582-
auto host_pinned_offsets = cudf::detail::make_host_vector<size_type>(offsets.size(), stream);
583-
auto host_pinned_buff_addrs = cudf::detail::make_host_vector<size_type*>(buff_addrs.size(), stream);
584-
CUDF_CUDA_TRY(cudaMemcpyAsync(host_pinned_offsets.data(),
585-
offsets.data(),
586-
offsets.size_bytes(),
587-
cudaMemcpyHostToHost,
588-
stream.value()));
589-
CUDF_CUDA_TRY(cudaMemcpyAsync(host_pinned_buff_addrs.data(),
590-
buff_addrs.data(),
591-
buff_addrs.size_bytes(),
592-
cudaMemcpyHostToHost,
593-
stream.value()));
582+
// Copy offsets to device and create an iterator
594583
auto d_src_data = cudf::detail::make_device_uvector_async(
595-
host_pinned_offsets, stream, cudf::get_current_device_resource_ref());
584+
offsets, stream, cudf::get_current_device_resource_ref());
596585
// Iterator for the source (scalar) data
597586
auto src_iter = thrust::make_transform_iterator(
598587
thrust::make_counting_iterator<std::size_t>(0),
@@ -601,7 +590,7 @@ void write_final_offsets(host_span<size_type const> offsets,
601590

602591
// Copy buffer addresses to device and create an iterator
603592
auto d_dst_addrs = cudf::detail::make_device_uvector_async(
604-
host_pinned_buff_addrs, stream, cudf::get_current_device_resource_ref());
593+
buff_addrs, stream, cudf::get_current_device_resource_ref());
605594
// size_iter is simply a constant iterator of sizeof(size_type) bytes.
606595
auto size_iter = thrust::make_constant_iterator(sizeof(size_type));
607596

cpp/src/io/parquet/reader_impl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ void reader_impl::decode_page_data(read_mode mode, size_t skip_rows, size_t num_
467467
// that it is difficult/impossible for a given page to know that it is writing the very
468468
// last value that should then be followed by a terminator (because rows can span
469469
// page boundaries).
470-
std::vector<size_type*> out_buffers;
471-
std::vector<size_type> final_offsets;
470+
auto out_buffers = cudf::detail::make_host_vector<size_type*>(_input_columns.size(), _stream);
471+
auto final_offsets = cudf::detail::make_host_vector<size_type>(_input_columns.size(), _stream);
472472
out_buffers.reserve(_input_columns.size());
473473
final_offsets.reserve(_input_columns.size());
474474
for (size_t idx = 0; idx < _input_columns.size(); idx++) {
@@ -486,14 +486,14 @@ void reader_impl::decode_page_data(read_mode mode, size_t skip_rows, size_t num_
486486

487487
// the final offset for a list at level N is the size of it's child
488488
size_type const offset = child.type.id() == type_id::LIST ? child.size - 1 : child.size;
489-
out_buffers.emplace_back(static_cast<size_type*>(out_buf.data()) + (out_buf.size - 1));
490-
final_offsets.emplace_back(offset);
489+
out_buffers.push_back(static_cast<size_type*>(out_buf.data()) + (out_buf.size - 1));
490+
final_offsets.push_back(offset);
491491
out_buf.user_data |= PARQUET_COLUMN_BUFFER_FLAG_LIST_TERMINATED;
492492
} else if (out_buf.type.id() == type_id::STRING) {
493493
// only if it is not a large strings column
494494
if (std::cmp_less_equal(col_string_sizes[idx], strings::detail::get_offset64_threshold())) {
495-
out_buffers.emplace_back(static_cast<size_type*>(out_buf.data()) + out_buf.size);
496-
final_offsets.emplace_back(static_cast<size_type>(col_string_sizes[idx]));
495+
out_buffers.push_back(static_cast<size_type*>(out_buf.data()) + out_buf.size);
496+
final_offsets.push_back(static_cast<size_type>(col_string_sizes[idx]));
497497
}
498498
// Nested large strings column
499499
else if (input_col.nesting_depth() > 0) {

0 commit comments

Comments
 (0)