cuda::experimental::places::compute_block_owners#

template<typename OwnerFn>
::std::vector<pos4> cuda::experimental::places::compute_block_owners(
OwnerFn &&owner_of,
size_t nblocks,
size_t block_size_bytes,
size_t elemsize,
size_t total_elems,
size_t probes,
localized_stats &stats
)#

Decide the owner of each placement block by sampled majority vote.

For each block, probes elements are sampled (reproducibly: one seeded generator for the whole computation) and the most frequent owner wins. The majority vote is what tolerates partitions whose boundaries do not align with the block granularity: a block straddling two owners goes to the one owning most of it.

Parameters:
  • owner_of – Callable mapping a linear element index to the pos4 of its owner in the grid

  • nblocks – Number of placement blocks

  • block_size_bytes – Size of a placement block in bytes (must be at least elemsize)

  • elemsize – Size of one element in bytes (must be at least 1)

  • total_elems – Total number of elements (probes are clipped to it)

  • probes – Number of samples per block

  • stats – Accumulates total/matching sample counts