We employ compact hashing and the discrete properties of computational meshes to optimize spatial operations in scientific computing applications. Our target is to develop highly parallel compact hashing methods suitable for the fine-grained parallelism of GPU and MIC architectures that will scale to the next generation of computing systems. As a model, we apply spatial hashing methods to the problem of determining neighbor elements in adaptive mesh refinement (AMR) schemes. By applying memory savings techniques, we extend the perfect spatial hash algorithm to a compact hash by compressing the resulting sparse data structures. Using compact hashing and specific memory optimizations, we increase the range of problems that can benefit from our ideal $O(n)$ algorithms. The spatial hash methods are tested and compared across a variety of architectures on both a randomly generated sample mesh and an existing cell-based AMR shallow-water hydrodynamics scheme. We demonstrate consistent speed-up and increased performance across every device tested and explore the ubiquitous application of spatial hashing in scientific computing.


  1. hashing
  2. compact hash
  3. parallel computing
  4. AMR
  5. GPU
  6. cell-based adoptive mesh refinement

MSC codes

  1. 68W10
  2. 68Q85
  3. 68Q25
  4. 65K05

Get full access to this article

View all available purchase options and get full access to this article.

Supplementary Material

PLEASE NOTE: These supplementary files have not been peer-reviewed.

Index of Supplementary Materials

Title of paper: Parallel Compact Hash Algorithms for Computational Meshes

Authors: Tumblin, R., Ahrens, W., Hartse, S., and Robey, R.W.

File: compacthash-v1.1.zip

Type: Compressed File

Contents: Source code used for article

Justification: The source code has been released under the Apache open-source license so SIAM readers can reproduce the work from the article and extend it in the future. This snapshot was used to obtain the published results.


D. A. Alcantara, Efficient Hash Tables on the GPU, Ph.D. thesis, Department of Computer Science, University of California, Davis, Davis, CA, 2011.
D. A. Alcantara, A. Sharf, F. Abbasinejad, S. Sengupta, M. Mitzenmacher, J. D. Owens, and N. Amenta, Real-time parallel hashing on the GPU, ACM Trans. Graph., 28 (2009), 154.
J. R Bell, The quadratic quotient method: A hash code eliminating secondary clustering, Comm. ACM, 13 (1970), pp. 107--109.
M. J. Berger and J. Oliger, Adaptive mesh refinement for hyperbolic partial differential equations, J. Comput. Phys., 53 (1984), pp. 484--512.
R. P. Brent, Reducing the retrieval time of scatter storage techniques, Comm. ACM, 16 (1973), pp. 105--109.
J. L. Carter and M. N. Wegman, Universal classes of hash functions, J. Comput. System Sci., 18 (1979), pp. 143--154.
Z. J. Czech, G. Havas, and B. S. Majewski, Perfect hashing, Theoret. Comput. Sci., 182 (1997), pp. 1--143.
S. F. Davis, A simplified TVD finite difference scheme via artificial viscosity, SIAM J. Sci. Statist. Comput., 8 (1987), pp. 1--18.
D. DeZeeuw and K. G. Powell, An adaptively refined Cartesian mesh solver for the Euler equations, J. Comput. Phys., 104 (1993), pp. 56--68.
H. Gao, J. F. Groote, and W. H Hesselink, Efficient Almost Wait-Free Parallel Accessible Dynamic Hashtables, Technical report, CS-Report 03-03, Eindhoven University of Technology, Eindhoven, The Netherlands, 2003.
H. Ji, F.-S. Lien, and E. Yee, A new adaptive mesh refinement data structure with an application to detonation, J. Comput. Phys., 229 (2010), pp. 8981--8993.
A. M. Khokhlov, Fully threaded tree algorithms for adaptive refinement fluid dynamics simulations, J. Comput. Phys., 143 (1998), pp. 519--543.
D. E. Knuth, The Art of Computer Programming, Volume 3: Sorting and Searching, Addison-Wesley, Reading, MA, 1973.
L. D. Landau and E. M. Lifshitz, Fluid Mechanics, Course of Theoretical Physics 6, Pergamon Press, Oxford, UK, 1987.
P. Lax and B. Wendroff, Systems of conservation laws, Comm. Pure Appl. Math., 13 (1960), pp. 217--237.
W. D. Maurer, Programming technique: An improved hash code for scatter storage, Comm. ACM, 11 (1968), pp. 35--38.
M. Mitzenmacher and S. Vadhan, Why simple hash functions work: Exploiting the entropy in a data stream, in Proceedings of the Nineteenth Annual ACM-SIAM Symposium on Discrete Algorithms, ACM, New York, SIAM, Philadelphia, 2008, pp. 746--755.
J. K. Mullin, A caution on universal classes of hash functions, Inform. Process. Lett., 37 (1991), pp. 247--256.
J. I. Munro and P. Celis, Techniques for collision resolution in hash tables with open addressing, in Proceedings of the 1986 ACM Fall Joint Computer Conference, IEEE Computer Society Press, Los Alamitos, CA, 1986, pp. 601--610.
D. Nicholaeff, N. Davis, D. Trujillo, and R. W. Robey, Cell-Based Adaptive Mesh Refinement Implemented with General Purpose Graphics Processing Units, Technical Report LA-UR-11-07127, Los Alamos National Laboratory, Los Alamos, NM, 2011.
W. W. Peterson, Addressing for random-access storage, IBM J. Res. Dev., 1 (1957), pp. 130--146.
F. Proth, Théorèmes sur les nombres premiers, C.R. Acad. Sci. Paris, 85 (1878), p. 926.
R. N. Robey, D. Nicholaeff, and R. W. Robey, Hash-based algorithms for discretized data, SIAM J. Sci. Comput., 35 (2013), pp. C346--C368.
F. A. Williams, Handling identifiers as internal symbols in language processors, Comm. ACM, 2 (1959), pp. 21--24.
H. C. Yee, Construction of explicit and implicit symmetric TVD schemes and their applications, J. Comput. Phys., 68 (1987), pp. 151--179.
D. P. Young, R. G. Melvin, M. B. Bieterman, F. T. Johnson, S. S. Samanth, and J. E. Bussoletti, A locally refined finite rectangular grid finite element method: Application to computational fluid dynamics and computational physics, J. Comput. Phys., 92 (1991), pp. 1--66.

Information & Authors


Published In

cover image SIAM Journal on Scientific Computing
SIAM Journal on Scientific Computing
Pages: C31 - C53
ISSN (online): 1095-7197


Submitted: 20 August 2013
Accepted: 20 October 2014
Published online: 20 January 2015


  1. hashing
  2. compact hash
  3. parallel computing
  4. AMR
  5. GPU
  6. cell-based adoptive mesh refinement

MSC codes

  1. 68W10
  2. 68Q85
  3. 68Q25
  4. 65K05



Metrics & Citations



If you have the appropriate software installed, you can download article citation data to the citation manager of your choice. Simply select your manager software from the list below and click Download.

Cited By







Copy the content Link

Share with email

Email a colleague

Share on social media

The SIAM Publications Library now uses SIAM Single Sign-On for individuals. If you do not have existing SIAM credentials, create your SIAM account https://my.siam.org.