Skip to main content

C++ Parallel Algorithms for GPU Programming: A Case Study with the Lattice Boltzmann Method

Speaker: Jonas Latt, University of Geneva

Presentation

Seminar Slide Deck (PDF-2.3MB)

Abstract

Starting with C++17, the C++ standard offers a way to express multi-threaded parallelism implicitly in the form of parallel algorithms. With this formalism, some of the calls to algorithms of the C++ standard template library (STL) are executed on a given parallel platform, which is selected by the compiler and STL implementation. The approach does not rely on language extensions, external libraries, vendor-specific code annotations, or pre-compilation stages. It is also highly maintainable, as the same code can be compiled both for multi-core CPUs and for selected hardware accelerators, which include NVIDIA GPUs, thanks to the backend for parallel algorithms that was recently added to the NVC++ compiler. In this presentation, the principles of C++ parallel algorithms are explained, and the simple case of the 2D heat equation is used to showcase the application of this formalism to numerical algorithms. The presentation then carries on with an introduction to the STLBM, an open-source proof-of-principle implementation of lattice Boltzmann (LB) algorithms for fluid flow, based on parallel algorithms. It is shown that with a quite straightforward code, and without the use of any platform-specific techniques, performances close to the state-of-the-art are achieved on both homogeneous and heterogeneous multi-threaded platforms. It is for example shown that a complex, turbulent flow problem (a turbulent flow in a lid-driven 3D cavity) can be simulated at 73% of the peak performance (as prescribed by the memory bandwidth) of a NVIDIA A100 device, while an optimized CUDA reference implementation for the same problem reaches 84% of the peak performance. The approach is applied to a variety of modern LB collision models. The achieved performance on GPU is discussed and put in perspective with the type of improvements delivered by the models, mostly in terms of robustness.

Biography

Photo of Jonas Latt
Jonas Latt is Associate Professor at the computer science department of the University of Geneva (UNIGE). He obtained his Ph.D. degree on the topic of lattice Boltzmann modeling of fluid flow at the University of Geneva, Switzerland, in 2007, and since then pursued his academic career at Tufts University (Boston, USA), the Ecole Polytechnique Fèdèrale de Lausanne EPFL (Switzerland), and the UNIGE. His research focuses on computational fluid dynamics, cross-disciplinary modeling of complex systems, and high-performance computing. He is the original developer of the open-source software Palabos (www.palabos.org), a parallel lattice Boltzmann modeling tool which is widely used in the community.