A Note on Time Measurements in LAMMPS

Daniel Tameling,Paolo Bientinesi,Ahmed E. Ismail
DOI: https://doi.org/10.48550/arXiv.1602.05566
2016-02-18
Abstract:We examine the issue of assessing the efficiency of components of a parallel program at the example of the MD package LAMMPS. In particular, we look at how LAMMPS deals with the issue and explain why the approach adopted might lead to inaccurate conclusions. The misleading nature of this approach is subsequently verified experimentally with a case study. Afterwards, we demonstrate how one should correctly determine the efficiency of the components and show what changes to the code base of LAMMPS are necessary in order to get the correct behavior.
Materials Science,Computational Engineering, Finance, and Science,Chemical Physics,Computational Physics
What problem does this paper attempt to address?
The paper attempts to address the challenges encountered in evaluating the efficiency of components in parallel programs, specifically for the molecular dynamics (MD) simulation package LAMMPS. Specifically, the authors point out that the method LAMMPS uses for time measurement may lead to inaccurate conclusions and experimentally verify the misleading nature of this method. The main goal of the paper is to raise awareness in the molecular dynamics community about the correct measurement of time in parallel applications and to propose a correct method for evaluating the efficiency of parallel components. ### Main Issues of the Paper 1. **Challenges in Evaluating the Efficiency of Parallel Program Components**: - In serial applications, the efficiency of components can be directly measured by the wall-clock time they consume. - In parallel applications, each process has different time consumption, so representative efficiency information needs to be extracted from a large amount of data. 2. **Issues with LAMMPS's Time Measurement Method**: - LAMMPS evaluates the efficiency of components by averaging the time of each process. - This method may lead to misleading conclusions because the average value may be lower than the actual time consumption. 3. **Experimental Verification**: - The authors verified the inaccuracy of LAMMPS's time measurement method through two test systems (uniformly distributed and non-uniformly distributed particle systems). - The experimental results show that even in the best-case scenario, using the average value to evaluate performance is inappropriate. 4. **Correct Evaluation Method**: - Use the maximum value of all process times to evaluate the efficiency of components. - This method showed efficiency predictions consistent with expectations in experiments and aligned with the total runtime. ### Solution - **Code Modification**: - Modify a few lines of code in LAMMPS's `finish.cpp` file, replacing the `MPI_SUM` used for calculating the average with `MPI_MAX` for calculating the maximum value. - Remove the division operation by the number of processes. - **Considerations**: - When using the maximum value, the sum of the maximum values of all components will usually be greater than the total execution time. - Therefore, when reporting time, the total execution time should be reported in addition to the time of each component for a more comprehensive performance evaluation. ### Conclusion Through theoretical analysis and experimental verification, the paper points out the shortcomings of the current time measurement method in LAMMPS and proposes using the maximum value to evaluate the efficiency of parallel components. This not only helps to raise awareness in the molecular dynamics community about time measurement but also provides valuable references for other research fields using parallel programs.