Computational simulation using particles on GPU and GLSL language
Authors
-
Aleksei V. Ozeritskii
Keywords:
particles simulation
parallel programming
N body problem
GLSL language
Vulkan API
Poisson equation
Abstract
The N-body problem simulation using PM and P3M algorithms is provided. A GPU implementation of an algorithm using compute shaders is provided. This algorithm uses the CPU for synchronizing and launching the shaders only, whereas it does not contain computational parts implemented on the CPU. That also includes no data copying between the GPU and CPU. Parallel algorithms for placing particles in grid cells and mass distribution in grid nodes are presented. The algorithms are based on parallel construction of linked lists corresponding to grid cells. The algorithms are completely parallel and do not contain sequential parts. Some calculations are done in a vertex shader to compute simultaneously with visualization. This was done with the help of shader buffer objects as well as specially prepared data instead of vertices as vertex shader input. The results of the numerical calculations using galaxy cluster formation based on a flat expanding Friedmann model universe are presented as an example. A cube with periodic boundary conditions on all axes was used as an example of a model universe. The maximum particle amount used in calculations is 108. The modern cross platform API Vulkan and GLSL language were used for simulation purposes. The numerical calculations are compared using the Apple M1 and Ryzen 3700X processors, with the results using regular video cards — Apple M1 and NVIDIA RTX 3060. The parallel algorithm for the CPU is implemented using OpenMP. Algorithmic efficiency is compared to the results by other authors. The results of the algorithm are compared to the results of other authors, and the qualitative results and execution time are also compared. A comparison of the running time of programs for the GPU with a similar cluster program with many nodes is given.
Section
Parallel software tools and technologies
Author Biography
Aleksei V. Ozeritskii
Yandex
• principal software engineer;
Gymnasium of Moscow State University
• teacher
References
- R. W. Hockney and J. W. Eastwood, Computer Simulation Using Particles (McGraw-Hill, New York, 1981).
- J. Harnois-Déraps, U.-L. Pen, I. T. Iliev, et al., “High-Performance P^3M N-Body Code: CUBEP^3M,” Mon. Not. R. Astron. Soc. 436 (1), 540-559 (2013).
doi 10.1093/mnras/stt1591.
- P. E. Kyziropoulos, C. K. Filelis-Papadopoulos, and G. A. Gravvanis, “Parallel N-Body Simulation Based on the PM and P3M Methods Using Multigrid Schemes in Conjunction with Generic Approximate Sparse Inverses,” Math. Probl. Eng. 2015, Article ID 450980 (2015).
doi 10.1155/2015/450980.
- J. S. Bagla, “TreePM: A Code for Cosmological N-Body Simulations,” J. Astrophys. Astr. 23, 185-196 (2002).
doi 10.1007/BF02702282.
- K. Xu and Y. Jing, “An Accurate P^3M Algorithm for Gravitational Lensing Studies in Simulations,” Astrophys. J. 915 (2) (2021).
doi 10.3847/1538-4357/ac0249.
- G. L. Bryan, M. L. Norman, B. W. O’Shea, et al., “ENZO: An Adaptive Mesh Refinement Code for Astrophysics,” Astrophys. J. Suppl. 211 (2), Article ID 19 (2014).
doi 10.1088/0067-0049/211/2/19.
- The Source Code of PM, PTM, GPU Version.
https://github.com/resetius/graphtoys . Cited December 26, 2022.
- The Source Code of PM, PTM, CPU Version.
https://github.com/resetius/fdm . Cited December 26, 2022.
- A. A. Samarskii and E. S. Nikolaev, Numerical Methods for Grid Equations (Nauka, Moscow, 1978; Birkh854user, Basel, 1989).
- L. Verlet, “Computer ‘Experiments’ on Classical Fluids. I. Thermodynamical Properties of Lennard-Jones Molecules,” Phys. Rev. 159 (1), 98-103 (1967).
- P. P. Ewald, “Die Berechnung Optischer und Elektrostatischer Gitterpotentiale,” Annalen der Physik 369 (3), 253-287 (1921).
doi 10.1002/andp.19213690304.
- D. S. Gorbunov and V. A. Rubakov, Introduction to the Theory of the Early Universe: Hot Big Bang Theory (URSS, Moscow, 2008; World Scientific, Singapore, 2011).
- G. G. Byrd, A. D. Chernin, and M. J. Valtonen, Cosmology: Foundations and Frontiers (URSS, Moscow, 2007).
- A. N. Tikhonov and A. A. Samarskii, Equations of Mathematical Physics (Nauka, Moscow, 2004; Dover Publications, New York, 2013).
- D. Wolf, OpenGL 4. Shading Language Cookbook (Packt Publishing, Birmingham, 2018).
- L. Nyland, M. Harris, and J. Prins, “Fast N-Body Simulation with CUDA,” in GPU Gems 3
https://developer.nvidia.com/gpugems/gpugems3/part-v-physics-simulation/chapter-31-fast-n-body-simulation-cuda . Cited December 28, 2022.
- A. V. Boreskov and A. A. Harlamov, Basics with CUDA Technology (DMK Press, Moscow, 2019) [in Russian].
- Y. Miki and M. Umemura, “MAGI: Many-Component Galaxy Initializer,” Mon. Not. R. Astron. Soc. 475 (2), 2269-2281 (2018).
doi 10.1093/mnras/stx3327.
- A. Petitet, R. C. Whaley, J. Dongarra, and A. Cleary, “HPL -- A Portable Implementation of the High-Performance Linpack Benchmark for Distributed-Memory Computers,”
https://netlib.org/benchmark/hpl/. Cited July 21, 2022.
- Apple Accelerate.
https://developer.apple.com/documentation/accelerate . Cited December 27, 2022.
- Atlas Library.
http://math-atlas.sourceforge.net . Cited December 27, 2022.
- Apple M1 Performance in Teraflops.
https://www.ixbt.com/news/2021/02/18/soc-apple-m1x-geforce-gtx-1070.html [in Russian]. Cited December 27, 2022.
- Radeon RX6600XT Specifications.
https://www.techpowerup.com/gpu-specs/radeon-rx-6600-xt.c3774 . Cited December 27, 2022.
- GeForce RTX3060 Specifications.
https://www.techpowerup.com/gpu-specs/geforce-rtx-3060.c3682 . Cited December 27, 2022.
- Radeon RX6800XT Specifications.
https://www.techpowerup.com/gpu-specs/radeon-rx-6800-xt.c3694 . Cited December 27, 2022.
- GeForce RTX3080 Specifications.
https://www.techpowerup.com/gpu-specs/geforce-rtx-3080.c3621 . Cited December 27, 2022.