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