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

Feature/remove default streams #11967

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
21 changes: 12 additions & 9 deletions cpp/benchmarks/common/generate_input.cu
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ std::unique_ptr<cudf::column> create_random_column(data_profile const& profile,
null_mask.begin());
}

auto [result_bitmask, null_count] =
cudf::detail::valid_if(null_mask.begin(), null_mask.end(), thrust::identity<bool>{});
auto [result_bitmask, null_count] = cudf::detail::valid_if(
null_mask.begin(), null_mask.end(), thrust::identity<bool>{}, cudf::get_default_stream());

return std::make_unique<cudf::column>(
dtype,
Expand Down Expand Up @@ -508,8 +508,8 @@ std::unique_ptr<cudf::column> create_random_utf8_string_column(data_profile cons
thrust::make_zip_iterator(offsets.begin(), offsets.begin() + 1),
num_rows,
string_generator{chars.data(), engine});
auto [result_bitmask, null_count] =
cudf::detail::valid_if(null_mask.begin(), null_mask.end() - 1, thrust::identity<bool>{});
auto [result_bitmask, null_count] = cudf::detail::valid_if(
null_mask.begin(), null_mask.end() - 1, thrust::identity<bool>{}, cudf::get_default_stream());
return cudf::make_strings_column(
num_rows,
std::move(offsets),
Expand Down Expand Up @@ -541,7 +541,8 @@ std::unique_ptr<cudf::column> create_random_column<cudf::string_view>(data_profi
auto str_table = cudf::detail::gather(cudf::table_view{{sample_strings->view()}},
sample_indices,
cudf::out_of_bounds_policy::DONT_CHECK,
cudf::detail::negative_index_policy::NOT_ALLOWED);
cudf::detail::negative_index_policy::NOT_ALLOWED,
cudf::get_default_stream());
return std::move(str_table->release()[0]);
}

Expand Down Expand Up @@ -625,7 +626,8 @@ std::unique_ptr<cudf::column> create_random_column<cudf::struct_view>(data_profi
auto [null_mask, null_count] = [&]() {
if (profile.get_null_probability().has_value()) {
auto valids = valid_dist(engine, num_rows);
return cudf::detail::valid_if(valids.begin(), valids.end(), thrust::identity<bool>{});
return cudf::detail::valid_if(
valids.begin(), valids.end(), thrust::identity<bool>{}, cudf::get_default_stream());
}
return std::pair<rmm::device_buffer, cudf::size_type>{};
}();
Expand Down Expand Up @@ -708,8 +710,8 @@ std::unique_ptr<cudf::column> create_random_column<cudf::list_view>(data_profile
auto offsets_column = std::make_unique<cudf::column>(
cudf::data_type{cudf::type_id::INT32}, num_rows + 1, offsets.release());

auto [null_mask, null_count] =
cudf::detail::valid_if(valids.begin(), valids.end(), thrust::identity<bool>{});
auto [null_mask, null_count] = cudf::detail::valid_if(
valids.begin(), valids.end(), thrust::identity<bool>{}, cudf::get_default_stream());
list_column = cudf::make_lists_column(
num_rows,
std::move(offsets_column),
Expand Down Expand Up @@ -835,7 +837,8 @@ std::pair<rmm::device_buffer, cudf::size_type> create_random_null_mask(
} else {
return cudf::detail::valid_if(thrust::make_counting_iterator<cudf::size_type>(0),
thrust::make_counting_iterator<cudf::size_type>(size),
bool_generator{seed, 1.0 - *null_probability});
bool_generator{seed, 1.0 - *null_probability},
cudf::get_default_stream());
}
}

Expand Down
6 changes: 4 additions & 2 deletions cpp/benchmarks/iterator/iterator.cu
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ void BM_iterator(benchmark::State& state)
cudf::column_view hasnull_F = wrap_hasnull_F;

// Initialize dev_result to false
auto dev_result = cudf::detail::make_zeroed_device_uvector_sync<TypeParam>(1);
auto dev_result =
cudf::detail::make_zeroed_device_uvector_sync<TypeParam>(1, cudf::get_default_stream());
for (auto _ : state) {
cuda_event_timer raii(state, true); // flush_l2_cache = true, stream = 0
if (cub_or_thrust) {
Expand Down Expand Up @@ -208,7 +209,8 @@ void BM_pair_iterator(benchmark::State& state)
cudf::column_view hasnull_T = wrap_hasnull_T;

// Initialize dev_result to false
auto dev_result = cudf::detail::make_zeroed_device_uvector_sync<thrust::pair<T, bool>>(1);
auto dev_result = cudf::detail::make_zeroed_device_uvector_sync<thrust::pair<T, bool>>(
1, cudf::get_default_stream());
for (auto _ : state) {
cuda_event_timer raii(state, true); // flush_l2_cache = true, stream = 0
if (cub_or_thrust) {
Expand Down
4 changes: 3 additions & 1 deletion cpp/benchmarks/join/join_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ static void BM_join(state_type& state, Join JoinFunc)
// roughly 75% nulls
auto validity =
thrust::make_transform_iterator(thrust::make_counting_iterator(0), null75_generator{});
return cudf::detail::valid_if(validity, validity + size, thrust::identity<bool>{}).first;
return cudf::detail::valid_if(
validity, validity + size, thrust::identity<bool>{}, cudf::get_default_stream())
.first;
};

std::unique_ptr<cudf::column> build_key_column0 = [&]() {
Expand Down
3 changes: 2 additions & 1 deletion cpp/benchmarks/string/json.cu
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ auto build_json_string_column(int desired_bytes, int num_rows)
auto d_store_order = cudf::column_device_view::create(float_2bool_columns->get_column(2));
json_benchmark_row_builder jb{
desired_bytes, num_rows, {*d_books, *d_bicycles}, *d_book_pct, *d_misc_order, *d_store_order};
auto children = cudf::strings::detail::make_strings_children(jb, num_rows);
auto children =
cudf::strings::detail::make_strings_children(jb, num_rows, cudf::get_default_stream());
return cudf::make_strings_column(
num_rows, std::move(children.first), std::move(children.second), 0, {});
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/binaryop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ void apply_sorting_struct_binary_op(mutable_column_view& out,
bool is_lhs_scalar,
bool is_rhs_scalar,
binary_operator op,
rmm::cuda_stream_view stream = cudf::get_default_stream());
rmm::cuda_stream_view stream);
} // namespace detail
} // namespace compiled
} // namespace binops
Expand Down
8 changes: 4 additions & 4 deletions cpp/include/cudf/detail/binaryop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ std::unique_ptr<column> binary_operation(
column_view const& rhs,
std::string const& ptx,
data_type output_type,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -49,7 +49,7 @@ std::unique_ptr<column> binary_operation(
column_view const& rhs,
binary_operator op,
data_type output_type,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -63,7 +63,7 @@ std::unique_ptr<column> binary_operation(
scalar const& rhs,
binary_operator op,
data_type output_type,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -77,7 +77,7 @@ std::unique_ptr<column> binary_operation(
column_view const& rhs,
binary_operator op,
data_type output_type,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
} // namespace detail
} // namespace cudf
4 changes: 2 additions & 2 deletions cpp/include/cudf/detail/concatenate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace detail {
*/
std::unique_ptr<column> concatenate(
host_span<column_view const> columns_to_concat,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -45,7 +45,7 @@ std::unique_ptr<column> concatenate(
*/
std::unique_ptr<table> concatenate(
host_span<table_view const> tables_to_concat,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

} // namespace detail
Expand Down
44 changes: 22 additions & 22 deletions cpp/include/cudf/detail/copy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ ColumnView slice(ColumnView const& input, cudf::size_type begin, cudf::size_type
*/
std::vector<column_view> slice(column_view const& input,
host_span<size_type const> indices,
rmm::cuda_stream_view stream = cudf::get_default_stream());
rmm::cuda_stream_view stream);
/**
* @copydoc cudf::slice(column_view const&, std::initializer_list<size_type>)
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
std::vector<column_view> slice(column_view const& input,
std::initializer_list<size_type> indices,
rmm::cuda_stream_view stream = cudf::get_default_stream());
rmm::cuda_stream_view stream);

/**
* @copydoc cudf::slice(table_view const&, host_span<size_type const>)
Expand All @@ -94,15 +94,15 @@ std::vector<column_view> slice(column_view const& input,
*/
std::vector<table_view> slice(table_view const& input,
host_span<size_type const> indices,
rmm::cuda_stream_view stream = cudf::get_default_stream());
rmm::cuda_stream_view stream);
/**
* @copydoc cudf::slice(table_view const&, std::initializer_list<size_type>)
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
std::vector<table_view> slice(table_view const& input,
std::initializer_list<size_type> indices,
rmm::cuda_stream_view stream = cudf::get_default_stream());
rmm::cuda_stream_view stream);

/**
* @copydoc cudf::split(column_view const&, host_span<size_type const>)
Expand All @@ -111,15 +111,15 @@ std::vector<table_view> slice(table_view const& input,
*/
std::vector<column_view> split(column_view const& input,
host_span<size_type const> splits,
rmm::cuda_stream_view stream = cudf::get_default_stream());
rmm::cuda_stream_view stream);
/**
* @copydoc cudf::split(column_view const&, std::initializer_list<size_type>)
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
std::vector<column_view> split(column_view const& input,
std::initializer_list<size_type> splits,
rmm::cuda_stream_view stream = cudf::get_default_stream());
rmm::cuda_stream_view stream);

/**
* @copydoc cudf::split(table_view const&, host_span<size_type const>)
Expand All @@ -128,15 +128,15 @@ std::vector<column_view> split(column_view const& input,
*/
std::vector<table_view> split(table_view const& input,
host_span<size_type const> splits,
rmm::cuda_stream_view stream = cudf::get_default_stream());
rmm::cuda_stream_view stream);
/**
* @copydoc cudf::split(table_view const&, std::initializer_list<size_type>)
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
std::vector<table_view> split(table_view const& input,
std::initializer_list<size_type> splits,
rmm::cuda_stream_view stream = cudf::get_default_stream());
rmm::cuda_stream_view stream);

/**
* @copydoc cudf::shift(column_view const&,size_type,scalar const&,
Expand All @@ -148,7 +148,7 @@ std::unique_ptr<column> shift(
column_view const& input,
size_type offset,
scalar const& fill_value,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand Down Expand Up @@ -189,7 +189,7 @@ std::unique_ptr<column> segmented_shift(
device_span<size_type const> segment_offsets,
size_type offset,
scalar const& fill_value,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -200,7 +200,7 @@ std::unique_ptr<column> segmented_shift(
std::vector<packed_table> contiguous_split(
cudf::table_view const& input,
std::vector<size_type> const& splits,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -209,7 +209,7 @@ std::vector<packed_table> contiguous_split(
* @param stream Optional CUDA stream on which to execute kernels
**/
packed_columns pack(cudf::table_view const& input,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -221,7 +221,8 @@ packed_columns pack(cudf::table_view const& input,
std::unique_ptr<column> allocate_like(
column_view const& input,
size_type size,
mask_allocation_policy mask_alloc = mask_allocation_policy::RETAIN,
mask_allocation_policy mask_alloc = mask_allocation_policy::RETAIN,
// TODO: Move before mask_alloc?
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

Expand All @@ -235,7 +236,7 @@ std::unique_ptr<column> copy_if_else(
column_view const& lhs,
column_view const& rhs,
column_view const& boolean_mask,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -248,7 +249,7 @@ std::unique_ptr<column> copy_if_else(
scalar const& lhs,
column_view const& rhs,
column_view const& boolean_mask,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -261,7 +262,7 @@ std::unique_ptr<column> copy_if_else(
column_view const& lhs,
scalar const& rhs,
column_view const& boolean_mask,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -274,7 +275,7 @@ std::unique_ptr<column> copy_if_else(
scalar const& lhs,
scalar const& rhs,
column_view const& boolean_mask,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -287,6 +288,7 @@ std::unique_ptr<table> sample(
size_type const n,
sample_with_replacement replacement = sample_with_replacement::FALSE,
int64_t const seed = 0,
// TODO: Move before replacement?
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

Expand All @@ -298,24 +300,22 @@ std::unique_ptr<table> sample(
std::unique_ptr<scalar> get_element(
column_view const& input,
size_type index,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
* @copydoc cudf::has_nonempty_nulls
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
bool has_nonempty_nulls(column_view const& input,
rmm::cuda_stream_view stream = cudf::get_default_stream());
bool has_nonempty_nulls(column_view const& input, rmm::cuda_stream_view stream);

/**
* @copydoc cudf::may_have_nonempty_nulls
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
bool may_have_nonempty_nulls(column_view const& input,
rmm::cuda_stream_view stream = cudf::get_default_stream());
bool may_have_nonempty_nulls(column_view const& input, rmm::cuda_stream_view stream);

} // namespace detail
} // namespace cudf
2 changes: 1 addition & 1 deletion cpp/include/cudf/detail/copy_if.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ template <typename Filter>
std::unique_ptr<table> copy_if(
table_view const& input,
Filter filter,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
{
CUDF_FUNC_RANGE();
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/cudf/detail/copy_range.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void copy_range(SourceValueIterator source_value_begin,
mutable_column_view& target,
size_type target_begin,
size_type target_end,
rmm::cuda_stream_view stream = cudf::get_default_stream())
rmm::cuda_stream_view stream)
{
CUDF_EXPECTS((target_begin <= target_end) && (target_begin >= 0) &&
(target_begin < target.size()) && (target_end <= target.size()),
Expand Down Expand Up @@ -196,7 +196,7 @@ void copy_range_in_place(column_view const& source,
size_type source_begin,
size_type source_end,
size_type target_begin,
rmm::cuda_stream_view stream = cudf::get_default_stream());
rmm::cuda_stream_view stream);

/**
* @copydoc cudf::copy_range
Expand All @@ -209,7 +209,7 @@ std::unique_ptr<column> copy_range(
size_type source_begin,
size_type source_end,
size_type target_begin,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

} // namespace detail
Expand Down
Loading