Improve CMake implementation for GMX_SIMD
commitff03a6997c020742ba2cd32e8f1ed22ac601f747
authorMark Abraham <mark.j.abraham@gmail.com>
Sun, 2 Jul 2017 22:34:11 +0000 (3 00:34 +0200)
committerErik Lindahl <erik.lindahl@gmail.com>
Wed, 19 Jul 2017 06:28:55 +0000 (19 08:28 +0200)
treecc9804b7f27a86c107714ae53875bf5e96e9c239
parentef7ed78182ce705956a0f4e10c2bcd150581bc56
Improve CMake implementation for GMX_SIMD

It is robust to have cache variables that are user choices (and to
refrain from modifying them), or the result of system
introspection. We should not cache the result of subsequent
fast-running logic.

Introduced the new default for GMX_SIMD, which is AUTO. The value AUTO
triggers the same detection path that used to set the old "default",
producing the same SIMD choice, but leaves the value of GMX_SIMD as
what the user chose, ie "AUTO". That means e.g. ccmake will now show
the user their choice, not the result of the detection. The choice
is written to the status output each time it changes (even to and
from AUTO).

Explicit non-AUTO choices for GMX_SIMD work the same way they used to.

Simplified the implementation surrounding the run of the detection
code. We can just store the feature string if the run was successful,
and not otherwise, and that works also to prevent unecessary re-runs
of the detection.

This will now make it possible for us to implement other logic that
reacts to a SIMD choice differently according to whether it comes from
the user or detection.

The implementation of GMX_USE_RDTSCP now works better, because RDTSCP
is now on if the user chose an AVX-era SIMD level, off if an older
SIMD level was chosen, and suits the build host if the SIMD choice is
also automated to reflect the build host.

Moved a compiler-problem check to the SIMD-management code so that
it can use GMX_SIMD_CHOICE after it is defined.

The FFT-management code now uses GMX_SIMD_ACTIVE, which works because
it runs after the SIMD management, which uses a macro (so shares the
same variable scope as the calling code).

mdrun binary information still reports the actual choice, and not
whether it was based on AUTO.

Verifying that the rest of the code works correctly is complicated by
the way the SIMD module defines GMX_SIMD, and that is used e.g. by the
nbnxn, lincs and bonded code.

Minor fix to docs of gmx_check_if_changed.

Change-Id: I54e140394ea0c452450ebebad5782849e92a5ce2
CMakeLists.txt
cmake/gmxDetectSimd.cmake
cmake/gmxManageFFTLibraries.cmake
cmake/gmxManageSimd.cmake
cmake/gmxOptionUtilities.cmake
cmake/gmxTestCompilerProblems.cmake
src/config.h.cmakein
src/gromacs/gmxlib/nonbonded/CMakeLists.txt