concept input mesh in category parallel computing

This is an excerpt from Manning's book Parallel and High Performance Computing.
We are not done yet with exploring hashing methods. The algorithms in the perfect hashing section can be greatly improved. The key observations are that we don’t need to write to every spatial hash bin, and we can improve the algorithms by handling collisions, thereby allowing the spatial hashes to be compressed and use less memory. This gives us more options on algorithm choice with different memory requirements and run times. We explored using compact hashes for the neighbor finding and the remap operations.
The previous simple perfect hash algorithm for neighbor finding performs well for small numbers of mesh refinement levels in an AMR mesh. But when there are six or more levels of refinement, a coarse cell will write to 64 hash buckets and a fine cell will only have to write to one, leading to a load imbalance and thread divergence problem for parallel implementations. We can improve the perfect hash algorithm further with the optimizations shown in figure 5.11. The first optimization is realizing that the neighbor queries will only sample the outer hash buckets of a cell, so there is no need to write to the interior. Further analysis shows that only the corners or mid-points of the cell’s representation in the hash will be queried, reducing the needed writes even further. The example shown to the far right of the sequence further optimizes the writes to only one per cell and does multiple reads for where the entry would be for a finer, same size, or coarser neighbor cell. This last technique does require initializing the hash table to a sentinel value such as -1 to indicate no entry.
Figure 5.11 Optimizing the neighbor finding calculation using the perfect spatial hash by reducing the number of writes and reads.
![]()
But now that less data is written to the hash, we have a lot of empty space, or sparsity, and can compress the hash table to as low as 1.25x times the number of entries, greatly reducing the memory requirements of the algorithm. The inverse of the size multiplier is known as the hash load factor and is defined as the number of filled hash table entries divided by the hash table size. For a 1.25 size multiplier, the hash load factor is 0.8. We typically use a much smaller load factor, typically around 0.333 or a size multiplier of 3. This is because in parallel processing, we want to avoid one processor being slower than the others. Hash sparsity represents the empty space in the hash. Sparsity indicates the opportunity for compression.