Skip to content

Count method in static_multimap returning 0 #421

Answered by PointKernel
sarda-devesh asked this question in Q&A
Discussion options

You must be logged in to vote

OK, so there are two issues in the code:

  1. As mentioned by @sleeepyjack, the CG count function returns a per-thread count thus it's users' responsibility to sum up all threads within a CG to get the final per-CG count.
  2. The idea of CG insert/query is to utilize multiple threads performing hash map operations for one input key element. In your sample code, e.g., when map cg_size == 8 (default value for multimap), we are supposed to use the first tile (thread 0, 1, 2, ... 7) to insert the first pair {0, 0} and the second tile (thread 8, 9, 10, ... 15) to insert {1, 1} as opposed to thread 0 of tile 0 inserting {0, 0} and thread 1 of tile 0 inserting {1, 1}. That's an undefined behavior.

As e…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@sarda-devesh
Comment options

@PointKernel
Comment options

Answer selected by PointKernel
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@PointKernel
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants