Merge remote-tracking branch 'origin/release-5-1' into master
[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 |GMX_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| will
42 be correct and reasonably fast on the machine upon which ``cmake``
43 ran. If you want to get the maximum value for your hardware with
44 |Gromacs|, you will have to read further. Sadly, the interactions of
45 hardware, libraries, and compilers are only going to continue to get
46 more complex.
47
48 Typical installation
49 --------------------
50 As above, and with further details below, but you should consider
51 using the following `CMake options`_ with the
52 appropriate value instead of ``xxx`` :
53
54 * ``-DCMAKE_C_COMPILER=xxx`` equal to the name of the C99 `Compiler`_ you wish to use (or the environment variable ``CC``)
55 * ``-DCMAKE_CXX_COMPILER=xxx`` equal to the name of the C++98 `compiler`_ you wish to use (or the environment variable ``CXX``)
56 * ``-DGMX_MPI=on`` to build using `MPI support`_
57 * ``-DGMX_GPU=on`` to build using nvcc to run using NVIDIA `native GPU acceleration`_ or an OpenCL_ GPU
58 * ``-DGMX_USE_OPENCL=on`` to build with OpenCL_ support enabled. ``GMX_GPU`` must also be set.
59 * ``-DGMX_SIMD=xxx`` to specify the level of `SIMD support`_ of the node on which |Gromacs| will run
60 * ``-DGMX_BUILD_MDRUN_ONLY=on`` for `building only mdrun`_, e.g. for compute cluster back-end nodes
61 * ``-DGMX_DOUBLE=on`` to build |Gromacs| in double precision (slower, and not normally useful)
62 * ``-DCMAKE_PREFIX_PATH=xxx`` to add a non-standard location for CMake to `search for libraries, headers or programs`_
63 * ``-DCMAKE_INSTALL_PREFIX=xxx`` to install |Gromacs| to a `non-standard location`_ (default ``/usr/local/gromacs``)
64 * ``-DBUILD_SHARED_LIBS=off`` to turn off the building of shared libraries to help with `static linking`_
65 * ``-DGMX_FFT_LIBRARY=xxx`` to select whether to use ``fftw``, ``mkl`` or ``fftpack`` libraries for `FFT support`_
66 * ``-DCMAKE_BUILD_TYPE=Debug`` to build |Gromacs| in debug mode
67
68 Building older versions
69 -----------------------
70 For installation instructions for old |Gromacs| versions, see the
71 documentation for installing
72 `GROMACS 4.5 <http://www.gromacs.org/Documentation/Installation_Instructions_4.5>`_,
73 `GROMACS 4.6 <http://www.gromacs.org/Documentation/Installation_Instructions_4.6>`_,
74 and
75 `GROMACS 5.0 <http://www.gromacs.org/Documentation/Installation_Instructions_5.0>`_.
76
77 Prerequisites
78 =============
79 Platform
80 --------
81 |Gromacs| can be compiled for many operating systems and architectures.
82 These include any distribution of Linux, Mac OS X or Windows, and
83 architectures including x86, AMD64/x86-64, PPC, ARM v7 and SPARC VIII.
84
85 Compiler
86 --------
87 Technically, |Gromacs| can be compiled on any platform with an ANSI C99
88 and C++11 compiler, and their respective standard C/C++ libraries.
89 GROMACS uses a subset of C99 and C++11. A not fully standard compliant
90 compiler might be able to compile GROMACS.
91 Getting good performance on an OS and architecture requires choosing a
92 good compiler. In practice, many compilers struggle to do a good job
93 optimizing the |Gromacs| architecture-optimized SIMD kernels.
94
95 C++11 support requires both support in the compiler as well as in the
96 C++ library. Multiple compilers do not provide their own library
97 but use the system library. It is required to select a library with
98 sufficient C++11 support. Both the Intel and clang compiler on Linux use
99 the libstdc++ which comes with gcc as the default C++ library. 4.6.1 of
100 that library is required. Also the C++ library version has to be
101 supported by the compiler. To select the C++ library version use:
102
103 * For Intel: ``CXXFLAGS=-gcc-name=/path/to/gcc/binary`` or make sure
104   that the correct gcc version is first in path (e.g. by loading the gcc
105   module)
106 * For clang: ``CFLAGS=--gcc-toolchain=/path/to/gcc/folder
107   CXXFLAGS=--gcc-toolchain=/path/to/gcc/folder``. This folder should
108   contain ``include/c++``.
109 * On Windows with e.g. Intel: at least MSVC 2013 is required. Load the
110   enviroment with vcvarsall.bat.
111
112 For best performance, the |Gromacs| team strongly recommends you get the
113 most recent version of your preferred compiler for your platform.
114 There is a large amount of |Gromacs| code that depends on effective
115 compiler optimization to get high performance. This makes |Gromacs|
116 performance sensitive to the compiler used, and the binary will often
117 only work on the hardware for which it is compiled.
118
119 * In particular, |Gromacs| includes a lot of explicit SIMD (single
120   instruction, multiple data) optimization that suits
121   modern processors. This can greatly increase
122   performance, but for recent processors you
123   also need a similarly recent compiler to get this benefit. The
124   configuration does a good job at detecting this, and you will
125   usually get warnings if |Gromacs| and your hardware support a more
126   recent instruction set than your compiler.
127
128 * On Intel-based x86 hardware, we recommend you to use the GNU
129   compilers version 4.7 or later or Intel compilers version 12 or
130   later for best performance. The Intel compiler has historically been
131   better at instruction scheduling, but recent gcc versions have
132   proved to be as fast or sometimes faster than Intel.
133
134 * The Intel and GNU compilers produce much faster |Gromacs| executables
135   than the PGI and Cray compilers.
136
137 * On AMD-based x86 hardware up through the "K10" microarchitecture
138   ("Family 10h") Thuban/Magny-Cours architecture (e.g. Opteron
139   6100-series processors), it is worth using the Intel compiler for
140   better performance, but gcc version 4.7 and later are also
141   reasonable.
142
143 * On the AMD Bulldozer architecture (Opteron 6200), AMD introduced
144   fused multiply-add instructions and an "FMA4" instruction format not
145   available on Intel x86 processors. Thus, on the most recent AMD
146   processors you want to use gcc version 4.7 or later for best
147   performance! The Intel compiler will only generate code for the
148   subset also supported by Intel processors, and that is significantly
149   slower.
150
151 * If you are running on Mac OS X, the best option is the Intel
152   compiler. Both clang and gcc will work, but they produce lower
153   performance and each have some shortcomings. Current clang does not
154   support OpenMP. This may change when clang 3.7 becomes available.
155
156 * For all non-x86 platforms, your best option is typically to use the
157   vendor's default or recommended compiler, and check for specialized
158   information below.
159
160 Compiling with parallelization options
161 --------------------------------------
162
163 For maximum performance you will need to examine how you will use
164 |Gromacs| and what hardware you plan to run on. Unfortunately, the
165 only way to find out is to test different options and parallelization
166 schemes for the actual simulations you want to run. You will still get
167 *good*, performance with the default build and runtime options, but if
168 you truly want to push your hardware to the performance limit, the
169 days of just blindly starting programs with ``gmx mdrun`` are gone.
170
171 GPU support
172 ^^^^^^^^^^^
173 If you wish to use the excellent native GPU support in |Gromacs|,
174 NVIDIA's CUDA_ version |REQUIRED_CUDA_VERSION| software development kit is required,
175 and the latest version is strongly encouraged. NVIDIA GPUs with at
176 least NVIDIA compute capability |REQUIRED_CUDA_COMPUTE_CAPABILITY| are
177 required, e.g. Fermi or Kepler cards. You are strongly recommended to
178 get the latest CUDA version and driver supported by your hardware, but
179 beware of possible performance regressions in newer CUDA versions on
180 older hardware. Note that while some CUDA compilers (nvcc) might not
181 officially support recent versions of gcc as the back-end compiler, we
182 still recommend that you at least use a gcc version recent enough to
183 get the best SIMD support for your CPU, since |Gromacs| always runs some
184 code on the CPU. It is most reliable to use the same C++ compiler
185 version for |Gromacs| code as used as the back-end compiler for nvcc,
186 but it could be faster to mix compiler versions to suit particular
187 contexts.
188
189 To make it possible to use other accelerators, |Gromacs| also includes
190 OpenCL_ support. The current version is recommended for use with
191 GCN-based AMD GPUs. It does work with NVIDIA GPUs, but using the latest
192 NVIDIA driver (which includes the NVIDIA OpenCL runtime) is recommended,
193 and please see the known limitations in the |Gromacs| user guide. The
194 minimum OpenCL version required is |REQUIRED_OPENCL_MIN_VERSION|.
195
196 It is not possible to configure both CUDA and OpenCL support in the
197 same version of |Gromacs|.
198
199 .. _mpi-support:
200
201 MPI support
202 ^^^^^^^^^^^
203
204 |Gromacs| can run in parallel on multiple cores of a single
205 workstation using its built-in thread-MPI. No user action is required
206 in order to enable this.
207
208 If you wish to run in parallel on multiple machines across a network,
209 you will need to have
210
211 * an MPI library installed that supports the MPI 1.3
212   standard, and
213 * wrapper compilers that will compile code using that library.
214
215 The |Gromacs| team recommends OpenMPI_ version
216 1.6 (or higher), MPICH_ version 1.4.1 (or
217 higher), or your hardware vendor's MPI installation. The most recent
218 version of either of these is likely to be the best. More specialized
219 networks might depend on accelerations only available in the vendor's
220 library. LAM-MPI_ might work, but since it has
221 been deprecated for years, it is not supported.
222
223 Often OpenMP_ parallelism is an
224 advantage for |Gromacs|, but support for this is generally built into
225 your compiler and detected automatically.
226
227 CMake
228 -----
229 |Gromacs| uses the CMake build system, and requires
230 version |GMX_CMAKE_MINIMUM_REQUIRED_VERSION| or higher. Lower versions
231 will not work. You can check whether CMake is installed, and what
232 version it is, with ``cmake --version``. If you need to install CMake,
233 then first check whether your platform's package management system
234 provides a suitable version, or visit the `CMake installation page`_
235 for pre-compiled
236 binaries, source code and installation instructions. The |Gromacs| team
237 recommends you install the most recent version of CMake you can.
238
239 .. _FFT support:
240
241 Fast Fourier Transform library
242 ------------------------------
243 Many simulations in |Gromacs| make extensive use of fast Fourier
244 transforms, and a software library to perform these is always
245 required. We recommend FFTW_ (version 3 or higher only) or
246 Intel MKL_. The choice of
247 library can be set with ``cmake -DGMX_FFT_LIBRARY=<name>``, where
248 ``<name>`` is one of ``fftw``, ``mkl``, or ``fftpack``. FFTPACK is bundled
249 with |Gromacs| as a fallback, and is acceptable if mdrun performance is
250 not a priority.
251
252 Using FFTW
253 ^^^^^^^^^^
254 FFTW_ is likely to be available for your platform via its package
255 management system, but there can be compatibility and significant
256 performance issues associated with these packages. In particular,
257 |Gromacs| simulations are normally run in "mixed" floating-point
258 precision, which is suited for the use of single precision in
259 FFTW. The default FFTW package is normally in double
260 precision, and good compiler options to use for FFTW when linked to
261 |Gromacs| may not have been used. Accordingly, the |Gromacs| team
262 recommends either
263
264 * that you permit the |Gromacs| installation to download and
265   build FFTW from source automatically for you (use
266   ``cmake -DGMX_BUILD_OWN_FFTW=ON``), or
267 * that you build FFTW from the source code.
268
269 If you build FFTW from source yourself, get the most recent version
270 and follow the `FFTW installation guide`_. Note that we have recently
271 contributed new SIMD optimization for several extra platforms to
272 FFTW, which will appear in FFTW-3.3.5 (for now it is available in the
273 FFTW repository on github, or you can find a very unofficial prerelease
274 version at ftp://ftp.gromacs.org/pub/prerequisite_software ).
275 Choose the precision for FFTW (i.e. single/float vs. double) to
276 match whether you will later use mixed or double precision for
277 |Gromacs|. There is no need to compile FFTW with
278 threading or MPI support, but it does no harm. On x86 hardware,
279 compile with *both* ``--enable-sse2`` and ``--enable-avx`` for
280 FFTW-3.3.4 and earlier. As of FFTW-3.3.5 you should also add
281 ``--enable-avx2``. FFTW will create a fat library with codelets
282 for all different instruction sets, and pick the fastest supported
283 one at runtime. On IBM Power8, you definitely want the upcoming
284 FFTW-3.3.5 and use ``--enable-vsx`` for SIMD support. If you are
285 using a Cray, there is a special modified (commercial) version of
286 FFTs using the FFTW interface which might be faster, but we have
287 not yet tested this extensively.
288
289 Using MKL
290 ^^^^^^^^^
291 Using MKL_ with the Intel Compilers version 11 or higher is very
292 simple. Set up your compiler environment correctly, perhaps with a
293 command like ``source /path/to/compilervars.sh intel64`` (or consult
294 your local documentation). Then set ``-DGMX_FFT_LIBRARY=mkl`` when you
295 run cmake. In this case, |Gromacs| will also use MKL for BLAS and LAPACK
296 (see `linear algebra libraries`_). Generally,
297 there is no advantage in using MKL with |Gromacs|, and FFTW is often
298 faster.
299
300 Otherwise, you can get your hands dirty and configure MKL by setting
301
302 ::
303
304     -DGMX_FFT_LIBRARY=mkl
305     -DMKL_LIBRARIES="/full/path/to/libone.so;/full/path/to/libtwo.so"
306     -DMKL_INCLUDE_DIR="/full/path/to/mkl/include"
307
308 where the full list (and order!) of libraries you require are found in
309 Intel's MKL documentation for your system.
310
311 Optional build components
312 -------------------------
313 * Compiling to run on NVIDIA GPUs requires CUDA_
314 * Compiling to run on AMD GPUs requires OpenCL_
315 * Hardware-optimized BLAS and LAPACK libraries are useful
316   for a few of the |Gromacs| utilities focused on normal modes and
317   matrix manipulation, but they do not provide any benefits for normal
318   simulations. Configuring these is discussed at
319   `linear algebra libraries`_.
320 * The built-in |Gromacs| trajectory viewer ``gmx view`` requires X11 and
321   Motif/Lesstif libraries and header files. You may prefer to use
322   third-party software for visualization, such as VMD_ or PyMol_.
323 * An external TNG library for trajectory-file handling can be used,
324   but TNG 1.7.6 is bundled in the |Gromacs| source already
325 * zlib is used by TNG for compressing some kinds of trajectory data
326 * Running the |Gromacs| test suite requires libxml2
327 * Building the |Gromacs| documentation requires ImageMagick, pdflatex,
328   bibtex, doxygen, python 2.7, sphinx and pygments.
329 * The |Gromacs| utility programs often write data files in formats
330   suitable for the Grace plotting tool, but it is straightforward to
331   use these files in other plotting programs, too.
332
333 Doing a build of |Gromacs|
334 ==========================
335 This section will cover a general build of |Gromacs| with CMake_, but it
336 is not an exhaustive discussion of how to use CMake. There are many
337 resources available on the web, which we suggest you search for when
338 you encounter problems not covered here. The material below applies
339 specifically to builds on Unix-like systems, including Linux, and Mac
340 OS X. For other platforms, see the specialist instructions below.
341
342 Configuring with CMake
343 ----------------------
344 CMake will run many tests on your system and do its best to work out
345 how to build |Gromacs| for you. If your build machine is the same as
346 your target machine, then you can be sure that the defaults will be
347 pretty good. The build configuration will for instance attempt to
348 detect the specific hardware instructions available in your
349 processor. However, if you want to control aspects of the build, or
350 you are compiling on a cluster head node for back-end nodes with a
351 different architecture, there are plenty of things you can set
352 manually.
353
354 The best way to use CMake to configure |Gromacs| is to do an
355 "out-of-source" build, by making another directory from which you will
356 run CMake. This can be outside the source directory, or a subdirectory
357 of it. It also means you can never corrupt your source code by trying
358 to build it! So, the only required argument on the CMake command line
359 is the name of the directory containing the ``CMakeLists.txt`` file of
360 the code you want to build. For example, download the source tarball
361 and use
362
363 .. parsed-literal::
364
365     tar xfz gromacs-|version|.tgz
366     cd gromacs-|version|
367     mkdir build-gromacs
368     cd build-gromacs
369     cmake ..
370
371 You will see ``cmake`` report a sequence of results of tests and
372 detections done by the |Gromacs| build system. These are written to the
373 ``cmake`` cache, kept in ``CMakeCache.txt``. You can edit this file by
374 hand, but this is not recommended because you could make a mistake.
375 You should not attempt to move or copy this file to do another build,
376 because file paths are hard-coded within it. If you mess things up,
377 just delete this file and start again with ``cmake``.
378
379 If there is a serious problem detected at this stage, then you will see
380 a fatal error and some suggestions for how to overcome it. If you are
381 not sure how to deal with that, please start by searching on the web
382 (most computer problems already have known solutions!) and then
383 consult the gmx-users mailing list. There are also informational
384 warnings that you might like to take on board or not. Piping the
385 output of ``cmake`` through ``less`` or ``tee`` can be
386 useful, too.
387
388 Once ``cmake`` returns, you can see all the settings that were chosen
389 and information about them by using e.g. the curses interface
390
391 ::
392
393     ccmake ..
394
395 You can actually use ``ccmake`` (available on most Unix platforms)
396 directly in the first step, but then
397 most of the status messages will merely blink in the lower part
398 of the terminal rather than be written to standard output. Most platforms
399 including Linux, Windows, and Mac OS X even have native graphical user interfaces for
400 ``cmake``, and it can create project files for almost any build environment
401 you want (including Visual Studio or Xcode).
402 Check out `running CMake`_ for
403 general advice on what you are seeing and how to navigate and change
404 things. The settings you might normally want to change are already
405 presented. You may make changes, then re-configure (using ``c``), so that it
406 gets a chance to make changes that depend on yours and perform more
407 checking. It may take several configuration passes to reach the desired
408 configuration, in particular if you need to resolve errors.
409
410 When you have reached the desired configuration with ``ccmake``, the
411 build system can be generated by pressing ``g``.  This requires that the previous
412 configuration pass did not reveal any additional settings (if it did, you need
413 to configure once more with ``c``).  With ``cmake``, the build system is generated
414 after each pass that does not produce errors.
415
416 You cannot attempt to change compilers after the initial run of
417 ``cmake``. If you need to change, clean up, and start again.
418
419 .. _non-standard location:
420
421 Where to install GROMACS
422 ^^^^^^^^^^^^^^^^^^^^^^^^
423
424 A key thing to consider here is the setting of
425 ``CMAKE_INSTALL_PREFIX`` to control where |Gromacs| will be installed.
426 You will need permissions to be able to write to this directory.
427 So if you do not have super-user privileges on your
428 machine, then you will need to choose a sensible location within your
429 home directory for your |Gromacs| installation. Even if you do have
430 super-user privileges, you should use them only for the installation
431 phase, and never for configuring, building, or running |Gromacs|!
432
433 .. _cmake options:
434
435 Using CMake command-line options
436 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
437 Once you become comfortable with setting and changing options, you may
438 know in advance how you will configure |Gromacs|. If so, you can speed
439 things up by invoking ``cmake`` and passing the various options at once
440 on the command line. This can be done by setting cache variable at the
441 cmake invocation using ``-DOPTION=VALUE``. Note that some
442 environment variables are also taken into account, in particular
443 variables like ``CC`` and ``CXX``.
444
445 For example, the following command line
446
447 ::
448
449     cmake .. -DGMX_GPU=ON -DGMX_MPI=ON -DCMAKE_INSTALL_PREFIX=/home/marydoe/programs
450
451 can be used to build with CUDA GPUs, MPI and install in a custom
452 location. You can even save that in a shell script to make it even
453 easier next time. You can also do this kind of thing with ``ccmake``,
454 but you should avoid this, because the options set with ``-D`` will not
455 be able to be changed interactively in that run of ``ccmake``.
456
457 SIMD support
458 ^^^^^^^^^^^^
459 |Gromacs| has extensive support for detecting and using the SIMD
460 capabilities of many modern HPC CPU architectures. If you are building
461 |Gromacs| on the same hardware you will run it on, then you don't need
462 to read more about this, unless you are getting configuration warnings
463 you do not understand. By default, the |Gromacs| build system will
464 detect the SIMD instruction set supported by the CPU architecture (on
465 which the configuring is done), and thus pick the best
466 available SIMD parallelization supported by |Gromacs|. The build system
467 will also check that the compiler and linker used also support the
468 selected SIMD instruction set and issue a fatal error if they
469 do not.
470
471 Valid values are listed below, and the applicable value with the
472 largest number in the list is generally the one you should choose:
473
474 1. ``None`` For use only on an architecture either lacking SIMD,
475    or to which |Gromacs| has not yet been ported and none of the
476    options below are applicable.
477 2. ``SSE2`` This SIMD instruction set was introduced in Intel
478    processors in 2001, and AMD in 2003. Essentially all x86
479    machines in existence have this, so it might be a good choice if
480    you need to support dinosaur x86 computers too.
481 3. ``SSE4.1`` Present in all Intel core processors since 2007,
482    but notably not in AMD Magny-Cours. Still, almost all recent
483    processors support this, so this can also be considered a good
484    baseline if you are content with portability between reasonably
485    modern processors.
486 4. ``AVX_128_FMA`` AMD bulldozer processors (2011) have this.
487    Unfortunately Intel and AMD have diverged the last few years;
488    If you want good performance on modern AMD processors
489    you have to use this since it also allows the rest of the
490    code to use AMD 4-way fused multiply-add instructions. The drawback
491    is that your code will not run on Intel processors at all.
492 5. ``AVX_256`` This instruction set is present on Intel processors
493    since Sandy Bridge (2011), where it is the best choice unless
494    you have an even more recent CPU that supports AVX2. While this
495    code will work on recent AMD processors, it is significantly
496    less efficient than the ``AVX_128_FMA`` choice above - do not be
497    fooled to assume that 256 is better than 128 in this case.
498 6. ``AVX2_256`` Present on Intel Haswell (and later) processors (2013),
499    and it will also enable Intel 3-way fused multiply-add instructions.
500    This code will not work on AMD CPUs.
501 7. ``IBM_QPX`` BlueGene/Q A2 cores have this.
502 8. ``Sparc64_HPC_ACE`` Fujitsu machines like the K computer have this.
503 9. ``IBM_VMX`` Power6 and similar Altivec processors have this.
504 10. ``IBM_VSX`` Power7 and Power8 have this.
505
506 The CMake configure system will check that the compiler you have
507 chosen can target the architecture you have chosen. mdrun will check
508 further at runtime, so if in doubt, choose the lowest number you
509 think might work, and see what mdrun says. The configure system also
510 works around many known issues in many versions of common HPC
511 compilers.
512
513 A further ``GMX_SIMD=Reference`` option exists, which is a special
514 SIMD-like implementation written in plain C that developers can use
515 when developing support in |Gromacs| for new SIMD architectures. It is
516 not designed for use in production simulations, but if you are using
517 an architecture with SIMD support to which |Gromacs| has not yet been
518 ported, you may wish to try this option instead of the default
519 ``GMX_SIMD=None``, as it can often out-perform this when the
520 auto-vectorization in your compiler does a good job. And post on the
521 |Gromacs| mailing lists, because |Gromacs| can probably be ported for new
522 SIMD architectures in a few days.
523
524 CMake advanced options
525 ^^^^^^^^^^^^^^^^^^^^^^
526 The options that are displayed in the default view of ``ccmake`` are
527 ones that we think a reasonable number of users might want to consider
528 changing. There are a lot more options available, which you can see by
529 toggling the advanced mode in ``ccmake`` on and off with ``t``. Even
530 there, most of the variables that you might want to change have a
531 ``CMAKE_`` or ``GMX_`` prefix. There are also some options that will be
532 visible or not according to whether their preconditions are satisfied.
533
534 .. _search for libraries, headers or programs:
535
536 Helping CMake find the right libraries, headers, or programs
537 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
538 If libraries are installed in non-default locations their location can
539 be specified using the following variables:
540
541 * ``CMAKE_INCLUDE_PATH`` for header files
542 * ``CMAKE_LIBRARY_PATH`` for libraries
543 * ``CMAKE_PREFIX_PATH`` for header, libraries and binaries
544   (e.g. ``/usr/local``).
545
546 The respective ``include``, ``lib``, or ``bin`` is
547 appended to the path. For each of these variables, a list of paths can
548 be specified (on Unix, separated with ":"). These can be set as
549 enviroment variables like:
550
551 ::
552
553     CMAKE_PREFIX_PATH=/opt/fftw:/opt/cuda cmake ..
554
555 (assuming ``bash`` shell). Alternatively, these variables are also
556 ``cmake`` options, so they can be set like
557 ``-DCMAKE_PREFIX_PATH=/opt/fftw:/opt/cuda``.
558
559 The ``CC`` and ``CXX`` environment variables are also useful
560 for indicating to ``cmake`` which compilers to use, which can be very
561 important for maximising |Gromacs| performance. Similarly,
562 ``CFLAGS``/``CXXFLAGS`` can be used to pass compiler
563 options, but note that these will be appended to those set by
564 |Gromacs| for your build platform and build type. You can customize
565 some of this with advanced options such as ``CMAKE_C_FLAGS``
566 and its relatives.
567
568 See also the page on `CMake environment variables`_.
569
570 .. _Native GPU acceleration:
571
572 Native CUDA GPU acceleration
573 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
574 If you have the CUDA_ Toolkit installed, you can use ``cmake`` with:
575
576 ::
577
578     cmake .. -DGMX_GPU=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
579
580 (or whichever path has your installation). In some cases, you might
581 need to specify manually which of your C++ compilers should be used,
582 e.g. with the advanced option ``CUDA_HOST_COMPILER``.
583
584 To make it
585 possible to get best performance from NVIDIA Tesla and Quadro GPUs,
586 you should install the `GPU Deployment Kit
587 <https://developer.nvidia.com/gpu-deployment-kit>`_ and configure
588 |Gromacs| to use it by setting the CMake variable
589 ``-DGPU_DEPLOYMENT_KIT_ROOT_DIR=/path/to/your/kit``. The NVML support
590 is most useful if
591 ``nvidia-smi --applications-clocks-permission=UNRESTRICTED`` is run
592 (as root). When application clocks permissions are unrestricted, the
593 GPU clock speed can be increased automatically, which increases the
594 GPU kernel performance roughly proportional to the clock
595 increase. When using |Gromacs| on suitable GPUs under restricted
596 permissions, clocks cannot be changed, and in that case informative
597 log file messages will be produced. Background details can be found at
598 this `NVIDIA blog post
599 <http://devblogs.nvidia.com/parallelforall/increase-performance-gpu-boost-k80-autoboost/>`_.
600 NVML support is only available if detected, and may be disabled by
601 turning off the ``GMX_USE_NVML`` CMake advanced option.
602
603 By default, optimized code will be generated for CUDA architectures
604 supported by the nvcc compiler (and the |Gromacs| build system). 
605 However, it can be beneficial to manually pick the specific CUDA architecture(s)
606 to generate code for either to reduce compilation time (and binary size) or to
607 target a new architecture not yet supported by the |GROMACS| build system.
608 Setting the desired CUDA architecture(s) and virtual architecture(s)
609 can be done using the ``GMX_CUDA_TARGET_SM`` and ``GMX_CUDA_TARGET_COMPUTE``
610 variables, respectively. These take a semicolon delimited string with 
611 the two digit suffixes of CUDA (virtual) architectures names
612 (for details see the "Options for steering GPU code generation" section of the
613 nvcc man / help or Chapter 6. of the nvcc manual).
614
615 The GPU acceleration has been tested on AMD64/x86-64 platforms with
616 Linux, Mac OS X and Windows operating systems, but Linux is the
617 best-tested and supported of these. Linux running on ARM v7 (32 bit)
618 CPUs also works.
619
620 OpenCL GPU acceleration
621 ^^^^^^^^^^^^^^^^^^^^^^^
622 To build Gromacs with OpenCL support enabled, an OpenCL_ SDK
623 (e.g. `from AMD <http://developer.amd.com/appsdk>`_) must be installed
624 in a path found in ``CMAKE_PREFIX_PATH`` (or via the environment
625 variables ``AMDAPPSDKROOT`` or ``CUDA_PATH``), and the following CMake
626 flags must be set
627
628 ::
629
630     cmake .. -DGMX_GPU=ON -DGMX_USE_OPENCL=ON
631
632 Building |Gromacs| OpenCL support for a CUDA_ GPU works, but see the
633 known limitations in the user guide. If you want to
634 do so anyway, because NVIDIA OpenCL support is part of the CUDA
635 package, a C++ compiler supported by your CUDA installation is
636 required.
637
638 On Mac OS, an AMD GPU can be used only with OS version 10.10.4 and
639 higher; earlier OS versions are known to run incorrectly.
640
641 Static linking
642 ^^^^^^^^^^^^^^
643 Dynamic linking of the |Gromacs| executables will lead to a
644 smaller disk footprint when installed, and so is the default on
645 platforms where we believe it has been tested repeatedly and found to work.
646 In general, this includes Linux, Windows, Mac OS X and BSD systems.
647 Static binaries take much more space, but on some hardware and/or under
648 some conditions they are necessary, most commonly when you are running a parallel
649 simulation using MPI libraries (e.g. BlueGene, Cray).
650
651 * To link |Gromacs| binaries statically against the internal |Gromacs|
652   libraries, set ``-DBUILD_SHARED_LIBS=OFF``.
653 * To link statically against external (non-system) libraries as well,
654   set ``-DGMX_PREFER_STATIC_LIBS=ON``. Note, that in
655   general ``cmake`` picks up whatever is available, so this option only
656   instructs ``cmake`` to prefer static libraries when both static and
657   shared are available. If no static version of an external library is
658   available, even when the aforementioned option is ``ON``, the shared
659   library will be used. Also note that the resulting binaries will
660   still be dynamically linked against system libraries on platforms
661   where that is the default. To use static system libraries,
662   additional compiler/linker flags are necessary, e.g. ``-static-libgcc
663   -static-libstdc++``.
664 * To attempt to link a fully static binary set
665   ``-DGMX_BUILD_SHARED_EXE=OFF``. This will prevent CMake from explicitly
666   setting any dynamic linking flags. This option also sets
667   ``-DBUILD_SHARED_LIBS=OFF`` and ``-DGMX_PREFER_STATIC_LIBS=ON`` by
668   default, but the above caveats apply. For compilers which don't
669   default to static linking, the required flags have to be specified. On
670   Linux, this is usually ``CFLAGS=-static CXXFLAGS=-static``.
671
672 Portability aspects
673 ^^^^^^^^^^^^^^^^^^^
674 Here, we consider portability aspects related to CPU instruction sets,
675 for details on other topics like binaries with statical vs dynamic
676 linking please consult the relevant parts of this documentation or
677 other non-|Gromacs| specific resources.
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 based on cross-compilation information
685 provided to ``cmake`` at 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 Past versions of the build system offered "mdrun" and "install-mdrun"
820 targets (similarly for other programs too) to build and install only
821 the mdrun program, respectively. Such a build is useful when the
822 configuration is only relevant for mdrun (such as with
823 parallelization options for MPI, SIMD, GPUs, or on BlueGene or Cray),
824 or the length of time for the compile-link-install cycle is relevant
825 when developing.
826
827 This is now supported with the ``cmake`` option
828 ``-DGMX_BUILD_MDRUN_ONLY=ON``, which will build a cut-down version of
829 ``libgromacs`` and/or the mdrun program.
830 Naturally, now ``make install`` installs only those
831 products. By default, mdrun-only builds will default to static linking
832 against |Gromacs| libraries, because this is generally a good idea for
833 the targets for which an mdrun-only build is desirable. If you re-use
834 a build tree and change to the mdrun-only build, then you will inherit
835 the setting for ``BUILD_SHARED_LIBS`` from the old build, and will be
836 warned that you may wish to manage ``BUILD_SHARED_LIBS`` yourself.
837
838 Installing |Gromacs|
839 --------------------
840 Finally, ``make install`` will install |Gromacs| in the
841 directory given in ``CMAKE_INSTALL_PREFIX``. If this is a system
842 directory, then you will need permission to write there, and you
843 should use super-user privileges only for ``make install`` and
844 not the whole procedure.
845
846 .. _getting access to GROMACS:
847
848 Getting access to |Gromacs| after installation
849 ----------------------------------------------
850 |Gromacs| installs the script ``GMXRC`` in the ``bin``
851 subdirectory of the installation directory
852 (e.g. ``/usr/local/gromacs/bin/GMXRC``), which you should source
853 from your shell:
854
855 ::
856
857     source /your/installation/prefix/here/bin/GMXRC
858
859 It will detect what kind of shell you are running and set up your
860 environment for using |Gromacs|. You may wish to arrange for your
861 login scripts to do this automatically; please search the web for
862 instructions on how to do this for your shell. 
863
864 Many of the |Gromacs| programs rely on data installed in the
865 ``share/gromacs`` subdirectory of the installation directory. By
866 default, the programs will use the environment variables set in the
867 ``GMXRC`` script, and if this is not available they will try to guess the
868 path based on their own location.  This usually works well unless you
869 change the names of directories inside the install tree. If you still
870 need to do that, you might want to recompile with the new install
871 location properly set, or edit the ``GMXRC`` script.
872
873 Testing |Gromacs| for correctness
874 ---------------------------------
875 Since 2011, the |Gromacs| development uses an automated system where
876 every new code change is subject to regression testing on a number of
877 platforms and software combinations. While this improves
878 reliability quite a lot, not everything is tested, and since we
879 increasingly rely on cutting edge compiler features there is
880 non-negligible risk that the default compiler on your system could
881 have bugs. We have tried our best to test and refuse to use known bad
882 versions in ``cmake``, but we strongly recommend that you run through
883 the tests yourself. It only takes a few minutes, after which you can
884 trust your build.
885
886 The simplest way to run the checks is to build |Gromacs| with
887 ``-DREGRESSIONTEST_DOWNLOAD``, and run ``make check``.
888 |Gromacs| will automatically download and run the tests for you.
889 Alternatively, you can download and unpack the GROMACS
890 regression test suite |gmx-regressiontests-package| tarball yourself
891 and use the advanced ``cmake`` option ``REGRESSIONTEST_PATH`` to
892 specify the path to the unpacked tarball, which will then be used for
893 testing. If the above does not work, then please read on.
894
895 The regression tests are also available from the download_ section.
896 Once you have downloaded them, unpack the tarball, source
897 ``GMXRC`` as described above, and run ``./gmxtest.pl all``
898 inside the regression tests folder. You can find more options
899 (e.g. adding ``double`` when using double precision, or
900 ``-only expanded`` to run just the tests whose names match
901 "expanded") if you just execute the script without options.
902
903 Hopefully, you will get a report that all tests have passed. If there
904 are individual failed tests it could be a sign of a compiler bug, or
905 that a tolerance is just a tiny bit too tight. Check the output files
906 the script directs you too, and try a different or newer compiler if
907 the errors appear to be real. If you cannot get it to pass the
908 regression tests, you might try dropping a line to the gmx-users
909 mailing list, but then you should include a detailed description of
910 your hardware, and the output of ``gmx mdrun -version`` (which contains
911 valuable diagnostic information in the header).
912
913 A build with ``-DGMX_BUILD_MDRUN_ONLY`` cannot be tested with
914 ``make check`` from the build tree, because most of the tests
915 require a full build to run things like ``grompp``. To test such an
916 mdrun fully requires installing it to the same location as a normal
917 build of |Gromacs|, downloading the regression tests tarball manually
918 as described above, sourcing the correct ``GMXRC`` and running the
919 perl script manually. For example, from your |Gromacs| source
920 directory:
921
922 ::
923
924     mkdir build-normal
925     cd build-normal
926     cmake .. -DCMAKE_INSTALL_PREFIX=/your/installation/prefix/here
927     make -j 4
928     make install
929     cd ..
930     mkdir build-mdrun-only
931     cd build-mdrun-only
932     cmake .. -DGMX_MPI=ON -DGMX_GPU=ON -DGMX_BUILD_MDRUN_ONLY=ON -DCMAKE_INSTALL_PREFIX=/your/installation/prefix/here
933     make -j 4
934     make install
935     cd /to/your/unpacked/regressiontests
936     source /your/installation/prefix/here/bin/GMXRC
937     ./gmxtest.pl all -np 2
938
939 If your mdrun program has been suffixed in a non-standard way, then
940 the ``./gmxtest.pl -mdrun`` option will let you specify that name to the
941 test machinery. You can use ``./gmxtest.pl -double`` to test the
942 double-precision version. You can use ``./gmxtest.pl -crosscompiling``
943 to stop the test harness attempting to check that the programs can
944 be run. You can use ``./gmxtest.pl -mpirun srun`` if your command to
945 run an MPI program is called ``srun``.
946
947 The ``make check`` target also runs integration-style tests that may run
948 with MPI if ``GMX_MPI=ON`` was set. To make these work, you may need to
949 set the CMake variables ``MPIEXEC``, ``MPIEXEC_NUMPROC_FLAG``, ``NUMPROC``,
950 ``MPIEXEC_PREFLAGS`` and ``MPIEXEC_POSTFLAGS`` so that
951 ``mdrun-mpi-test_mpi`` would run on multiple ranks via the shell command
952
953 ::
954
955     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC} ${MPIEXEC_PREFLAGS} \
956           mdrun-mpi-test_mpi ${MPIEXEC_POSTFLAGS} -otherflags
957
958 Typically, one might use variable values ``mpirun``, ``-np``, ``2``, ``''``,
959 ``''`` respectively, in order to run on two ranks.
960
961
962 Testing |Gromacs| for performance
963 ---------------------------------
964 We are still working on a set of benchmark systems for testing
965 the performance of |Gromacs|. Until that is ready, we recommend that
966 you try a few different parallelization options, and experiment with
967 tools such as ``gmx tune_pme``.
968
969 Having difficulty?
970 ------------------
971 You are not alone - this can be a complex task! If you encounter a
972 problem with installing |Gromacs|, then there are a number of
973 locations where you can find assistance. It is recommended that you
974 follow these steps to find the solution:
975
976 1. Read the installation instructions again, taking note that you
977    have followed each and every step correctly.
978
979 2. Search the |Gromacs| webpage_ and users emailing list for information
980    on the error. Adding
981    ``site:https://mailman-1.sys.kth.se/pipermail/gromacs.org_gmx-users``
982    to a Google search may help filter better results.
983
984 3. Search the internet using a search engine such as Google.
985
986 4. Post to the |Gromacs| users emailing list gmx-users for
987    assistance. Be sure to give a full description of what you have
988    done and why you think it did not work. Give details about the
989    system on which you are installing.  Copy and paste your command
990    line and as much of the output as you think might be relevant -
991    certainly from the first indication of a problem. In particular,
992    please try to include at least the header from the mdrun logfile,
993    and preferably the entire file.  People who might volunteer to help
994    you do not have time to ask you interactive detailed follow-up
995    questions, so you will get an answer faster if you provide as much
996    information as you think could possibly help. High quality bug
997    reports tend to receive rapid high quality answers.
998
999 Special instructions for some platforms
1000 =======================================
1001
1002 Building on Windows
1003 -------------------
1004 Building on Windows using native compilers is rather similar to
1005 building on Unix, so please start by reading the above. Then, download
1006 and unpack the |Gromacs| source archive. Make a folder in which to do
1007 the out-of-source build of |Gromacs|. For example, make it within the
1008 folder unpacked from the source archive, and call it ``build-gromacs``.
1009
1010 For CMake, you can either use the graphical user interface provided on
1011 Windows, or you can use a command line shell with instructions similar
1012 to the UNIX ones above. If you open a shell from within your IDE
1013 (e.g. Microsoft Visual Studio), it will configure the environment for
1014 you, but you might need to tweak this in order to get either a 32-bit
1015 or 64-bit build environment. The latter provides the fastest
1016 executable. If you use a normal Windows command shell, then you will
1017 need to either set up the environment to find your compilers and
1018 libraries yourself, or run the ``vcvarsall.bat`` batch script provided
1019 by MSVC (just like sourcing a bash script under Unix).
1020
1021 With the graphical user interface, you will be asked about what
1022 compilers to use at the initial configuration stage, and if you use
1023 the command line they can be set in a similar way as under UNIX. You
1024 will probably make your life easier and faster by using the new
1025 facility to download and install FFTW automatically.
1026
1027 For the build, you can either load the generated solutions file into
1028 e.g. Visual Studio, or use the command line with ``cmake --build`` so
1029 the right tools get used.
1030
1031 Building on Cray
1032 ----------------
1033 |Gromacs| builds mostly out of the box on modern Cray machines, but
1034
1035 * you may need to specify the use of static binaries
1036   with ``-DGMX_BUILD_SHARED_EXE=off``,
1037 * you may need to set the F77 environmental variable to ``ftn`` when
1038   compiling FFTW,
1039
1040 Building on BlueGene
1041 --------------------
1042
1043 BlueGene/Q
1044 ^^^^^^^^^^
1045 There is currently native acceleration on this platform for the Verlet
1046 cut-off scheme. There are no plans to provide accelerated kernels for
1047 the group cut-off scheme, but the default plain C kernels will work
1048 (slowly).
1049
1050 Only static linking with XL compilers is supported by |Gromacs|. Dynamic
1051 linking would be supported by the architecture and |Gromacs|, but has no
1052 advantages other than disk space, and is generally discouraged on
1053 BlueGene for performance reasons.
1054
1055 Computation on BlueGene floating-point units is always done in
1056 double-precision. However, mixed-precision builds of |Gromacs| are still
1057 normal and encouraged since they use cache more efficiently. The
1058 BlueGene hardware automatically converts values stored in single
1059 precision in memory to double precision in registers for computation,
1060 converts the results back to single precision correctly, and does so
1061 for no additional cost. As with other platforms, doing the whole
1062 computation in double precision normally shows no improvement in
1063 accuracy and costs twice as much time moving memory around.
1064
1065 You need to arrange for FFTW to be installed correctly, following the
1066 above instructions.
1067
1068 MPI wrapper compilers should be used for compiling and linking. Both
1069 xlc and bgclang are supported back ends - either might prove to be
1070 faster in practice. The MPI wrapper compilers can make it awkward to
1071 attempt to use IBM's optimized BLAS/LAPACK called ESSL (see the
1072 section on `linear algebra libraries`_. Since mdrun is the only part
1073 of |Gromacs| that should normally run on the compute nodes, and there is
1074 nearly no need for linear algebra support for mdrun, it is recommended
1075 to use the |Gromacs| built-in linear algebra routines - this is never
1076 a problem for normal simulations.
1077
1078 The recommended configuration is to use
1079
1080 ::
1081
1082     cmake .. -DCMAKE_C_COMPILER=mpicc \
1083              -DCMAKE_CXX_COMPILER=mpicxx \
1084              -DCMAKE_TOOLCHAIN_FILE=Platform/BlueGeneQ-static-XL-CXX.cmake \
1085              -DCMAKE_PREFIX_PATH=/your/fftw/installation/prefix \
1086              -DGMX_MPI=ON \
1087              -DGMX_BUILD_MDRUN_ONLY=ON
1088     make
1089     make install
1090
1091 which will build a statically-linked MPI-enabled mdrun for the compute
1092 nodes. Or use the Platform/BlueGeneQ-static-bgclang-cxx
1093 toolchain file if compiling with bgclang. Otherwise, |Gromacs| default configuration
1094 behaviour applies.
1095
1096 It is possible to configure and make the remaining |Gromacs| tools with
1097 the compute-node toolchain, but as none of those tools are MPI-aware
1098 and could then only run on the compute nodes, this would not normally
1099 be useful. Instead, these should be planned to run on the login node,
1100 and a separate |Gromacs| installation performed for that using the login
1101 node's toolchain - not the above platform file, or any other
1102 compute-node toolchain.
1103
1104 Note that only the MPI build is available for the compute-node
1105 toolchains. The |Gromacs| thread-MPI or no-MPI builds are not useful at
1106 all on BlueGene/Q.
1107
1108 BlueGene/P
1109 ^^^^^^^^^^
1110 There is currently no SIMD support on this platform and no plans to
1111 add it. The default plain C kernels will work.
1112
1113 Fujitsu PRIMEHPC
1114 ^^^^^^^^^^^^^^^^
1115 This is the architecture of the K computer, which uses Fujitsu
1116 Sparc64VIIIfx chips. On this platform, |Gromacs| has
1117 accelerated group kernels using the HPC-ACE instructions, no
1118 accelerated Verlet kernels, and a custom build toolchain. Since this
1119 particular chip only does double precision SIMD, the default setup
1120 is to build |Gromacs| in double. Since most users only need single, we have added
1121 an option GMX_RELAXED_DOUBLE_PRECISION to accept single precision square root
1122 accuracy in the group kernels; unless you know that you really need 15 digits
1123 of accuracy in each individual force, we strongly recommend you use this. Note
1124 that all summation and other operations are still done in double.
1125
1126 The recommended configuration is to use
1127
1128 ::
1129
1130     cmake .. -DCMAKE_TOOLCHAIN_FILE=Toolchain-Fujitsu-Sparc64-mpi.cmake \
1131              -DCMAKE_PREFIX_PATH=/your/fftw/installation/prefix \
1132              -DCMAKE_INSTALL_PREFIX=/where/gromacs/should/be/installed \
1133              -DGMX_MPI=ON \
1134              -DGMX_BUILD_MDRUN_ONLY=ON \
1135              -DGMX_RELAXED_DOUBLE_PRECISION=ON
1136     make
1137     make install
1138
1139 Intel Xeon Phi
1140 ^^^^^^^^^^^^^^
1141 |Gromacs| has preliminary support for Intel Xeon Phi. Only symmetric
1142 (aka native) mode is supported. |Gromacs| is functional on Xeon Phi, but
1143 it has so far not been optimized to the same level as other
1144 architectures have. The performance depends among other factors on the
1145 system size, and for
1146 now the performance might not be faster than CPUs. Building for Xeon
1147 Phi works almost as any other Unix. See the instructions above for
1148 details. The recommended configuration is
1149
1150 ::
1151
1152     cmake .. -DCMAKE_TOOLCHAIN_FILE=Platform/XeonPhi
1153     make
1154     make install
1155
1156 Tested platforms
1157 ================
1158 While it is our best belief that |Gromacs| will build and run pretty
1159 much everywhere, it is important that we tell you where we really know
1160 it works because we have tested it. We do test on Linux, Windows, and
1161 Mac with a range of compilers and libraries for a range of our
1162 configuration options. Every commit in our git source code repository
1163 is currently tested on x86 with gcc versions ranging from 4.6 through
1164 5.1, and versions 14 and 15 of the Intel compiler as well as Clang
1165 version 3.4 through 3.6. For this, we use a variety of GNU/Linux
1166 flavors and versions as well as recent versions of Mac OS X and Windows.  Under
1167 Windows we test both MSVC and the Intel compiler. For details, you can
1168 have a look at the `continuous integration server used by GROMACS`_,
1169 which runs Jenkins_.
1170
1171 We test irregularly on ARM v7, ARM v8, BlueGene/Q, Cray, Fujitsu
1172 PRIMEHPC, Power8, Google Native Client and other environments, and
1173 with other compilers and compiler versions, too.