From: Mark Abraham Date: Sat, 28 Jun 2014 19:57:18 +0000 (+0200) Subject: Refer to "mixed" precision in user-facing documentation X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=8933a4eedf26ef3f6a6e2c9080d2a4cfb29fea48;p=alexxy%2Fgromacs.git Refer to "mixed" precision in user-facing documentation GROMACS has used mixed precision for many years, so we may as well be accurate about it. In the code, we should continue to refer to single precision for aspects of the implementation, but mdrun should not be referred to as running in "single precision." Also removed useless install-guide section from manual. Change-Id: I3c26acedcdb391de50bdcb6a5e913ea0cfc32845 --- diff --git a/cmake/gmxManageFFTLibraries.cmake b/cmake/gmxManageFFTLibraries.cmake index 78a67531dc..4bbfc2df4e 100644 --- a/cmake/gmxManageFFTLibraries.cmake +++ b/cmake/gmxManageFFTLibraries.cmake @@ -73,7 +73,7 @@ if(${GMX_FFT_LIBRARY} STREQUAL "FFTW3") string(TOUPPER "${FFTW}" FFTW) if(NOT ${FFTW}_FOUND) - MESSAGE(FATAL_ERROR "Cannot find FFTW 3 (with correct precision - libfftw3f for single-precision GROMACS or libfftw3 for double-precision GROMACS). Either choose the right precision, choose another FFT(W) library (-DGMX_FFT_LIBRARY), enable the advanced option to let GROMACS build FFTW 3 for you (-GMX_BUILD_OWN_FFTW=ON), or use the really slow GROMACS built-in fftpack library (-DGMX_FFT_LIBRARY=fftpack).") + MESSAGE(FATAL_ERROR "Cannot find FFTW 3 (with correct precision - libfftw3f for mixed-precision GROMACS or libfftw3 for double-precision GROMACS). Either choose the right precision, choose another FFT(W) library (-DGMX_FFT_LIBRARY), enable the advanced option to let GROMACS build FFTW 3 for you (-GMX_BUILD_OWN_FFTW=ON), or use the really slow GROMACS built-in fftpack library (-DGMX_FFT_LIBRARY=fftpack).") endif() set(PKG_FFT "${${FFTW}_PKG}") diff --git a/install-guide/install-guide.md b/install-guide/install-guide.md index 15fb7ce80c..2b19bcf0df 100644 --- a/install-guide/install-guide.md +++ b/install-guide/install-guide.md @@ -210,8 +210,9 @@ not a priority. FFTW is likely to be available for your platform via its package management system, but there can be compatibility and significant performance issues associated with these packages. In particular, -GROMACS simulations are normally run in single floating-point -precision whereas the default FFTW package is normally in double +GROMACS simulations are normally run in "mixed" floating-point +precision, which is suited for the use of single precision in +FFTW. The default FFTW package is normally in double precision, and good compiler options to use for FFTW when linked to GROMACS may not have been used. Accordingly, the GROMACS team recommends either @@ -229,8 +230,9 @@ will see a warning that advises how you can eliminate this risk If you build FFTW from source yourself, get the most recent version and follow its [installation guide](http://www.fftw.org/doc/Installation-and-Customization.html#Installation-and-Customization). -Choose the precision (i.e. single or float vs. double) to match what -you will later require for GROMACS. There is no need to compile with +Choose the precision for FFTW (i.e. single or float vs. double) to +match whether you will later use mixed or double precision for +GROMACS. There is no need to compile FFTW with threading or MPI support, but it does no harm. On x86 hardware, compile *only* with `--enable-sse2` (regardless of precision) even if your processors can take advantage of AVX extensions. Since GROMACS diff --git a/manual/algorithms.tex b/manual/algorithms.tex index c4398ec94c..eab3d54889 100644 --- a/manual/algorithms.tex +++ b/manual/algorithms.tex @@ -744,9 +744,10 @@ buffer calculation and results in a smaller buffer size. the cut-off. Error estimates due to finite Verlet buffer size are shown for a $1 \times 1$ atom pair list and $4 \times 4$ atom pair list without and with (dashed line) cancellation of positive and - negative errors. Real energy drift is shown for double- and - single-precision simulations. Single-precision rounding errors in - the SETTLE constraint algorithm cause the drift to become negative + negative errors. Real energy drift is shown for simulations using + double- and mixed-precision settings. Rounding errors in the SETTLE + constraint algorithm from the use of single precision causes + the drift to become negative at large buffer size. Note that at zero buffer size, the real drift is small because positive (H-H) and negative (O-H) energy errors cancel.} diff --git a/manual/forcefield.tex b/manual/forcefield.tex index 2768c14ada..f20986fc61 100644 --- a/manual/forcefield.tex +++ b/manual/forcefield.tex @@ -2028,7 +2028,7 @@ are evaluated during neighbor list generation. The \normindex{virial} is calculated from the sum of the short- and long-range forces. This means that the virial can be slightly asymmetrical at non-NS steps. -In single precision, the virial is almost always asymmetrical because the +When mdrun is compiled to use mixed precision, the virial is almost always asymmetrical because the off-diagonal elements are about as large as each element in the sum. In most cases this is not really a problem, since the fluctuations in the virial can be 2 orders of magnitude larger than the average. diff --git a/manual/install.tex b/manual/install.tex index 5cc9245aa8..5386ba5901 100644 --- a/manual/install.tex +++ b/manual/install.tex @@ -33,69 +33,30 @@ % the research papers on the package. Check out http://www.gromacs.org. \chapter{Technical Details} -\label{ch:install} -\section{Installation} -The entire {\gromacs} package is Free Software, licensed under the GNU -Lesser General Public License; either version 2.1 of the License, or -(at your option) any later version. -The main distribution site is our WWW server at {\wwwpage}. -The package is mainly distributed as source code, but others provide -packages for Linux and Mac. Check your Linux distribution tools -(search for gromacs). On Mac OS X the {\bf port} tool will allow you -to install a recent version. -On the home page you will find all the information you need to -\normindex{install} the package, mailing lists with archives, -and several additional on-line resources like contributed topologies, etc. -%% The default installation action is simply to unpack the source code and -%% then issue: -%% \begin{verbatim} -%% ./configure -%% make -%% make install -%% \end{verbatim} -%% The configuration script should automatically determine the best options -%% for your platform, and it will tell you if anything is missing on -%% your system. You will also find detailed step-by-step installation -%% instructions on the website. There is a \normindex{cmake} based -%% installation route as well: -%% \begin{verbatim} -%% cmake -%% make -%% make install -%% \end{verbatim} -%% which is being tested in the wild since {\gromacs} version 4.5. - -\section{Single or Double precision} -{\gromacs} can be compiled in either single\index{single -precision|see{precision, single}}\index{precision, single} or -\pawsindex{double}{precision}. It is very important to note here that -single precision is actually mixed precision. Using single precision +\section{Mixed or Double precision} +{\gromacs} can be compiled in either mixed\index{mixed +precision|see{precision, mixed}}\index{precision, mixed} or +\pawsindex{double}{precision}. Documentation of previous {\gromacs} +versions referred to ``single precision'', but the implementation +has made selective use of double precision for many years. +Using single precision for all variables would lead to a significant reduction in accuracy. -Although in single precision all state vectors, i.e. particle coordinates, +Although in ``mixed precision'' all state vectors, i.e. particle coordinates, velocities and forces, are stored in single precision, critical variables are double precision. A typical example of the latter is the virial, which is a sum over all forces in the system, which have varying signs. In addition, in many parts of the code we managed to avoid double precision for arithmetic, by paying attention to summation order or reorganization -of mathematical expressions. The default choice is single precision, +of mathematical expressions. The default configuration uses mixed precision, but it is easy to turn on double precision by adding the option {\tt -DGMX_DOUBLE=on} to {\tt cmake}. Double precision -will be 20 to 100\% slower than single precision depending on the +will be 20 to 100\% slower than mixed precision depending on the architecture you are running on. Double precision will use somewhat more memory and run input, energy and full-precision trajectory files -will be almost twice as large. SIMD (single-instruction multiple-data) -intrinsics non-bonded force and/or energy kernels are available for x86 -hardware in single and double precision in different SSE and AVX flavors; -the minimum requirement is SSE2. -IBM Blue Gene Q intrinsics will be available soon. Some other parts of -the code, especially PME, also employ x86 SIMD intrinsics. All other -hardware will use optimized C kernels. The Verlet non-bonded scheme -uses SIMD non-bonded kernels that are C pre-processor macro driven, -therefore it is straightforward to implement SIMD acceleration -for new architectures; a guide is provided on {\wwwpage}. +will be almost twice as large. -The energies in single precision are accurate up to the last decimal, +The energies in mixed precision are accurate up to the last decimal, the last one or two decimals of the forces are non-significant. The virial is less accurate than the forces, since the virial is only one order of magnitude larger than the size of each element in the sum over @@ -104,13 +65,14 @@ In most cases this is not really a problem, since the fluctuations in the virial can be two orders of magnitude larger than the average. Using cut-offs for the Coulomb interactions cause large errors in the energies, forces, and virial. -Even when using a reaction-field or lattice-sum method, the errors -are larger than, or comparable to, the errors due to the single precision. +Even when using a reaction-field or lattice sum method, the errors +are larger than, or comparable to, the errors due to the partial use of +single precision. Since MD is chaotic, trajectories with very similar starting conditions will -diverge rapidly, the divergence is faster in single precision than in double +diverge rapidly, the divergence is faster in mixed precision than in double precision. -For most simulations single precision is accurate enough. +For most simulations, mixed precision is accurate enough. In some cases double precision is required to get reasonable results: \begin{itemize} \item normal mode analysis, diff --git a/manual/plots/verlet-drift.eps b/manual/plots/verlet-drift.eps index 5145b29648..b8109d59b4 100644 --- a/manual/plots/verlet-drift.eps +++ b/manual/plots/verlet-drift.eps @@ -765,7 +765,7 @@ gsave 553 590 translate 0 rotate 0 -20 m -(single precision) show +(mixed precision) show grestore newpath 0.000000 0.000000 0.000000 setrgbcolor diff --git a/manual/plots/verlet-drift.xvg b/manual/plots/verlet-drift.xvg index 37c4dd3e70..2d576e6975 100644 --- a/manual/plots/verlet-drift.xvg +++ b/manual/plots/verlet-drift.xvg @@ -66,7 +66,7 @@ @ string font 4 @ string just 0 @ string char size 1.000000 -@ string def "single precision" +@ string def "mixed precision" @with g0 @g0 on @g0 label off diff --git a/manual/special.tex b/manual/special.tex index f2514cea1c..353d7cee79 100644 --- a/manual/special.tex +++ b/manual/special.tex @@ -1543,9 +1543,9 @@ This results in the following errors for each interval: V and V' are continuous, while V'' is the first discontinuous derivative. The number of points per nanometer is 500 and 2000 -for single- and double-precision versions of {\gromacs}, respectively. +for mixed- and double-precision versions of {\gromacs}, respectively. This means that the errors in the potential and force will usually -be smaller than the single precision accuracy. +be smaller than the mixed precision accuracy. {\gromacs} stores $A_0$, $A_1$, $A_2$ and $A_3$. The force routines get a table with these four parameters and @@ -1603,7 +1603,7 @@ order: $x$, $f(x)$, $-f'(x)$, $g(x)$, $-g'(x)$, $h(x)$, $-h'(x)$. The $x$ should run from 0 to $r_c+1$ (the value of {\tt table_extension} can be changed in the {\tt .mdp} file). You can choose the spacing you like; for the standard tables {\gromacs} -uses a spacing of 0.002 and 0.0005 nm when you run in single +uses a spacing of 0.002 and 0.0005 nm when you run in mixed and double precision, respectively. In this context, $r_c$ denotes the maximum of the two cut-offs {\tt rvdw} and {\tt rcoulomb} (see above). These variables need not be the same (and diff --git a/share/html/online/mdp_opt.html b/share/html/online/mdp_opt.html index 310a6c9a3d..8c34b3d2c5 100644 --- a/share/html/online/mdp_opt.html +++ b/share/html/online/mdp_opt.html @@ -661,7 +661,7 @@ from 0 to the largest cut-off distance + table-extension and should be uniformly spaced. For the pair interactions the table length in the file will be used. The optimal spacing, which is used for non-user tables, -is 0.002 [nm] when you run in single precision +is 0.002 [nm] when you run in mixed precision or 0.0005 [nm] when you run in double precision. The function value at x=0 is not important. More information is in the printed manual.