SIParCS 2024 - Aditya Dendukuri
Refactoring the Photolysis Rates Calculator in C++: Performance Evaluation Using Standard Testing and Benchmarking Methodologies
Recorded Talk
Atmospheric chemistry is a key component in atmospheric modeling, with the calculation of photolysis rates being critical for accurate results. The Eddington algorithm computes the radiation field in the atmosphere by solving the radiative transfer equation, which is crucial in computing the photolysis rates. This project implemented the Eddington algorithm in C++ by refactoring the existing FORTRAN code used in TUV-x (https://github.com/NCAR/tuv-x) for verification. Additionally, we modularized the original extensive FORTRAN code into separate C++ functions and documented each function to enhance code maintainability, and unit test coverage.
A key aspect of the project involved implementing, testing, and benchmarking Thomas' algorithm for solving a tridiagonal linear system, identified as a performance bottleneck in the Eddington algorithm computations. We conducted a performance analysis on Derecho, comparing the naive implementation in the existing code with standard linear algebra libraries like LAPACKE. Based on the unit tests, we found that both the naive implementation and LAPACKE returned accurate results. Additionally, the naive implementation was more efficient than LAPACKE on the CPU (tested with GNU and Intel compilers) due to the absence of pivoting. Since pivoting is important to ensure stability by minimizing floating point errors, we conducted a stability analysis solely to study the tradeoff between efficiency and accuracy. Our methodology involved generating random matrices with specific condition numbers and evaluating the solver accuracy.
Mentors: Jian Sun, Matthew Dawson, Kyle Shores
Slides and poster