I have to do keyed reductions of arrays with many different keys that repeat only once in a while:
keys = {1,2,3,3,4,5,6,7,7, 8, 9, 9,10,11,...}
array = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,...}
// after reduction
result = {1,2,7,5,6,7,17,10,23,13,14}
Using thrust::reduce_by_key
(or any other segmented reduction method) is not the fastest option here as most operations are in fact just copies from one array to another.
What would be a better approach to this problem?