CPU vs GPU inconsistency in fix widom

Dear LAMMPS community,

I hope this was not brought forward before, my search failed to bring in any similar reports.

I’ve been trying to use fix widom command in the MC package. For benchmarking I tried MPI, single CPU and GPU runs. While I get exact same results with MPI vs single CPU, the results I get from the GPU version are quite different. Also, it can be noticed, while no permanent change should have been made to the system, significant changes in vdw and coulombic energies are apparent.

My lammps version for the attached log files is 27Oct21. I can confirm I got the same results for 7Jan22 and 3Nov22 versions.
in.h2mod (922 Bytes)
polymer.data (1.1 MB)
log.GPU (6.7 KB)
log.CPU (4.7 KB)

This is not a big surprise. With the GPU you need to exchange data between the host computer and the GPU. This requires precautions that are included when you do a “run” or “minimize” command. Commands like fix widom (or fix gcmc), however, perform additional force/energy calculations with modified geometries and thus would require to include the same kind of steps. This is a non-trivial step and it is not likely that the developers of such fixes were aware of those and familiar with how to handle this case. This is an unfortunate side effect of the modular nature of LAMMPS and the large number of features, since it is near impossible to check for and validate all permutations of features and functionality and insert tests to disallow combinations that do not produce consistent or correct results.