Remove support for Intel classic compiler
[alexxy/gromacs.git] / docs / install-guide / index.rst
1 .. Note that this must be a single rst file in order for Sphinx
2    to build into into a single plain-text file to place in the
3    installation tarball.
4
5 .. _install guide:
6
7 ******************
8 Installation guide
9 ******************
10
11 .. highlight:: bash
12
13 Introduction to building |Gromacs|
14 ----------------------------------
15
16 These instructions pertain to building |Gromacs|
17 |version|. You might also want to check the `up-to-date installation instructions`_.
18
19 Quick and dirty installation
20 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21 1. Get the latest version of your C and C++ compilers.
22 2. Check that you have CMake version |CMAKE_MINIMUM_REQUIRED_VERSION| or later.
23 3. Get and unpack the latest version of the |Gromacs| tarball.
24 4. Make a separate build directory and change to it.
25 5. Run ``cmake`` with the path to the source as an argument
26 6. Run ``make``, ``make check``, and ``make install``
27 7. Source ``GMXRC`` to get access to |Gromacs|
28
29 Or, as a sequence of commands to execute:
30
31 .. parsed-literal::
32
33     tar xfz gromacs-|version|.tar.gz
34     cd gromacs-|version|
35     mkdir build
36     cd build
37     cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON
38     make
39     make check
40     sudo make install
41     source /usr/local/gromacs/bin/GMXRC
42
43 This will download and build first the prerequisite FFT library
44 followed by |Gromacs|. If you already have FFTW installed, you can
45 remove that argument to ``cmake``. Overall, this build of |Gromacs|
46 will be correct and reasonably fast on the machine upon which
47 ``cmake`` ran. On another machine, it may not run, or may not run
48 fast. If you want to get the maximum value for your hardware with
49 |Gromacs|, you will have to read further. Sadly, the interactions of
50 hardware, libraries, and compilers are only going to continue to get
51 more complex.
52
53 Quick and dirty cluster installation
54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
55
56 On a cluster where users are expected to be running across multiple
57 nodes using MPI, make one installation similar to the above, and
58 another using ``-DGMX_MPI=on``.
59 The latter will install binaries and libraries named using
60 a default suffix of ``_mpi`` ie ``gmx_mpi``. Hence it is safe
61 and common practice to install this into the same location where
62 the non-MPI build is installed.
63
64 Typical installation
65 ^^^^^^^^^^^^^^^^^^^^
66
67 As above, and with further details below, but you should consider
68 using the following `CMake options`_ with the
69 appropriate value instead of ``xxx`` :
70
71 * ``-DCMAKE_C_COMPILER=xxx`` equal to the name of the C99 `Compiler`_ you wish to use (or the environment variable ``CC``)
72 * ``-DCMAKE_CXX_COMPILER=xxx`` equal to the name of the C++17 `compiler`_ you wish to use (or the environment variable ``CXX``)
73 * ``-DGMX_MPI=on`` to build using `MPI support`_
74 * ``-DGMX_GPU=CUDA`` to build with NVIDIA CUDA support enabled.
75 * ``-DGMX_GPU=OpenCL`` to build with OpenCL_ support enabled.
76 * ``-DGMX_SIMD=xxx`` to specify the level of `SIMD support`_ of the node on which |Gromacs| will run
77 * ``-DGMX_DOUBLE=on`` to build |Gromacs| in double precision (slower, and not normally useful)
78 * ``-DCMAKE_PREFIX_PATH=xxx`` to add a non-standard location for CMake to `search for libraries, headers or programs`_
79 * ``-DCMAKE_INSTALL_PREFIX=xxx`` to install |Gromacs| to a `non-standard location`_ (default ``/usr/local/gromacs``)
80 * ``-DBUILD_SHARED_LIBS=off`` to turn off the building of shared libraries to help with `static linking`_
81 * ``-DGMX_FFT_LIBRARY=xxx`` to select whether to use ``fftw3``, ``mkl`` or ``fftpack`` libraries for `FFT support`_
82 * ``-DCMAKE_BUILD_TYPE=Debug`` to build |Gromacs| in debug mode
83
84 Building older versions
85 ^^^^^^^^^^^^^^^^^^^^^^^
86
87 Installation instructions for old |Gromacs| versions can be found at
88 the |Gromacs| `documentation page
89 <http://manual.gromacs.org/documentation>`_.
90
91 Prerequisites
92 -------------
93
94 Platform
95 ^^^^^^^^
96
97 |Gromacs| can be compiled for many operating systems and
98 architectures.  These include any distribution of Linux, Mac OS X or
99 Windows, and architectures including x86, AMD64/x86-64, several
100 PowerPC including POWER8, ARM v8, and SPARC VIII.
101
102 Compiler
103 ^^^^^^^^
104
105 |Gromacs| can be compiled on any platform with ANSI C99 and C++17
106 compilers, and their respective standard C/C++ libraries. Good
107 performance on an OS and architecture requires choosing a good
108 compiler. We recommend gcc, because it is free, widely available and
109 frequently provides the best performance.
110
111 You should strive to use the most recent version of your
112 compiler. Since we require full C++17 support the minimum supported
113 compiler versions are
114
115 * GNU (gcc/libstdc++) 7
116 * LLVM (clang/libc++) 5
117 * Microsoft (MSVC) 2017 15.7
118
119 Other compilers may work (Cray, Pathscale, older clang) but do
120 not offer competitive performance. We recommend against PGI because
121 the performance with C++ is very bad.
122
123 The Intel classic compiler (icc/icpc) is no longer supported in
124 |Gromacs|. Use Intel's newer clang-based compiler from oneAPI, or
125 gcc.
126
127 The xlc compiler is not supported and version 16.1 does not compile on
128 POWER architectures for |Gromacs|\ -\ |version|. We recommend to use
129 the gcc compiler instead, as it is being extensively tested.
130
131 You may also need the most recent version of other compiler toolchain
132 components beside the compiler itself (e.g. assembler or linker);
133 these are often shipped by your OS distribution's binutils package.
134
135 C++17 support requires adequate support in both the compiler and the
136 C++ library. The gcc and MSVC compilers include their own standard
137 libraries and require no further configuration. If your vendor's
138 compiler also manages the standard library library via compiler flags,
139 these will be honored. For configuration of other compilers, read on.
140
141 On Linux, the clang compilers use the libstdc++ which
142 comes with gcc as the default C++ library. For |Gromacs|, we require
143 the compiler to support libstc++ version 7.1 or higher. To select a
144 particular libstdc++ library, provide the path to g++ with
145 ``-DGMX_GPLUSPLUS_PATH=/path/to/g++``.
146
147 To build with clang and llvm's libcxx standard library, use
148 ``-DCMAKE_CXX_FLAGS=-stdlib=libc++``.
149
150 If you are running on Mac OS X, the best option is gcc. The Apple
151 clang compiler provided by MacPorts will work, but does not support
152 OpenMP, so will probably not provide best performance.
153
154 For all non-x86 platforms, your best option is typically to use gcc or
155 the vendor's default or recommended compiler, and check for
156 specialized information below.
157
158 For updated versions of gcc to add to your Linux OS, see
159
160 * Ubuntu: `Ubuntu toolchain ppa page`_
161 * RHEL/CentOS: `EPEL page`_ or the RedHat Developer Toolset
162
163 Compiling with parallelization options
164 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
165
166 For maximum performance you will need to examine how you will use
167 |Gromacs| and what hardware you plan to run on. Often OpenMP_
168 parallelism is an advantage for |Gromacs|, but support for this is
169 generally built into your compiler and detected automatically.
170
171 .. _gmx-gpu-support:
172
173 GPU support
174 ~~~~~~~~~~~
175
176 |Gromacs| has excellent support for NVIDIA GPUs supported via CUDA.
177 On Linux, NVIDIA CUDA_ toolkit with minimum version |REQUIRED_CUDA_VERSION|
178 is required, and the latest version is strongly encouraged. NVIDIA GPUs with at
179 least NVIDIA compute capability |REQUIRED_CUDA_COMPUTE_CAPABILITY| are
180 required. You are strongly recommended to
181 get the latest CUDA version and driver that supports your hardware, but
182 beware of possible performance regressions in newer CUDA versions on
183 older hardware.
184 While some CUDA compilers (nvcc) might not
185 officially support recent versions of gcc as the back-end compiler, we
186 still recommend that you at least use a gcc version recent enough to
187 get the best SIMD support for your CPU, since |Gromacs| always runs some
188 code on the CPU. It is most reliable to use the same C++ compiler
189 version for |Gromacs| code as used as the host compiler for nvcc.
190
191 To make it possible to use other accelerators, |Gromacs| also includes
192 OpenCL_ support. The minimum OpenCL version required is
193 |REQUIRED_OPENCL_MIN_VERSION| and only 64-bit implementations are supported.
194 The current OpenCL implementation is recommended for
195 use with GCN-based AMD GPUs, and on Linux we recommend the ROCm runtime.
196 Intel integrated GPUs are supported with the Neo drivers.
197 OpenCL is also supported with NVIDIA GPUs, but using
198 the latest NVIDIA driver (which includes the NVIDIA OpenCL runtime) is
199 recommended. Also note that there are performance limitations (inherent
200 to the NVIDIA OpenCL runtime).
201 It is not possible to configure both CUDA and OpenCL
202 support in the same build of |Gromacs|, nor to support both
203 Intel and other vendors' GPUs with OpenCL. A 64-bit implementation
204 of OpenCL is required and therefore OpenCL is only supported on 64-bit platforms.
205
206 .. _mpi-support:
207
208 MPI support
209 ~~~~~~~~~~~
210
211 |Gromacs| can run in parallel on multiple cores of a single
212 workstation using its built-in thread-MPI. No user action is required
213 in order to enable this.
214
215 If you wish to run in parallel on multiple machines across a network,
216 you will need to have an MPI library installed that supports the MPI
217 2.0 standard. That's true for any MPI library version released since
218 about 2009, but the |Gromacs| team recommends the latest version (for
219 best performance) of either your vendor's library, OpenMPI_ or MPICH_.
220
221 To compile with MPI set your compiler to the normal (non-MPI) compiler
222 and add ``-DGMX_MPI=on`` to the cmake options. It is possible to set
223 the compiler to the MPI compiler wrapper but it is neither necessary
224 nor recommended.
225
226 CMake
227 ^^^^^
228
229 |Gromacs| builds with the CMake build system, requiring at least
230 version |CMAKE_MINIMUM_REQUIRED_VERSION|. You can check whether
231 CMake is installed, and what version it is, with ``cmake
232 --version``. If you need to install CMake, then first check whether
233 your platform's package management system provides a suitable version,
234 or visit the `CMake installation page`_ for pre-compiled binaries,
235 source code and installation instructions. The |Gromacs| team
236 recommends you install the most recent version of CMake you can.
237
238 .. _FFT support:
239
240 Fast Fourier Transform library
241 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
242
243 Many simulations in |Gromacs| make extensive use of fast Fourier
244 transforms, and a software library to perform these is always
245 required. We recommend FFTW_ (version 3 or higher only) or Intel
246 MKL_. The choice of library can be set with ``cmake
247 -DGMX_FFT_LIBRARY=<name>``, where ``<name>`` is one of ``fftw3``,
248 ``mkl``, or ``fftpack``. FFTPACK is bundled with |Gromacs| as a
249 fallback, and is acceptable if simulation performance is not a
250 priority. When choosing MKL, |Gromacs| will also use MKL for BLAS and
251 LAPACK (see `linear algebra libraries`_). Generally, there is no
252 advantage in using MKL with |Gromacs|, and FFTW is often faster.
253 With PME GPU offload support using CUDA, a GPU-based FFT library
254 is required. The CUDA-based GPU FFT library cuFFT is part of the
255 CUDA toolkit (required for all CUDA builds) and therefore no additional
256 software component is needed when building with CUDA GPU acceleration.
257
258 Using FFTW
259 ~~~~~~~~~~
260
261 FFTW_ is likely to be available for your platform via its package
262 management system, but there can be compatibility and significant
263 performance issues associated with these packages. In particular,
264 |Gromacs| simulations are normally run in "mixed" floating-point
265 precision, which is suited for the use of single precision in
266 FFTW. The default FFTW package is normally in double
267 precision, and good compiler options to use for FFTW when linked to
268 |Gromacs| may not have been used. Accordingly, the |Gromacs| team
269 recommends either
270
271 * that you permit the |Gromacs| installation to download and
272   build FFTW from source automatically for you (use
273   ``cmake -DGMX_BUILD_OWN_FFTW=ON``), or
274 * that you build FFTW from the source code.
275
276 If you build FFTW from source yourself, get the most recent version
277 and follow the `FFTW installation guide`_. Choose the precision for
278 FFTW (i.e. single/float vs. double) to match whether you will later
279 use mixed or double precision for |Gromacs|. There is no need to
280 compile FFTW with threading or MPI support, but it does no harm. On
281 x86 hardware, compile with *both* ``--enable-sse2`` and
282 ``--enable-avx`` for FFTW-3.3.4 and earlier. From FFTW-3.3.5, you
283 should also add ``--enable-avx2`` also. On Intel processors supporting
284 512-wide AVX, including KNL, add ``--enable-avx512`` also.
285 FFTW will create a fat library with codelets for all different instruction sets,
286 and pick the fastest supported one at runtime.
287 On ARM architectures with SIMD support and IBM Power8 and later, you
288 definitely want version 3.3.5 or later,
289 and to compile it with ``--enable-neon`` and ``--enable-vsx``, respectively, for
290 SIMD support. If you are using a Cray, there is a special modified
291 (commercial) version of FFTs using the FFTW interface which can be
292 slightly faster.
293
294 Using MKL
295 ~~~~~~~~~
296
297 Use MKL bundled with Intel compilers by setting up the compiler
298 environment, e.g., through ``source /path/to/compilervars.sh intel64``
299 or similar before running CMake including setting
300 ``-DGMX_FFT_LIBRARY=mkl``.
301
302 If you need to customize this further, use
303
304 ::
305
306     cmake -DGMX_FFT_LIBRARY=mkl \
307           -DMKL_LIBRARIES="/full/path/to/libone.so;/full/path/to/libtwo.so" \
308           -DMKL_INCLUDE_DIR="/full/path/to/mkl/include"
309
310 The full list and order(!) of libraries you require are found in Intel's MKL documentation for your system.
311
312 Using ARM Performance Libraries
313 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
314
315 The ARM Performance Libraries provides FFT transforms implementation for ARM
316 architectures.
317 Preliminary support is provided for ARMPL in |Gromacs| through its FFTW-compatible API.
318 Assuming that the ARM HPC toolchain environment including the ARMPL paths
319 are set up (e.g. through loading the appropriate modules like
320 ``module load Module-Prefix/arm-hpc-compiler-X.Y/armpl/X.Y``) use the following cmake
321 options:
322
323 ::
324
325     cmake -DGMX_FFT_LIBRARY=fftw3 \
326           -DFFTWF_LIBRARY="${ARMPL_DIR}/lib/libarmpl_lp64.so" \
327           -DFFTWF_INCLUDE_DIR=${ARMPL_DIR}/include
328
329
330 Other optional build components
331 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
332
333 * Run-time detection of hardware capabilities can be improved by
334   linking with hwloc. By default this is turned off since it might
335   not be supported everywhere, but if you have hwloc installed it
336   should work by just setting ``-DGMX_HWLOC=ON``
337 * Hardware-optimized BLAS and LAPACK libraries are useful
338   for a few of the |Gromacs| utilities focused on normal modes and
339   matrix manipulation, but they do not provide any benefits for normal
340   simulations. Configuring these is discussed at
341   `linear algebra libraries`_.
342 * The built-in |Gromacs| trajectory viewer ``gmx view`` requires X11 and
343   Motif/Lesstif libraries and header files. You may prefer to use
344   third-party software for visualization, such as VMD_ or PyMol_.
345 * An external TNG library for trajectory-file handling can be used
346   by setting ``-DGMX_EXTERNAL_TNG=yes``, but TNG
347   |GMX_TNG_MINIMUM_REQUIRED_VERSION| is bundled in the |Gromacs|
348   source already.
349 * The lmfit library for Levenberg-Marquardt curve fitting is used in
350   |Gromacs|. Only lmfit |GMX_LMFIT_REQUIRED_VERSION| is supported.  A
351   reduced version of that library is bundled in the |Gromacs|
352   distribution, and the default build uses it. That default may be
353   explicitly enabled with ``-DGMX_USE_LMFIT=internal``. To use an
354   external lmfit library, set ``-DGMX_USE_LMFIT=external``, and adjust
355   ``CMAKE_PREFIX_PATH`` as needed.  lmfit support can be disabled with
356   ``-DGMX_USE_LMFIT=none``.
357 * zlib is used by TNG for compressing some kinds of trajectory data
358 * Building the |Gromacs| documentation is optional, and requires
359   ImageMagick, pdflatex, bibtex, doxygen, python 3.6, sphinx
360   |EXPECTED_SPHINX_VERSION|, and pygments.
361 * The |Gromacs| utility programs often write data files in formats
362   suitable for the Grace plotting tool, but it is straightforward to
363   use these files in other plotting programs, too.
364 * Set ``-DGMX_PYTHON_PACKAGE=ON`` when configuring |Gromacs| with CMake to
365   enable additional CMake targets for the gmxapi Python package and
366   sample_restraint package from the main |Gromacs| CMake build. This supports
367   additional testing and documentation generation.
368
369 Doing a build of |Gromacs|
370 --------------------------
371
372 This section will cover a general build of |Gromacs| with CMake_, but it
373 is not an exhaustive discussion of how to use CMake. There are many
374 resources available on the web, which we suggest you search for when
375 you encounter problems not covered here. The material below applies
376 specifically to builds on Unix-like systems, including Linux, and Mac
377 OS X. For other platforms, see the specialist instructions below.
378
379 .. _configure-cmake:
380
381 Configuring with CMake
382 ^^^^^^^^^^^^^^^^^^^^^^
383
384 CMake will run many tests on your system and do its best to work out
385 how to build |Gromacs| for you. If your build machine is the same as
386 your target machine, then you can be sure that the defaults and
387 detection will be pretty good. However, if you want to control aspects
388 of the build, or you are compiling on a cluster head node for back-end
389 nodes with a different architecture, there are a few things you
390 should consider specifying.
391
392 The best way to use CMake to configure |Gromacs| is to do an
393 "out-of-source" build, by making another directory from which you will
394 run CMake. This can be outside the source directory, or a subdirectory
395 of it. It also means you can never corrupt your source code by trying
396 to build it! So, the only required argument on the CMake command line
397 is the name of the directory containing the ``CMakeLists.txt`` file of
398 the code you want to build. For example, download the source tarball
399 and use
400
401 .. parsed-literal::
402
403     tar xfz gromacs-|version|.tgz
404     cd gromacs-|version|
405     mkdir build-gromacs
406     cd build-gromacs
407     cmake ..
408
409 You will see ``cmake`` report a sequence of results of tests and
410 detections done by the |Gromacs| build system. These are written to the
411 ``cmake`` cache, kept in ``CMakeCache.txt``. You can edit this file by
412 hand, but this is not recommended because you could make a mistake.
413 You should not attempt to move or copy this file to do another build,
414 because file paths are hard-coded within it. If you mess things up,
415 just delete this file and start again with ``cmake``.
416
417 If there is a serious problem detected at this stage, then you will see
418 a fatal error and some suggestions for how to overcome it. If you are
419 not sure how to deal with that, please start by searching on the web
420 (most computer problems already have known solutions!) and then
421 consult the gmx-users mailing list. There are also informational
422 warnings that you might like to take on board or not. Piping the
423 output of ``cmake`` through ``less`` or ``tee`` can be
424 useful, too.
425
426 Once ``cmake`` returns, you can see all the settings that were chosen
427 and information about them by using e.g. the curses interface
428
429 ::
430
431     ccmake ..
432
433 You can actually use ``ccmake`` (available on most Unix platforms)
434 directly in the first step, but then
435 most of the status messages will merely blink in the lower part
436 of the terminal rather than be written to standard output. Most platforms
437 including Linux, Windows, and Mac OS X even have native graphical user interfaces for
438 ``cmake``, and it can create project files for almost any build environment
439 you want (including Visual Studio or Xcode).
440 Check out `running CMake`_ for
441 general advice on what you are seeing and how to navigate and change
442 things. The settings you might normally want to change are already
443 presented. You may make changes, then re-configure (using ``c``), so that it
444 gets a chance to make changes that depend on yours and perform more
445 checking. It may take several configuration passes to reach the desired
446 configuration, in particular if you need to resolve errors.
447
448 When you have reached the desired configuration with ``ccmake``, the
449 build system can be generated by pressing ``g``.  This requires that the previous
450 configuration pass did not reveal any additional settings (if it did, you need
451 to configure once more with ``c``).  With ``cmake``, the build system is generated
452 after each pass that does not produce errors.
453
454 You cannot attempt to change compilers after the initial run of
455 ``cmake``. If you need to change, clean up, and start again.
456
457 .. _non-standard location:
458
459 Where to install |Gromacs|
460 ~~~~~~~~~~~~~~~~~~~~~~~~~~
461
462 |Gromacs| is installed in the directory to which
463 ``CMAKE_INSTALL_PREFIX`` points. It may not be the source directory or
464 the build directory.  You require write permissions to this
465 directory. Thus, without super-user privileges,
466 ``CMAKE_INSTALL_PREFIX`` will have to be within your home directory.
467 Even if you do have super-user privileges, you should use them only
468 for the installation phase, and never for configuring, building, or
469 running |Gromacs|!
470
471 .. _cmake options:
472
473 Using CMake command-line options
474 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
475
476 Once you become comfortable with setting and changing options, you may
477 know in advance how you will configure |Gromacs|. If so, you can speed
478 things up by invoking ``cmake`` and passing the various options at once
479 on the command line. This can be done by setting cache variable at the
480 cmake invocation using ``-DOPTION=VALUE``. Note that some
481 environment variables are also taken into account, in particular
482 variables like ``CC`` and ``CXX``.
483
484 For example, the following command line
485
486 ::
487
488     cmake .. -DGMX_GPU=CUDA -DGMX_MPI=ON -DCMAKE_INSTALL_PREFIX=/home/marydoe/programs
489
490 can be used to build with CUDA GPUs, MPI and install in a custom
491 location. You can even save that in a shell script to make it even
492 easier next time. You can also do this kind of thing with ``ccmake``,
493 but you should avoid this, because the options set with ``-D`` will not
494 be able to be changed interactively in that run of ``ccmake``.
495
496 .. _gmx-simd-support:
497
498 SIMD support
499 ~~~~~~~~~~~~
500
501 |Gromacs| has extensive support for detecting and using the SIMD
502 capabilities of many modern HPC CPU architectures. If you are building
503 |Gromacs| on the same hardware you will run it on, then you don't need
504 to read more about this, unless you are getting configuration warnings
505 you do not understand. By default, the |Gromacs| build system will
506 detect the SIMD instruction set supported by the CPU architecture (on
507 which the configuring is done), and thus pick the best
508 available SIMD parallelization supported by |Gromacs|. The build system
509 will also check that the compiler and linker used also support the
510 selected SIMD instruction set and issue a fatal error if they
511 do not.
512
513 Valid values are listed below, and the applicable value with the
514 largest number in the list is generally the one you should choose.
515 In most cases, choosing an inappropriate higher number will lead
516 to compiling a binary that will not run. However, on a number of
517 processor architectures choosing the highest supported value can
518 lead to performance loss, e.g. on Intel Skylake-X/SP and AMD Zen.
519
520 1. ``None`` For use only on an architecture either lacking SIMD,
521    or to which |Gromacs| has not yet been ported and none of the
522    options below are applicable.
523 2. ``SSE2`` This SIMD instruction set was introduced in Intel
524    processors in 2001, and AMD in 2003. Essentially all x86
525    machines in existence have this, so it might be a good choice if
526    you need to support dinosaur x86 computers too.
527 3. ``SSE4.1`` Present in all Intel core processors since 2007,
528    but notably not in AMD Magny-Cours. Still, almost all recent
529    processors support this, so this can also be considered a good
530    baseline if you are content with slow simulations and prefer
531    portability between reasonably modern processors.
532 4. ``AVX_128_FMA`` AMD Bulldozer, Piledriver (and later Family 15h) processors have this.
533 5. ``AVX_256`` Intel processors since Sandy Bridge (2011). While this
534    code will work on the  AMD Bulldozer and Piledriver processors, it is significantly less
535    efficient than the ``AVX_128_FMA`` choice above - do not be fooled
536    to assume that 256 is better than 128 in this case.
537 6. ``AVX2_128`` AMD Zen/Zen2 and Hygon Dhyana microarchitecture processors;
538    it will enable AVX2 with 3-way fused multiply-add instructions.
539    While these microarchitectures do support 256-bit AVX2 instructions,
540    hence ``AVX2_256`` is also supported, 128-bit will generally be faster,
541    in particular when the non-bonded tasks run on the CPU -- hence
542    the default ``AVX2_128``. With GPU offload however ``AVX2_256``
543    can be faster on Zen processors.
544 7. ``AVX2_256`` Present on Intel Haswell (and later) processors (2013),
545    and it will also enable Intel 3-way fused multiply-add instructions.
546 8. ``AVX_512`` Skylake-X desktop and Skylake-SP Xeon processors (2017);
547    it will generally be fastest on the higher-end desktop and server
548    processors with two 512-bit fused multiply-add units (e.g. Core i9
549    and Xeon Gold). However, certain desktop and server models
550    (e.g. Xeon Bronze and Silver) come with only one AVX512 FMA unit
551    and therefore on these processors ``AVX2_256`` is faster
552    (compile- and runtime checks try to inform about such cases).
553    Additionally, with GPU accelerated runs ``AVX2_256`` can also be
554    faster on high-end Skylake CPUs with both 512-bit FMA units enabled.
555 9. ``AVX_512_KNL`` Knights Landing Xeon Phi processors
556 10. ``IBM_VMX`` Power6 and similar Altivec processors have this.
557 11. ``IBM_VSX`` Power7, Power8, Power9 and later have this.
558 12. ``ARM_NEON`` 32-bit ARMv7 with NEON support.
559 13. ``ARM_NEON_ASIMD`` 64-bit ARMv8 and later.
560 14. ``ARM_SVE`` 64-bit ARMv8 and later with the Scalable Vector Extensions (SVE).
561     The SVE vector length is fixed at CMake configure time. The default vector
562     length is automatically detected, and this can be changed via the
563     ``GMX_SIMD_ARM_SVE_LENGTH`` CMake variable.
564
565 The CMake configure system will check that the compiler you have
566 chosen can target the architecture you have chosen. mdrun will check
567 further at runtime, so if in doubt, choose the lowest number you
568 think might work, and see what mdrun says. The configure system also
569 works around many known issues in many versions of common HPC
570 compilers.
571
572 A further ``GMX_SIMD=Reference`` option exists, which is a special
573 SIMD-like implementation written in plain C that developers can use
574 when developing support in |Gromacs| for new SIMD architectures. It is
575 not designed for use in production simulations, but if you are using
576 an architecture with SIMD support to which |Gromacs| has not yet been
577 ported, you may wish to try this option instead of the default
578 ``GMX_SIMD=None``, as it can often out-perform this when the
579 auto-vectorization in your compiler does a good job. And post on the
580 |Gromacs| mailing lists, because |Gromacs| can probably be ported for new
581 SIMD architectures in a few days.
582
583 CMake advanced options
584 ~~~~~~~~~~~~~~~~~~~~~~
585
586 The options that are displayed in the default view of ``ccmake`` are
587 ones that we think a reasonable number of users might want to consider
588 changing. There are a lot more options available, which you can see by
589 toggling the advanced mode in ``ccmake`` on and off with ``t``. Even
590 there, most of the variables that you might want to change have a
591 ``CMAKE_`` or ``GMX_`` prefix. There are also some options that will be
592 visible or not according to whether their preconditions are satisfied.
593
594 .. _search for libraries, headers or programs:
595
596 Helping CMake find the right libraries, headers, or programs
597 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
598
599 If libraries are installed in non-default locations their location can
600 be specified using the following variables:
601
602 * ``CMAKE_INCLUDE_PATH`` for header files
603 * ``CMAKE_LIBRARY_PATH`` for libraries
604 * ``CMAKE_PREFIX_PATH`` for header, libraries and binaries
605   (e.g. ``/usr/local``).
606
607 The respective ``include``, ``lib``, or ``bin`` is
608 appended to the path. For each of these variables, a list of paths can
609 be specified (on Unix, separated with ":"). These can be set as
610 enviroment variables like:
611
612 ::
613
614     CMAKE_PREFIX_PATH=/opt/fftw:/opt/cuda cmake ..
615
616 (assuming ``bash`` shell). Alternatively, these variables are also
617 ``cmake`` options, so they can be set like
618 ``-DCMAKE_PREFIX_PATH=/opt/fftw:/opt/cuda``.
619
620 The ``CC`` and ``CXX`` environment variables are also useful
621 for indicating to ``cmake`` which compilers to use. Similarly,
622 ``CFLAGS``/``CXXFLAGS`` can be used to pass compiler
623 options, but note that these will be appended to those set by
624 |Gromacs| for your build platform and build type. You can customize
625 some of this with advanced CMake options such as ``CMAKE_C_FLAGS``
626 and its relatives.
627
628 See also the page on `CMake environment variables`_.
629
630 .. _CUDA GPU acceleration:
631
632 CUDA GPU acceleration
633 ~~~~~~~~~~~~~~~~~~~~~
634
635 If you have the CUDA_ Toolkit installed, you can use ``cmake`` with:
636
637 ::
638
639     cmake .. -DGMX_GPU=CUDA -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
640
641 (or whichever path has your installation). In some cases, you might
642 need to specify manually which of your C++ compilers should be used,
643 e.g. with the advanced option ``CUDA_HOST_COMPILER``.
644
645 By default, code will be generated for the most common CUDA architectures.
646 However, to reduce build time and binary size we do not generate code for
647 every single possible architecture, which in rare cases (say, Tegra systems)
648 can result in the default build not being able to use some GPUs.
649 If this happens, or if you want to remove some architectures to reduce
650 binary size and build time, you can alter the target CUDA architectures.
651 This can be done either with the ``GMX_CUDA_TARGET_SM`` or
652 ``GMX_CUDA_TARGET_COMPUTE`` CMake variables, which take a semicolon delimited
653 string with the two digit suffixes of CUDA (virtual) architectures names, for
654 instance "35;50;51;52;53;60". For details, see the "Options for steering GPU
655 code generation" section of the nvcc man / help or Chapter 6. of the nvcc
656 manual.
657
658 The GPU acceleration has been tested on AMD64/x86-64 platforms with
659 Linux, Mac OS X and Windows operating systems, but Linux is the
660 best-tested and supported of these. Linux running on POWER 8 and ARM v8
661 CPUs also works well.
662
663 Experimental support is available for compiling CUDA code, both for host and
664 device, using clang (version 6.0 or later).
665 A CUDA toolkit is still required but it is used only for GPU device code
666 generation and to link against the CUDA runtime library.
667 The clang CUDA support simplifies compilation and provides benefits for development
668 (e.g. allows the use code sanitizers in CUDA host-code).
669 Additionally, using clang for both CPU and GPU compilation can be beneficial
670 to avoid compatibility issues between the GNU toolchain and the CUDA toolkit.
671 clang for CUDA can be triggered using the ``GMX_CLANG_CUDA=ON`` CMake option.
672 Target architectures can be selected with  ``GMX_CUDA_TARGET_SM``,
673 virtual architecture code is always embedded for all requested architectures
674 (hence GMX_CUDA_TARGET_COMPUTE is ignored).
675 Note that this is mainly a developer-oriented feature and it is not recommended
676 for production use as the performance can be significantly lower than that
677 of code compiled with nvcc (and it has also received less testing).
678 However, note that since clang 5.0 the performance gap is only moderate
679 (at the time of writing, about 20% slower GPU kernels), so this version
680 could be considered in non performance-critical use-cases.
681
682
683 OpenCL GPU acceleration
684 ~~~~~~~~~~~~~~~~~~~~~~~
685
686 The primary targets of the |Gromacs| OpenCL support is accelerating
687 simulations on AMD and Intel hardware. For AMD, we target both
688 discrete GPUs and APUs (integrated CPU+GPU chips), and for Intel we
689 target the integrated GPUs found on modern workstation and mobile
690 hardware. The |Gromacs| OpenCL on NVIDIA GPUs works, but performance
691 and other limitations make it less practical (for details see the user guide).
692
693 To build |Gromacs| with OpenCL_ support enabled, two components are
694 required: the OpenCL_ headers and the wrapper library that acts
695 as a client driver loader (so-called ICD loader).
696 The additional, runtime-only dependency is the vendor-specific GPU driver
697 for the device targeted. This also contains the OpenCL_ compiler.
698 As the GPU compute kernels are compiled  on-demand at run time,
699 this vendor-specific compiler and driver is not needed for building |Gromacs|.
700 The former, compile-time dependencies are standard components,
701 hence stock versions can be obtained from most Linux distribution
702 repositories (e.g. ``opencl-headers`` and ``ocl-icd-libopencl1`` on Debian/Ubuntu).
703 Only the compatibility with the required OpenCL_ version |REQUIRED_OPENCL_MIN_VERSION|
704 needs to be ensured.
705 Alternatively, the headers and library can also be obtained from vendor SDKs
706 (e.g. `from AMD <http://developer.amd.com/appsdk>`_),
707 which must be installed in a path found in ``CMAKE_PREFIX_PATH`` (or via the environment
708 variables ``AMDAPPSDKROOT`` or ``CUDA_PATH``).
709
710 To trigger an OpenCL_ build the following CMake flags must be set
711
712 ::
713
714     cmake .. -DGMX_GPU=OpenCL
715
716 To build with support for Intel integrated GPUs, it is required
717 to add ``-DGMX_OPENCL_NB_CLUSTER_SIZE=4`` to the cmake command line,
718 so that the GPU kernels match the characteristics of the hardware.
719 The `Neo driver <https://github.com/intel/compute-runtime/releases>`_
720 is recommended.
721
722 On Mac OS, an AMD GPU can be used only with OS version 10.10.4 and
723 higher; earlier OS versions are known to run incorrectly.
724
725 By default, any clFFT library on the system will be used with
726 |Gromacs|, but if none is found then the code will fall back on a
727 version bundled with |Gromacs|. To require |Gromacs| to link with an
728 external library, use
729
730 ::
731
732     cmake .. -DGMX_GPU=OpenCL -DclFFT_ROOT_DIR=/path/to/your/clFFT -DGMX_EXTERNAL_CLFFT=TRUE
733
734 Static linking
735 ~~~~~~~~~~~~~~
736
737 Dynamic linking of the |Gromacs| executables will lead to a
738 smaller disk footprint when installed, and so is the default on
739 platforms where we believe it has been tested repeatedly and found to work.
740 In general, this includes Linux, Windows, Mac OS X and BSD systems.
741 Static binaries take more space, but on some hardware and/or under
742 some conditions they are necessary, most commonly when you are running a parallel
743 simulation using MPI libraries (e.g. Cray).
744
745 * To link |Gromacs| binaries statically against the internal |Gromacs|
746   libraries, set ``-DBUILD_SHARED_LIBS=OFF``.
747 * To link statically against external (non-system) libraries as well,
748   set ``-DGMX_PREFER_STATIC_LIBS=ON``. Note, that in
749   general ``cmake`` picks up whatever is available, so this option only
750   instructs ``cmake`` to prefer static libraries when both static and
751   shared are available. If no static version of an external library is
752   available, even when the aforementioned option is ``ON``, the shared
753   library will be used. Also note that the resulting binaries will
754   still be dynamically linked against system libraries on platforms
755   where that is the default. To use static system libraries,
756   additional compiler/linker flags are necessary, e.g. ``-static-libgcc
757   -static-libstdc++``.
758 * To attempt to link a fully static binary set
759   ``-DGMX_BUILD_SHARED_EXE=OFF``. This will prevent CMake from explicitly
760   setting any dynamic linking flags. This option also sets
761   ``-DBUILD_SHARED_LIBS=OFF`` and ``-DGMX_PREFER_STATIC_LIBS=ON`` by
762   default, but the above caveats apply. For compilers which don't
763   default to static linking, the required flags have to be specified. On
764   Linux, this is usually ``CFLAGS=-static CXXFLAGS=-static``.
765
766 gmxapi C++ API
767 ~~~~~~~~~~~~~~
768
769 For dynamic linking builds and on non-Windows platforms, an extra library and
770 headers are installed by setting ``-DGMXAPI=ON`` (default).
771 Build targets ``gmxapi-cppdocs`` and ``gmxapi-cppdocs-dev`` produce documentation in
772 ``docs/api-user`` and ``docs/api-dev``, respectively.
773 For more project information and use cases,
774 refer to the tracked :issue:`2585`,
775 associated GitHub `gmxapi <https://github.com/kassonlab/gmxapi>`_ projects,
776 or DOI `10.1093/bioinformatics/bty484 <https://doi.org/10.1093/bioinformatics/bty484>`_.
777
778 gmxapi is not yet tested on Windows or with static linking, but these use cases
779 are targeted for future versions.
780
781 Portability aspects
782 ~~~~~~~~~~~~~~~~~~~
783
784 A |Gromacs| build will normally not be portable, not even across
785 hardware with the same base instruction set, like x86. Non-portable
786 hardware-specific optimizations are selected at configure-time, such
787 as the SIMD instruction set used in the compute kernels. This
788 selection will be done by the build system based on the capabilities
789 of the build host machine or otherwise specified to ``cmake`` during
790 configuration.
791
792 Often it is possible to ensure portability by choosing the least
793 common denominator of SIMD support, e.g. SSE2 for x86. In rare cases
794 of very old x86 machines, ensure that
795 you use ``cmake -DGMX_USE_RDTSCP=off`` if any of the target CPU
796 architectures does not support the ``RDTSCP`` instruction.  However, we
797 discourage attempts to use a single |Gromacs| installation when the
798 execution environment is heterogeneous, such as a mix of AVX and
799 earlier hardware, because this will lead to programs (especially
800 mdrun) that run slowly on the new hardware. Building two full
801 installations and locally managing how to call the correct one
802 (e.g. using a module system) is the recommended
803 approach. Alternatively, one can use different suffixes to install 
804 several versions of |Gromacs| in the same location. To achieve this,
805 one can first build a full installation with the
806 least-common-denominator SIMD instruction set, e.g. ``-DGMX_SIMD=SSE2``,
807 in order for simple commands like ``gmx grompp`` to work on all machines,
808 then build specialized ``gmx`` binaries for each architecture present in
809 the heterogeneous environment. By using custom binary and library
810 suffixes (with CMake variables ``-DGMX_BINARY_SUFFIX=xxx`` and
811 ``-DGMX_LIBS_SUFFIX=xxx``), these can be installed to the same
812 location.
813
814 Linear algebra libraries
815 ~~~~~~~~~~~~~~~~~~~~~~~~
816
817 As mentioned above, sometimes vendor BLAS and LAPACK libraries
818 can provide performance enhancements for |Gromacs| when doing
819 normal-mode analysis or covariance analysis. For simplicity, the text
820 below will refer only to BLAS, but the same options are available
821 for LAPACK. By default, CMake will search for BLAS, use it if it
822 is found, and otherwise fall back on a version of BLAS internal to
823 |Gromacs|. The ``cmake`` option ``-DGMX_EXTERNAL_BLAS=on`` will be set
824 accordingly. The internal versions are fine for normal use. If you
825 need to specify a non-standard path to search, use
826 ``-DCMAKE_PREFIX_PATH=/path/to/search``. If you need to specify a
827 library with a non-standard name (e.g. ESSL on Power machines
828 or ARMPL on ARM machines), then
829 set ``-DGMX_BLAS_USER=/path/to/reach/lib/libwhatever.a``.
830
831 If you are using Intel MKL_ for FFT, then the BLAS and
832 LAPACK it provides are used automatically. This could be
833 over-ridden with ``GMX_BLAS_USER``, etc.
834
835 On Apple platforms where the Accelerate Framework is available, these
836 will be automatically used for BLAS and LAPACK. This could be
837 over-ridden with ``GMX_BLAS_USER``, etc.
838
839 .. _installing with MiMiC:
840
841 Building with MiMiC QM/MM support
842 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
843
844 MiMiC QM/MM interface integration will require linking against MiMiC
845 communication library, that establishes the communication channel
846 between |Gromacs| and CPMD. The MiMiC Communication library can be
847 downloaded `here <https://gitlab.com/MiMiC-projects/CommLib>`__.
848 Compile and install it. Check that the installation folder of the
849 MiMiC library is added to CMAKE_PREFIX_PATH if it is installed in
850 non-standard location. Building QM/MM-capable version requires
851 double-precision version of |Gromacs| compiled with MPI support:
852
853 * ``-DGMX_DOUBLE=ON -DGMX_MPI -DGMX_MIMIC=ON``
854
855 .. _suffixes:
856
857 Changing the names of |Gromacs| binaries and libraries
858 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
859
860 It is sometimes convenient to have different versions of the same
861 |Gromacs| programs installed. The most common use cases have been single
862 and double precision, and with and without MPI. This mechanism can
863 also be used to install side-by-side multiple versions of mdrun
864 optimized for different CPU architectures, as mentioned previously.
865
866 By default, |Gromacs| will suffix programs and libraries for such builds
867 with ``_d`` for double precision and/or ``_mpi`` for MPI (and nothing
868 otherwise). This can be controlled manually with ``GMX_DEFAULT_SUFFIX
869 (ON/OFF)``, ``GMX_BINARY_SUFFIX`` (takes a string) and ``GMX_LIBS_SUFFIX``
870 (also takes a string). For instance, to set a custom suffix for
871 programs and libraries, one might specify:
872
873 ::
874
875     cmake .. -DGMX_DEFAULT_SUFFIX=OFF -DGMX_BINARY_SUFFIX=_mod -DGMX_LIBS_SUFFIX=_mod
876
877 Thus the names of all programs and libraries will be appended with
878 ``_mod``.
879
880 Changing installation tree structure
881 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
882
883 By default, a few different directories under ``CMAKE_INSTALL_PREFIX`` are used
884 when when |Gromacs| is installed. Some of these can be changed, which is mainly
885 useful for packaging |Gromacs| for various distributions. The directories are
886 listed below, with additional notes about some of them. Unless otherwise noted,
887 the directories can be renamed by editing the installation paths in the main
888 CMakeLists.txt.
889
890 ``bin/``
891     The standard location for executables and some scripts.
892     Some of the scripts hardcode the absolute installation prefix, which needs
893     to be changed if the scripts are relocated.
894     The name of the directory can be changed using ``CMAKE_INSTALL_BINDIR`` CMake
895     variable.
896 ``include/gromacs/``
897     The standard location for installed headers.
898 ``lib/``
899     The standard location for libraries. The default depends on the system, and
900     is determined by CMake.
901     The name of the directory can be changed using ``CMAKE_INSTALL_LIBDIR`` CMake
902     variable.
903 ``lib/pkgconfig/``
904     Information about the installed ``libgromacs`` library for ``pkg-config`` is
905     installed here.  The ``lib/`` part adapts to the installation location of the
906     libraries.  The installed files contain the installation prefix as absolute
907     paths.
908 ``share/cmake/``
909     CMake package configuration files are installed here.
910 ``share/gromacs/``
911     Various data files and some documentation go here. The first part can
912     be changed using ``CMAKE_INSTALL_DATADIR``, and the second by using
913     ``GMX_INSTALL_DATASUBDIR`` Using these CMake variables is the preferred
914     way of changing the installation path for
915     ``share/gromacs/top/``, since the path to this directory is built into
916     ``libgromacs`` as well as some scripts, both as a relative and as an absolute
917     path (the latter as a fallback if everything else fails).
918 ``share/man/``
919     Installed man pages go here.
920
921 Compiling and linking
922 ^^^^^^^^^^^^^^^^^^^^^
923
924 Once you have configured with ``cmake``, you can build |Gromacs| with ``make``.
925 It is expected that this will always complete successfully, and
926 give few or no warnings. The CMake-time tests |Gromacs| makes on the settings
927 you choose are pretty extensive, but there are probably a few cases we
928 have not thought of yet. Search the web first for solutions to
929 problems, but if you need help, ask on gmx-users, being sure to
930 provide as much information as possible about what you did, the system
931 you are building on, and what went wrong. This may mean scrolling back
932 a long way through the output of ``make`` to find the first error
933 message!
934
935 If you have a multi-core or multi-CPU machine with ``N``
936 processors, then using
937
938 ::
939
940     make -j N
941
942 will generally speed things up by quite a bit. Other build generator systems
943 supported by ``cmake`` (e.g. ``ninja``) also work well.
944
945 .. _building just the mdrun binary:
946
947 Installing |Gromacs|
948 ^^^^^^^^^^^^^^^^^^^^
949
950 Finally, ``make install`` will install |Gromacs| in the
951 directory given in ``CMAKE_INSTALL_PREFIX``. If this is a system
952 directory, then you will need permission to write there, and you
953 should use super-user privileges only for ``make install`` and
954 not the whole procedure.
955
956 .. _getting access to |Gromacs|:
957
958 Getting access to |Gromacs| after installation
959 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
960
961 |Gromacs| installs the script ``GMXRC`` in the ``bin``
962 subdirectory of the installation directory
963 (e.g. ``/usr/local/gromacs/bin/GMXRC``), which you should source
964 from your shell:
965
966 ::
967
968     source /your/installation/prefix/here/bin/GMXRC
969
970 It will detect what kind of shell you are running and set up your
971 environment for using |Gromacs|. You may wish to arrange for your
972 login scripts to do this automatically; please search the web for
973 instructions on how to do this for your shell.
974
975 Many of the |Gromacs| programs rely on data installed in the
976 ``share/gromacs`` subdirectory of the installation directory. By
977 default, the programs will use the environment variables set in the
978 ``GMXRC`` script, and if this is not available they will try to guess the
979 path based on their own location.  This usually works well unless you
980 change the names of directories inside the install tree. If you still
981 need to do that, you might want to recompile with the new install
982 location properly set, or edit the ``GMXRC`` script.
983
984 |Gromacs| also installs a CMake toolchains file to help with building client
985 software. For an installation at ``/your/installation/prefix/here``, toolchain
986 files will be installed at
987 ``/your/installation/prefix/here/share/cmake/gromacs${GMX_LIBS_SUFFIX}/gromacs-toolchain${GMX_LIBS_SUFFIX}.cmake``
988 where ``${GMX_LIBS_SUFFIX}`` is :ref:`as documented above <suffixes>`.
989
990 Testing |Gromacs| for correctness
991 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
992
993 Since 2011, the |Gromacs| development uses an automated system where
994 every new code change is subject to regression testing on a number of
995 platforms and software combinations. While this improves
996 reliability quite a lot, not everything is tested, and since we
997 increasingly rely on cutting edge compiler features there is
998 non-negligible risk that the default compiler on your system could
999 have bugs. We have tried our best to test and refuse to use known bad
1000 versions in ``cmake``, but we strongly recommend that you run through
1001 the tests yourself. It only takes a few minutes, after which you can
1002 trust your build.
1003
1004 The simplest way to run the checks is to build |Gromacs| with
1005 ``-DREGRESSIONTEST_DOWNLOAD``, and run ``make check``.
1006 |Gromacs| will automatically download and run the tests for you.
1007 Alternatively, you can download and unpack the |Gromacs|
1008 regression test suite |gmx-regressiontests-package| tarball yourself
1009 and use the advanced ``cmake`` option ``REGRESSIONTEST_PATH`` to
1010 specify the path to the unpacked tarball, which will then be used for
1011 testing. If the above does not work, then please read on.
1012
1013 The regression tests are also available from the download_ section.
1014 Once you have downloaded them, unpack the tarball, source
1015 ``GMXRC`` as described above, and run ``./gmxtest.pl all``
1016 inside the regression tests folder. You can find more options
1017 (e.g. adding ``double`` when using double precision, or
1018 ``-only expanded`` to run just the tests whose names match
1019 "expanded") if you just execute the script without options.
1020
1021 Hopefully, you will get a report that all tests have passed. If there
1022 are individual failed tests it could be a sign of a compiler bug, or
1023 that a tolerance is just a tiny bit too tight. Check the output files
1024 the script directs you too, and try a different or newer compiler if
1025 the errors appear to be real. If you cannot get it to pass the
1026 regression tests, you might try dropping a line to the
1027 `|Gromacs| users forum <https://gromacs.bioexcel.eu/c/gromacs-user-forum>`__,
1028 but then you should include a detailed description of
1029 your hardware, and the output of ``gmx mdrun -version`` (which contains
1030 valuable diagnostic information in the header).
1031
1032 Non-standard suffix
1033 ~~~~~~~~~~~~~~~~~~~
1034
1035 If your ``gmx`` program has been suffixed in a non-standard way, then
1036 the ``./gmxtest.pl -suffix`` option will let you specify that suffix to the
1037 test machinery. You can use ``./gmxtest.pl -double`` to test the
1038 double-precision version. You can use ``./gmxtest.pl -crosscompiling``
1039 to stop the test harness attempting to check that the programs can
1040 be run. You can use ``./gmxtest.pl -mpirun srun`` if your command to
1041 run an MPI program is called ``srun``.
1042
1043 Running MPI-enabled tests
1044 ~~~~~~~~~~~~~~~~~~~~~~~~~
1045
1046 The ``make check`` target also runs integration-style tests that may run
1047 with MPI if ``GMX_MPI=ON`` was set. To make these work with various possible
1048 MPI libraries, you may need to
1049 set the CMake variables ``MPIEXEC``, ``MPIEXEC_NUMPROC_FLAG``,
1050 ``MPIEXEC_PREFLAGS`` and ``MPIEXEC_POSTFLAGS`` so that
1051 ``mdrun-mpi-test_mpi`` would run on multiple ranks via the shell command
1052
1053 ::
1054
1055     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC} ${MPIEXEC_PREFLAGS} \
1056           mdrun-mpi-test_mpi ${MPIEXEC_POSTFLAGS} -otherflags
1057
1058 A typical example for SLURM is
1059
1060 ::
1061
1062      cmake .. -DGMX_MPI=on -DMPIEXEC=srun -DMPIEXEC_NUMPROC_FLAG=-n -DMPIEXEC_PREFLAGS= -DMPIEXEC_POSTFLAGS=
1063
1064
1065 Testing |Gromacs| for performance
1066 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1067
1068 We are still working on a set of benchmark systems for testing
1069 the performance of |Gromacs|. Until that is ready, we recommend that
1070 you try a few different parallelization options, and experiment with
1071 tools such as ``gmx tune_pme``.
1072
1073 Validating |Gromacs| for source code modifications
1074 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1075
1076 When building |Gromacs| from a release tarball, the build process automatically
1077 checks if any file contributing to the build process have been modified since they have
1078 been packed in the archive. This results in the marking of the version as either ``MODIFIED``
1079 (if the source files have been modified) or ``UNCHECKED`` (if no validation was possible, e.g.
1080 if no Python installation was found). The actual checking is performed by comparing a checksum
1081 stored in the release tarball against one generated by the ``createFileHash.py`` Python script
1082 during the build configuration. When running a |Gromacs| binary, the checksum is also printed
1083 in the log file, together with a message if there is a mismatch or no validation has been possible.
1084
1085 This allows users to check whether the binary they are using was built from source code that is
1086 identical to the source code released by the |Gromacs| team. Thus unintentional modifications
1087 to the source code for building binaries that are used for running production simulations
1088 are easily detectable. Additionally, by manually setting a version tag using the
1089 GMX_VERSION_STRING_OF_FORK cmake option, users can mark a modified |Gromacs| release
1090 code with their custom version string suffix.
1091
1092 Having difficulty?
1093 ^^^^^^^^^^^^^^^^^^
1094
1095 You are not alone - this can be a complex task! If you encounter a
1096 problem with installing |Gromacs|, then there are a number of
1097 locations where you can find assistance. It is recommended that you
1098 follow these steps to find the solution:
1099
1100 1. Read the installation instructions again, taking note that you
1101    have followed each and every step correctly.
1102
1103 2. Search the |Gromacs| webpage_ and users emailing list for information
1104    on the error. Adding
1105    ``site:https://mailman-1.sys.kth.se/pipermail/gromacs.org_gmx-users``
1106    to a Google search may help filter better results.
1107
1108 3. Search the internet using a search engine such as Google.
1109
1110 4. Post to the |Gromacs| users emailing list gmx-users for
1111    assistance. Be sure to give a full description of what you have
1112    done and why you think it did not work. Give details about the
1113    system on which you are installing.  Copy and paste your command
1114    line and as much of the output as you think might be relevant -
1115    certainly from the first indication of a problem. In particular,
1116    please try to include at least the header from the mdrun logfile,
1117    and preferably the entire file.  People who might volunteer to help
1118    you do not have time to ask you interactive detailed follow-up
1119    questions, so you will get an answer faster if you provide as much
1120    information as you think could possibly help. High quality bug
1121    reports tend to receive rapid high quality answers.
1122
1123 .. _gmx-special-build:
1124
1125 Special instructions for some platforms
1126 ---------------------------------------
1127
1128 Building on Windows
1129 ^^^^^^^^^^^^^^^^^^^
1130
1131 Building on Windows using native compilers is rather similar to
1132 building on Unix, so please start by reading the above. Then, download
1133 and unpack the |Gromacs| source archive. Make a folder in which to do
1134 the out-of-source build of |Gromacs|. For example, make it within the
1135 folder unpacked from the source archive, and call it ``build-gromacs``.
1136
1137 For CMake, you can either use the graphical user interface provided on
1138 Windows, or you can use a command line shell with instructions similar
1139 to the UNIX ones above. If you open a shell from within your IDE
1140 (e.g. Microsoft Visual Studio), it will configure the environment for
1141 you, but you might need to tweak this in order to get either a 32-bit
1142 or 64-bit build environment. The latter provides the fastest
1143 executable. If you use a normal Windows command shell, then you will
1144 need to either set up the environment to find your compilers and
1145 libraries yourself, or run the ``vcvarsall.bat`` batch script provided
1146 by MSVC (just like sourcing a bash script under Unix).
1147
1148 With the graphical user interface, you will be asked about what
1149 compilers to use at the initial configuration stage, and if you use
1150 the command line they can be set in a similar way as under UNIX.
1151
1152 Unfortunately ``-DGMX_BUILD_OWN_FFTW=ON`` (see `Using FFTW`_) does not
1153 work on Windows, because there is no supported way to build FFTW on
1154 Windows. You can either build FFTW some other way (e.g. MinGW), or
1155 use the built-in fftpack (which may be slow), or `using MKL`_.
1156
1157 For the build, you can either load the generated solutions file into
1158 e.g. Visual Studio, or use the command line with ``cmake --build`` so
1159 the right tools get used.
1160
1161 Building on Cray
1162 ^^^^^^^^^^^^^^^^
1163
1164 |Gromacs| builds mostly out of the box on modern Cray machines, but
1165 you may need to specify the use of static binaries with
1166 ``-DGMX_BUILD_SHARED_EXE=off``, and you may need to set the F77
1167 environmental variable to ``ftn`` when compiling FFTW.
1168 The ARM ThunderX2 Cray XC50 machines differ only in that the recommended
1169 compiler is the ARM HPC Compiler (``armclang``).
1170
1171
1172 Building on Solaris
1173 ^^^^^^^^^^^^^^^^^^^
1174
1175 The built-in |Gromacs| processor detection does not work on Solaris,
1176 so it is strongly recommended that you build |Gromacs| with
1177 ``-DGMX_HWLOC=on`` and ensure that the ``CMAKE_PREFIX_PATH`` includes
1178 the path where the hwloc headers and libraries can be found. At least
1179 version 1.11.8 of hwloc is recommended.
1180
1181 Oracle Developer Studio is not a currently supported compiler (and
1182 does not currently compile |Gromacs| correctly, perhaps because the
1183 thread-MPI atomics are incorrectly implemented in |Gromacs|).
1184
1185 Intel Xeon Phi
1186 ^^^^^^^^^^^^^^
1187
1188 Xeon Phi processors, hosted or self-hosted, are supported.
1189 The Knights Landing-based Xeon Phi processors behave like standard x86 nodes,
1190 but support a special SIMD instruction set. When cross-compiling for such nodes,
1191 use the ``AVX_512_KNL`` SIMD flavor.
1192 Knights Landing processors support so-called "clustering modes" which
1193 allow reconfiguring the memory subsystem for lower latency. |Gromacs| can
1194 benefit from the quadrant or SNC clustering modes.
1195 Care needs to be taken to correctly pin threads. In particular, threads of
1196 an MPI rank should not cross cluster and NUMA boundaries.
1197 In addition to the main DRAM memory, Knights Landing has a high-bandwidth
1198 stacked memory called MCDRAM. Using it offers performance benefits if
1199 it is ensured that ``mdrun`` runs entirely from this memory; to do so
1200 it is recommended that MCDRAM is configured in "Flat mode" and ``mdrun`` is
1201 bound to the appropriate NUMA node (use e.g. ``numactl --membind 1`` with
1202 quadrant clustering mode).
1203
1204
1205 Tested platforms
1206 ----------------
1207
1208 While it is our best belief that |Gromacs| will build and run pretty
1209 much everywhere, it is important that we tell you where we really know
1210 it works because we have tested it.
1211 Every commit in our git source code repository
1212 is currently tested with a range of configuration options on x86 with
1213 gcc versions 7 and 8,
1214 clang versions 8 and 9,
1215 and
1216 a version of oneAPI containing Intel's clang-based compiler.
1217 For this testing, we use Ubuntu 18.04 or 20.04 operating system.
1218 Other compiler, library, and OS versions are tested less frequently.
1219 For details, you can have a look at the
1220 `continuous integration server used by GROMACS <https://gitlab.com/gromacs/gromacs/>`_,
1221 which uses GitLab runner on a local k8s x86 cluster with NVIDIA and
1222 AMD GPU support.
1223
1224 We test irregularly on ARM v8, Cray, Power8, Power9,
1225 Google Native Client and other environments, and
1226 with other compilers and compiler versions, too.