Edward Buckland, Vinh Phu Nguyen, Alban de Vaucorbeil
{"title":"Easily porting material point methods codes to GPU","authors":"Edward Buckland, Vinh Phu Nguyen, Alban de Vaucorbeil","doi":"10.1007/s40571-024-00768-1","DOIUrl":null,"url":null,"abstract":"<div><p>The material point method (MPM) is computationally costly and highly parallelisable. With the plateauing of Moore’s law and recent advances in parallel computing, scientists without formal programming training might face challenges in developing fast scientific codes for their research. Parallel programming is intrinsically different to serial programming and may seem daunting to certain scientists, in particular for GPUs. However, recent developments in GPU application programming interfaces (APIs) have made it easier than ever to port codes to GPU. This paper explains how we ported our modular C++ MPM code <span>Karamelo</span> to GPU without using low-level hardware APIs like CUDA or OpenCL. We aimed to develop a code that has abstracted parallelism and is therefore hardware agnostic. We first present an investigation of a variety of GPU APIs, comparing ease of use, hardware support and performance in an MPM context. Then, the porting process of <span>Karamelo</span> to the Kokkos ecosystem is detailed, discussing key design patterns and challenges. Finally, our parallel C++ code running on GPU is shown to be up to 85 times faster than on CPU. Since Kokkos also supports Python and Fortran, the principles presented therein can also be applied to codes written in these languages.</p></div>","PeriodicalId":524,"journal":{"name":"Computational Particle Mechanics","volume":"11 5","pages":"2127 - 2142"},"PeriodicalIF":2.8000,"publicationDate":"2024-06-05","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://link.springer.com/content/pdf/10.1007/s40571-024-00768-1.pdf","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Computational Particle Mechanics","FirstCategoryId":"5","ListUrlMain":"https://link.springer.com/article/10.1007/s40571-024-00768-1","RegionNum":3,"RegionCategory":"工程技术","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"MATHEMATICS, INTERDISCIPLINARY APPLICATIONS","Score":null,"Total":0}
引用次数: 0
Abstract
The material point method (MPM) is computationally costly and highly parallelisable. With the plateauing of Moore’s law and recent advances in parallel computing, scientists without formal programming training might face challenges in developing fast scientific codes for their research. Parallel programming is intrinsically different to serial programming and may seem daunting to certain scientists, in particular for GPUs. However, recent developments in GPU application programming interfaces (APIs) have made it easier than ever to port codes to GPU. This paper explains how we ported our modular C++ MPM code Karamelo to GPU without using low-level hardware APIs like CUDA or OpenCL. We aimed to develop a code that has abstracted parallelism and is therefore hardware agnostic. We first present an investigation of a variety of GPU APIs, comparing ease of use, hardware support and performance in an MPM context. Then, the porting process of Karamelo to the Kokkos ecosystem is detailed, discussing key design patterns and challenges. Finally, our parallel C++ code running on GPU is shown to be up to 85 times faster than on CPU. Since Kokkos also supports Python and Fortran, the principles presented therein can also be applied to codes written in these languages.
期刊介绍:
GENERAL OBJECTIVES: Computational Particle Mechanics (CPM) is a quarterly journal with the goal of publishing full-length original articles addressing the modeling and simulation of systems involving particles and particle methods. The goal is to enhance communication among researchers in the applied sciences who use "particles'''' in one form or another in their research.
SPECIFIC OBJECTIVES: Particle-based materials and numerical methods have become wide-spread in the natural and applied sciences, engineering, biology. The term "particle methods/mechanics'''' has now come to imply several different things to researchers in the 21st century, including:
(a) Particles as a physical unit in granular media, particulate flows, plasmas, swarms, etc.,
(b) Particles representing material phases in continua at the meso-, micro-and nano-scale and
(c) Particles as a discretization unit in continua and discontinua in numerical methods such as
Discrete Element Methods (DEM), Particle Finite Element Methods (PFEM), Molecular Dynamics (MD), and Smoothed Particle Hydrodynamics (SPH), to name a few.