qmcpack icon indicating copy to clipboard operation
qmcpack copied to clipboard

KLists kpoint sorting inconsistent across compiler in mixed precision

Open PDoakORNL opened this issue 10 months ago • 3 comments

The sorting of kpoints into shells is different for clang 19 and gcc 14 and seemingly other clang and gcc's at least debug. This makes testing the Structure Factor Estimator with a realistic kgrid for a realistic unit cell a mess. It also is indicative that the KContainer unit testing is completely insufficient.

I also don't see any reason that or kpoint sorting shouldn't be 100% the same for all platforms and precision.

Related to #2445, #2137, #2105. It can't do diamond, the shell sorting algorithm should never have made it out of unit testing.

Currently its invisible but I have two different unit tests my branch which clearly show it. Sorting is different between full and mixed precision and between gcc and clang mixed sorting.

PDoakORNL avatar Feb 12 '25 16:02 PDoakORNL

Is the sorting consistent in full precision or does the same problem occur?

prckent avatar Feb 12 '25 17:02 prckent

After discussing with Peter, I'll note that (1) this could potentially the root cause of the historical Ewald problems, (2) clearly a correct and deterministic algorithm is needed. Avoiding the current integer mappings and working in terms of k^2 is one possibility.

prckent avatar Feb 12 '25 22:02 prckent

Sorting is consistent in full precision at least in the cases I've looked at.

PDoakORNL avatar Feb 17 '25 16:02 PDoakORNL