An Efficient Algorithm for Astrochemical Systems Using Stoichiometry Matrices

Kazutaka Motoyama,Ruben Krasnopolsky,Hsien Shang,Kento Aida,Eisaku Sakane
2023-12-08
Abstract:Astrochemical simulations are a powerful tool for revealing chemical evolution in the interstellar medium. Astrochemical calculations require efficient processing of large matrices for the chemical networks. The large chemical reaction networks often present bottlenecks for computation because of time derivatives of chemical abundances. We propose an efficient algorithm using a stoichiometry matrix approach in which this time-consuming part is expressed as a loop, unlike the algorithm used in previous studies. Since stoichiometry matrices are sparse in general, the performances of simulations with our algorithm depend on which sparse-matrix storage format is used. We conducted a performance comparison experiment using the common storage formats, including the coordinate (COO) format, the compressed column storage (CCS) format, the compressed row storage (CRS) format, and the Sliced ELLPACK (SELL) format. Experimental results showed that the simulations with the CRS format are the most suitable for astrochemical simulations and about three times faster than those with the algorithm used in previous studies. In addition, our algorithm significantly reduces not only the computation time but also the compilation time. We also explore the beneficial effects of parallelization and sparse-matrix reordering in these algorithms.
Instrumentation and Methods for Astrophysics
What problem does this paper attempt to address?
The problem that this paper attempts to solve is to improve the efficiency of reaction network calculations in astrochemical simulations. Specifically, astrochemical simulations need to handle the time derivatives of large - scale chemical networks, which are usually the bottleneck in calculations. To overcome this challenge, the authors propose a new algorithm based on the stoichiometry matrix, representing the time - consuming part as a loop structure, which is different from previous research methods. ### Main problems 1. **Low computational efficiency**: In traditional astrochemical simulations, when dealing with large - scale chemical reaction networks, the need to frequently calculate the time derivatives of chemical abundances leads to low computational efficiency. 2. **Selection of sparse matrix storage formats**: Chemical reaction networks are usually very sparse, and choosing an appropriate sparse matrix storage format can significantly improve computational efficiency. 3. **Influence of parallelization and matrix re - ordering**: Research on the influence of parallelization techniques and sparse matrix re - ordering on computational performance to further optimize the algorithm. ### Solutions - **New algorithm**: Use the stoichiometry matrix method to represent the part of calculating time derivatives as a loop structure, thereby improving computational efficiency. - **Comparison of sparse matrix storage formats**: Through experiments, common sparse matrix storage formats (such as the coordinate format COO, compressed column storage CCS, compressed row storage CRS, and sliced ELLPACK SELL) were compared, and it was found that the CRS format is most suitable for astrochemical simulations and is approximately three times faster than traditional methods. - **Parallelization and matrix re - ordering**: The beneficial effects of parallelization techniques and sparse matrix re - ordering on algorithm performance were explored, further increasing the calculation speed. ### Results The experimental results show that the new algorithm using the CRS format and SIMD instruction set performs well in both serial and parallel calculations, significantly reducing the calculation time and compilation time. In particular, the CRS format after row re - ordering combined with SIMD operations has an execution time 6.91 times faster than the default KROME settings. ### Summary The new algorithm proposed in this paper significantly improves the computational efficiency of astrochemical simulations by optimizing the sparse matrix storage format and using the SIMD instruction set of modern CPUs. In addition, this algorithm also greatly reduces the compilation time, is easy to implement, and can improve existing simulation codes.