Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pinned bounce buffer in the CSV reader #13750

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions cpp/src/io/csv/reader_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,20 @@ std::pair<rmm::device_uvector<char>, selected_rows_offsets> load_data_and_gather
rmm::device_uvector<char> d_data{
(load_whole_file) ? data.size() : std::min(buffer_size * 2, data.size()), stream};
d_data.resize(0, stream);
cudf::detail::pinned_host_vector<char> bounce_buffer(buffer_size);
rmm::device_uvector<uint64_t> all_row_offsets{0, stream};
do {
size_t target_pos = std::min(pos + max_chunk_bytes, data.size());
size_t chunk_size = target_pos - pos;

auto const target_pos = std::min(pos + max_chunk_bytes, data.size());
auto const chunk_size = target_pos - pos;
auto const previous_data_size = d_data.size();

std::memcpy(bounce_buffer.data(),
data.begin() + buffer_pos + previous_data_size,
target_pos - buffer_pos - previous_data_size);

d_data.resize(target_pos - buffer_pos, stream);
CUDF_CUDA_TRY(cudaMemcpyAsync(d_data.begin() + previous_data_size,
data.begin() + buffer_pos + previous_data_size,
bounce_buffer.data(),
target_pos - buffer_pos - previous_data_size,
cudaMemcpyDefault,
stream.value()));
Expand Down
Loading