Full text
CAMP First GPU Solver: A Solution to Accelerate Chemistry in Atmospheric Models Christian Guzman-Ruiz, Mario Acosta, Oriol Jorba Barcelona Supercomputing Center, Barcelona, Spain E-mail: {christian.guzman, mario.acosta, oriol.jorba}@bsc.es Keywords—Parallelism and concurrency, ODE solver, Chemistry software, Performance I. EXTENDED ABSTRACT Atmospheric models are a representation of dynamical, physical, chemical, dynamical, and radiative processes in the atmosphere [1]. The load of these models is often spread across multiple processes in HPC environments. Most of this load comes from the resolution of chemical processes, which can take up to 90% of the total time execution [2]. Recent studies reported a relevant speedup by translating a chemical module to GPUs [3] [4]. This study is based in some previous works of the authors. These works are tested in the Chemistry Accross Multiple Phases (CAMP) module [5] simulating the conditions of an atmospheric model experiment. In our first approach we present an strategy to efficiently integrate GPU routines without needing to translate the entire chemical module to GPU code [6]. In our second and last work, we integrated a GPU version of the linear solver used in CAMP and evaluated multiple kernel configurations, achieving up to 34x speedup from the base CPU linear solver in a singlethread execution, in addition to a 2.7x for an equivalent MPI implementation with the maximum number of physical cores available on a node (40) [7]. The main objective of this work is to develop a GPU version of the entire CAMP solving algorithm. Our second objective is to evaluate the performance of our work, comparing the results with other state of the art GPU chemical modules. A. CAMP solving algorithm We will refer to the system of equations formed by the chemical processes as cells, in reference to the discretization in space grid-cells of the atmospheric model [1]. CAMP uses the CVODE package to solve these cells. CVODE is defined as a solver for stiff and nonstiff ordinary differential equation (ODE) systems (initial value problem) [8]. It includes different algorithms options depending on the user choice. For our case, CAMP uses the Backward Differentiation Formula (BDF) and the KLU linear solver as the default solving options. These options are configured for a single-thread CPU execution. In addition, CAMP includes the Biconjugate gradient (BCG) linear solver for GPU execution as an alternative to the CPU option, thanks to an earlier work of the authors [7]. In this work we use the parallelization strategy with the highest speedup obtained in the linear solver study [7], named as Block-cells (1). With it, we configure the GPU kernel as follows: The number of blocks is equal to the number of cells, and the threads per block are as many as the concentrations of different chemical species in each cell. In this way, each cell is independent of each other, and we avoid any communication between GPU blocks, which is usually very computationally expensive [9]. Similarly, we take advantage of some basic functions developed for BCG, such as array multiplication or array reduction to a single value. B. Experimental environment All the tests and executions were performed in the CTEPOWER cluster provided by the Barcelona Supercomputing Center (BSC) [10]. The chemical configuration corresponds to the Carbon Bond 2005 (CB05) mechanism [11] [12] and fixed photolysis reaction rates during time. The initial conditions such as species concentration, temperature and pressure are extracted from an experiment on the Multiscale Online Nonhydrostatic AtmospheRe CHemistry (MONARCH) model [13] [14]. The values are extracted at the first iteration just before calling the chemical module, therefore it corresponds with the initial conditions on the atmosphere after the transformations previous to the chemistry. The source code and configuration files are available in the CAMP repository [15] in the test monarch folder. C. Results We obtain up to 36x speedup from the single-thread base version, plus up to 3x speedup against an equivalent MPI implementation with the maximum number of physical cores available on a node (40). We achieve this maximum speedup at 10,000 cells, for greater number of cells the speedup is mostly equal. These speedups are very similar than the BCG speedup (up to 34x and 2.5x respectively) [7]. This indicates than the advantages of translating the BCG algorithm to GPU also applies to the BDF loop. The main advantage is the parallelism obtained, where each thread computes an operation of the species array. Most of the operations in the BDF loop corresponds to this type, either operating over two arrays or reducing an array to a single variable. Another advantage is the shared memory, which allows to fast communication between the threads of the same block. 49
D. Conclusion In this study, we present a GPU version of the BDF loop, which achieves up to 36x times faster than the base implementation. This speedup is very similar than the BCG speedup presented in a previous work [7]. Both cases has the similarity of being iterative algorithms and the same chemistry application. Therefore, we can expect a similar speedup for other chemical solving procedures following the GPU approach presented. However, the CAMP module has the aim to facilitate the coupling of new chemical mechanism. Therefore, we expect that the chemistry required by the users can be easily translated to CAMP, allowing to use the already developed GPU version. In a future work we plan to combine this GPU approach with the CPU implementation, dividing the work between CPU and GPU and evaluating load balancing strategies between these two architectures. II. ACKNOWLEDGMENT This work was partially supported by funding from the Ministerio de Ciencia, Innovaci´ on y Universidades as part of the BROWNING project (RTI2018-099894-BI00), the CAROL project (PID2020-113614RB-C21), and the AXA Research Fund through the AXA Chair on Sand and Dust Storms established at BSC. This work has also received funding from ”Future of Computing Center, a Barcelona Supercomputing Center and IBM initiative (2020)”. This paper expresses the opinions of the authors and not necessarily those of the funding commissions. The computing experiments of this paper have been performed on the resources of the Barcelona Supercomputing Center. REFERENCES [1] M. Z. Jacobson, “Fundamentals of Atmospheric Modeling, Second Edition,” p. 437. [2] M. Christou, T. Christoudias, J. Morillo, D. Alvarez, and H. Merx, “Earth system modelling on system-level heterogeneous architectures: EMAC (version 2.42) on the Dynamical Exascale Entry Platform (DEEP),” Geoscientific Model Development, vol. 9, no. 9, pp. 3483– 3491, Sep. 2016, publisher: Copernicus GmbH. [Online]. Available: https://gmd.copernicus.org/articles/9/3483/2016/ [3] M. Alvanos and T. Christoudias, “GPU-accelerated atmospheric chemical kinetics in the ECHAM/MESSy (EMAC) Earth system model (version 2.52),” Geoscientific Model Development, vol. 10, no. 10, pp. 3679–3693, Oct. 2017. [Online]. Available: https://www.geosci-model- dev.net/10/3679/2017/ [4] K. E. Niemeyer and C.-J. Sung, “Accelerating moderately stiff chemical kinetics in reactive-flow simulations using GPUs,” Journal of Computational Physics, vol. 256, pp. 854–871, Jan. 2014, arXiv: 1309.2710. [Online]. Available: http://arxiv.org/abs/1309.2710 [5] M. L. Dawson, C. Guzman, J. H. Curtis, M. Acosta, S. Zhu, D. Dabdub, A. Conley, M. West, N. Riemer, and O. Jorba, “Chemistry Across Multiple Phases (CAMP) version 1.0: An integrated multi-phase chemistry model,” arXiv:2111.07436 [physics], Nov. 2021, arXiv: 2111.07436. [Online]. Available: http://arxiv.org/abs/2111.07436 [6] C. Guzman-Ruiz, M. C. Acosta, M. Dawson, O. Jorba, C. P´ erez, and K. Serradell, “Accelerating Chemistry Modules in Atmospheric Models using GPUs,” 2021, the 2020 International Conference on High Performance Computing & Simulation (HPCS 2020). [7] ——, “Studying a new GPU treatment for chemical modules inside CAMP,” Sep. 2021. [Online]. Available: https://events.ecmwf.int/event/169/timetable/ [8] “CVODE |Computing.” [Online]. Available: https://computing.llnl.gov/projects/sundials/cvode [9] S. Xiao and W. Feng, “Inter-block GPU communication via fast barrier synchronization,” in 2010 IEEE International Symposium on Parallel Distributed Processing (IPDPS), Apr. 2010, pp. 1–12, iSSN: 1530-2075. [10] “Support Knowledge Center @ BSC-CNS.” [Online]. Available: https://www.bsc.es/user-support/power.php [11] G. Yarwood, S. Rao, M. Yocke, and G. Whitten, “Updates to the Carbon Bond Chemical Mechanism: CB05. Final Report to the US EPA, RT- 0400675,” 2005. [12] G. Sarwar, H. Simon, P. Bhave, and G. Yarwood, “Examining the impact of heterogeneous nitryl chloride production on air quality across the united states,” Atmospheric Chemistry and Physics, vol. 12, no. 14, pp. 6455–6473, 2012. [Online]. Available: https://acp.copernicus.org/articles/12/6455/2012/ [13] C. P´ erez, K. Haustein, Z. Janjic, O. Jorba, N. Huneeus, J. M. Baldasano, T. Black, S. Basart, S. Nickovic, R. L. Miller, J. P. Perlwitz, M. Schulz, and M. Thomson, “Atmospheric dust modeling from meso to global scales with the online NMMB/BSC-Dust model – Part 1: Model description, annual simulations and evaluation,” Atmospheric Chemistry and Physics, vol. 11, no. 24, pp. 13 001–13 027, Dec. 2011. [Online]. Available: https://www.atmos-chem-phys.net/11/13001/2011/ [14] O. Jorba, D. D, B.-B. C, C. P´ erez Garc´ ıa-Pando, Z. Janjic, J. Baldasano, M. Spada, A. Badia, and M. Gonc¸alves Ageitos, “Potential significance of photoexcited NO2 on global air quality with the NMMB/BSC chemical transport model,” Journal of Geophysical Research D: Atmospheres, vol. 117, p. D13301, Jul. 2012. [15] “CAMP,” Nov. 2021, original-date: 2021-07-28T14:31:48Z. [Online]. Available: https://github.com/open-atmos/camp Christian Guzman received his Bachelor’s degree in Computer Engineering plus a bachelor’s degree in Telecommunication Electronic Engineering, and a Master in Modelling for Science and Engineering by the Autonomous university of Barcelona (UAB). He specialized in techniques for High-Performance Computing (HPC) and is actually developing his pre-doctoral studies on the Barcelona Supercomputing Center (BSC), working on the development of Chemistry Across Multiple Phases (CAMP) module alongside the Multiscale Online Nonhydrostatic Atmosphere Chemistry Model (MONARCH), contributing to the mostcomputational and logic part from a performance point of view and integrating multitudinal ways of GPU computation in search of speeding-up the system. 50