Skip to content

Commit

Permalink
Merge pull request NVIDIA#1827 from senior-zero/fix-main/github/reduc…
Browse files Browse the repository at this point in the history
…e_by_key_zero_initializable

Fix reduce by key for non default initializable iterators
  • Loading branch information
gevtushenko authored Nov 15, 2022
2 parents 5e410e1 + f77e2c6 commit db2ee03
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions thrust/system/cuda/detail/reduce_by_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -1079,12 +1079,13 @@ namespace __reduce_by_key {

size_type num_items = thrust::distance(keys_first, keys_last);

pair<KeysOutputIt, ValuesOutputIt> result = thrust::make_pair(keys_output, values_output);

if (num_items == 0)
{
return thrust::make_pair(keys_output, values_output);
return result;
}

pair<KeysOutputIt, ValuesOutputIt> result{};
THRUST_INDEX_TYPE_DISPATCH(result,
reduce_by_key_dispatch,
num_items,
Expand Down

0 comments on commit db2ee03

Please sign in to comment.