RUS  ENG
Full version
JOURNALS // Numerical methods and programming // Archive

Num. Meth. Prog., 2023 Volume 24, Issue 1, Pages 37–54 (Mi vmp1073)

Parallel software tools and technologies

Computational simulation using particles on GPU and GLSL language

Aleksei V. Ozeritskiiab

a Yandex, Moscow, Russia
b Gymnasium of Moscow State University, Moscow, Russia

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.

Keywords: particles simulation, parallel programming, N body problem, GLSL language, Vulkan API, Poisson equation.

UDC: 519.688

Received: 07.10.2022
Accepted: 21.12.2022

DOI: 10.26089/NumMet.v24r104



© Steklov Math. Inst. of RAS, 2025