ttadano / alamode

Ab initio simulator for thermal transport and lattice anharmonicity
http://sourceforge.net/projects/alamode
MIT License
132 stars 53 forks source link

Setting OMP_NUM_THREADS greater than 1 causes SCPH to stop converging for low compiler optimisation levels #44

Closed jonathanhunt-uoe closed 2 years ago

jonathanhunt-uoe commented 2 years ago

When using the SCPH mode with low compiler optimisation levels (O0 or O1), setting OMP_NUM_THREADS greater than 1 causes the PbTe example to not converge. This problem does not appear at higher optimisation levels (O2 and O3). The problem occurs both with and without MPI.

The problem has been reproduced using Intel icc/icpc versions 2021.1.1 and 2021.2.0, and for the GCC compiler version 9.3.0, as well as on two different machines.

Here are the outputs for the provided PbTe example using two different optimisation levels and different combinations of OpenMP and MPI (compiled using Intel 2021.2.0).

O0_scph_OMP1_MPI.txt O0_scph_OMP1_serial.txt O0_scph_OMP2_MPI.txt O0_scph_OMP2_serial.txt O2_scph_OMP1_MPI.txt O2_scph_OMP1_serial.txt O2_scph_OMP2_MPI.txt O2_scph_OMP2_serial.txt

ttadano commented 2 years ago

Thank you for reporting this bug. I could reproduce the non-converging behavior and fixed a bug in scph.cpp. The fixed version will soon be released as 1.3.0.