Running examples/benchmarks within LAMMPS distribution: WRONG RESULTS under OpenMP

Running examples/benchmarks within LAMMPS distribution: WRONG RESULTS UNDER OPENMP

version: LAMMPS/29Sep2021-foss-2021a-Python-3.9.5-kokkos (easybuild HPC installation) LAMMPS (29 Sep 2021 - Update 3)

architecture: skylake ; os: CentOS 7.9.2009

specific case computed from examples/comb directory: Cu2O elastic constants

Five different computation modes have been used for the calculation:

  1. Serial (lmp),

  2. MPI (mpirun lmp),

  3. OpenMP (lmp -sf omp),

  4. Hybrid using all the correct options in the manual (mpirun lmp -sf omp -pk omp NOMP)

  5. Hybrid after removing all options (mpirun lmp)

Please bear with me for using option five, which is against the instructions in the manual. I’ll show you its advantages below.

outcome:

option 1 (sequential), 2 (MPI) and 5 (hybrid without options) ARE CORRECT!

option 3 and option 4 ARE WRONG!

Please find enclosed five files containing the computed elastic constants.Each of them has been computed 10 times, seeking statistical evidence for “OpenMP racing” effects. There is no stastical uncertainty whatsoever (wrong hypothesis!). The main point is that only when the -sf omp option is used, the elastic constants are computed wrongly; so it seems

Please advise

regards

Manuel

PS I am happy to send inputs/outputs
hybno.txt (2.5 KB)
hybw.txt (2.5 KB)
mpi.txt (2.5 KB)
omp.txt (2.5 KB)
sequential.txt (2.5 KB)

Did some investigation on this:

  1. this issue also exists on 2Aug2023 (but really you should check by yourself to see if the newest version already has the bugfix…);
  2. there are large difference on c_fx[1] c_fx[2] c_fx[3] c_fx[4] c_fx[5] c_fx[6] (and other directions) between mpi only and OpenMP runs, while the energies are exactly same. So my guess is that the issue lies in the compute stress/atom for comb/omp;
  3. there are some changes in the format of log.lammps so that the elastic.f90 does not work out-of-the-box anymore. To workaround this I replaced all " Step Lx" with “Step Lx” in log.lammps before feeding it into that program.