Skip to content

Commit

Permalink
avoid defaulting streams to force the caller to provide a stream
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikeyann committed Mar 24, 2021
1 parent 9a6b9c5 commit 87989c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
25 changes: 11 additions & 14 deletions cpp/include/cudf/detail/groupby/sort_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct sort_groupby_helper {
*/
std::unique_ptr<column> sorted_values(
column_view const& values,
rmm::cuda_stream_view stream = rmm::cuda_stream_default,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -108,7 +108,7 @@ struct sort_groupby_helper {
*/
std::unique_ptr<column> grouped_values(
column_view const& values,
rmm::cuda_stream_view stream = rmm::cuda_stream_default,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -117,7 +117,7 @@ struct sort_groupby_helper {
* @return a new table in which each row is a unique row in the sorted key table.
*/
std::unique_ptr<table> unique_keys(
rmm::cuda_stream_view stream = rmm::cuda_stream_default,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
Expand All @@ -126,16 +126,13 @@ struct sort_groupby_helper {
* @return a new table containing the sorted keys.
*/
std::unique_ptr<table> sorted_keys(
rmm::cuda_stream_view stream = rmm::cuda_stream_default,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

/**
* @brief Get the number of groups in `keys`
*/
size_type num_groups(rmm::cuda_stream_view stream = rmm::cuda_stream_default)
{
return group_offsets(stream).size() - 1;
}
size_type num_groups(rmm::cuda_stream_view stream) { return group_offsets(stream).size() - 1; }

/**
* @brief Return the effective number of keys
Expand All @@ -144,7 +141,7 @@ struct sort_groupby_helper {
* When include_null_keys = NO, returned value is the number of rows in `keys`
* in which no element is null
*/
size_type num_keys(rmm::cuda_stream_view stream = rmm::cuda_stream_default);
size_type num_keys(rmm::cuda_stream_view stream);

/**
* @brief Get the sorted order of `keys`.
Expand All @@ -159,7 +156,7 @@ struct sort_groupby_helper {
*
* @return the sort order indices for `keys`.
*/
column_view key_sort_order(rmm::cuda_stream_view stream = rmm::cuda_stream_default);
column_view key_sort_order(rmm::cuda_stream_view stream);

/**
* @brief Get each group's offset into the sorted order of `keys`.
Expand All @@ -172,7 +169,7 @@ struct sort_groupby_helper {
* @return vector of offsets of the starting point of each group in the sorted
* key table
*/
index_vector const& group_offsets(rmm::cuda_stream_view stream = rmm::cuda_stream_default);
index_vector const& group_offsets(rmm::cuda_stream_view stream);

/**
* @brief Get the group labels corresponding to the sorted order of `keys`.
Expand All @@ -187,7 +184,7 @@ struct sort_groupby_helper {
*
* @return vector of group labels for each row in the sorted key column
*/
index_vector const& group_labels(rmm::cuda_stream_view stream = rmm::cuda_stream_default);
index_vector const& group_labels(rmm::cuda_stream_view stream);

private:
/**
Expand All @@ -204,7 +201,7 @@ struct sort_groupby_helper {
* @return A nullable column of `INT32` containing group labels in the order
* of the unsorted key table
*/
column_view unsorted_keys_labels(rmm::cuda_stream_view stream = rmm::cuda_stream_default);
column_view unsorted_keys_labels(rmm::cuda_stream_view stream);

/**
* @brief Get the column representing the row bitmask for the `keys`
Expand All @@ -218,7 +215,7 @@ struct sort_groupby_helper {
* Computes and stores bitmask on first invocation and returns stored column
* on subsequent calls.
*/
column_view keys_bitmask_column(rmm::cuda_stream_view stream = rmm::cuda_stream_default);
column_view keys_bitmask_column(rmm::cuda_stream_view stream);

private:
column_ptr _key_sorted_order; ///< Indices to produce _keys in sorted order
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/groupby/groupby.cu
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ groupby::groups groupby::get_groups(table_view values, rmm::mr::device_memory_re

if (values.num_columns()) {
auto grouped_values = cudf::detail::gather(values,
helper().key_sort_order(),
helper().key_sort_order(rmm::cuda_stream_default),
cudf::out_of_bounds_policy::DONT_CHECK,
cudf::detail::negative_index_policy::NOT_ALLOWED,
rmm::cuda_stream_default,
Expand Down

0 comments on commit 87989c6

Please sign in to comment.