Skip to content

Commit

Permalink
another use + fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vuule committed Sep 26, 2024
1 parent 96fd00e commit eb59780
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
4 changes: 2 additions & 2 deletions cpp/include/cudf/detail/utilities/host_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class host_vector : public thrust::host_vector<T, rmm_host_allocator<T>> {
*/
void to_device_async(T* d_ptr, rmm::cuda_stream_view stream) const
{
auto const is_pinned = this->is_device_accessible();
auto const is_pinned = this->get_allocator().is_device_accessible();
cuda_memcpy_async(d_ptr,
this->data(),
this->size() * sizeof(T),
Expand All @@ -230,7 +230,7 @@ class host_vector : public thrust::host_vector<T, rmm_host_allocator<T>> {
*/
void from_device_async(T const* d_ptr, rmm::cuda_stream_view stream)
{
auto const is_pinned = this->is_device_accessible();
auto const is_pinned = this->get_allocator().is_device_accessible();
cuda_memcpy_async(this->data(),
d_ptr,
this->size() * sizeof(T),
Expand Down
23 changes: 7 additions & 16 deletions cpp/src/io/json/host_tree_algorithms.cu
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,12 @@ NodeIndexT get_row_array_parent_col_id(device_span<NodeIndexT const> col_ids,
bool is_enabled_lines,
rmm::cuda_stream_view stream)
{
NodeIndexT value = parent_node_sentinel;
if (!col_ids.empty()) {
auto const list_node_index = is_enabled_lines ? 0 : 1;
CUDF_CUDA_TRY(cudaMemcpyAsync(&value,
col_ids.data() + list_node_index,
sizeof(NodeIndexT),
cudaMemcpyDefault,
stream.value()));
stream.synchronize();
}
return value;
if (col_ids.empty()) { return parent_node_sentinel; }

auto value = cudf::detail::make_host_vector<NodeIndexT>(1, stream);
auto const list_node_index = is_enabled_lines ? 0 : 1;
value.from_device(col_ids.data() + list_node_index, stream);
return value[0];
}
/**
* @brief Holds member data pointers of `d_json_column`
Expand Down Expand Up @@ -1383,11 +1378,7 @@ std::pair<cudf::detail::host_vector<bool>, hashmap_of_device_columns> build_tree
column_categories.cbegin(),
expected_types.begin(),
[](auto exp, auto cat) { return exp == NUM_NODE_CLASSES ? cat : exp; });
cudaMemcpyAsync(d_column_tree.node_categories.begin(),
expected_types.data(),
expected_types.size() * sizeof(column_categories[0]),
cudaMemcpyDefault,
stream.value());
expected_types.to_device_async(d_column_tree.node_categories.data(), stream);

return {is_pruned, columns};
}
Expand Down

0 comments on commit eb59780

Please sign in to comment.