Thanks for the response.
I looked into stream compaction, so, as I understood, what you have suggested is allocate space for all the possible values of the keys, then use atomicAdd() to get the number of elements for each key, and use stream compaction to get only the keys which have non-zero number of elements.
Problem with above approach is my “keys” range is very large (ex: 1 to 10^10), so I cannot allocate space for all the possible keys. Is there any possible way of maintaining only the keys which have non-zero number of elements (using thrust ??). I’m only interested in the number of elements for each key (no need to store which elements).
For example, if my input data is set of locations (mapped to integer keys), desired output is number of records for each location
input : 1, 3, 10, 1, 10, 10, 2, 400, 3, 850, 1, 400, 400, 5000
output: key, value