Will cuco::static_multimap
get a for_each
API, or is there a way to get similar functionality?
#528
-
#506 added a for_each API for static_multiset. Is there any thoughts on adding it for static_multimap? Alternatively, is there a way to get similar behaviour with the APIs that are currently available for static_multimap? Specifically, suppose we have a
Given a list of keys (e.g.
This could be done using a for_each API by first zero-initializing a result array and a count array with the same number of elements as there are keys, then accumulating the sum and count into each of them respectively, and finally dividing element-wise. With the existing APIs, would the approach be to first count the total number of values associated with the keys (
Afterwards, the same sum and count accumulators could be used to compute the required average. Does this method seem reasonable? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Yes, absolutely. Here's an example that may help simplify the work: https://godbolt.org/z/Weoj8WKba. The build error will be gone once #529 gets merged. I was trying to fuse the "retrieve" and "count" operations into one kernel for better performance but then realized some desired APIs like In the meantime, we are deprecating the legacy multimap and the new one will be shipping out in the next month or two. With the new multimap, features like |
Beta Was this translation helpful? Give feedback.
-
Note that we also have a new feature called |
Beta Was this translation helpful? Give feedback.
Yes, absolutely. Here's an example that may help simplify the work: https://godbolt.org/z/Weoj8WKba. The build error will be gone once #529 gets merged.
I was trying to fuse the "retrieve" and "count" operations into one kernel for better performance but then realized some desired APIs like
view::initial_slot
are not publicly available. Sorry for the inconvenience.In the meantime, we are deprecating the legacy multimap and the new one will be shipping out in the next month or two. With the new multimap, features like
for_each
are exposed to the public and writing your custom kernel doing sum reduction will become possible. Stay tuned.