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