BlueGene/Q Verlet cut-off scheme kernels
[gromacs.git] / admin / installguide / installguide.tex
blobcfdac1e94bdb156153abe65587a5b92dd4c1d082
1 % Process from LaTeX via XML to XHTML with
2 % latexml --destination installguide.xml --xml installguide.tex
3 % latexmlpost --destination installguide.xhtml --format=xhtml installguide.xml
5 % Crude hack to remove ugly symbols:
6 % sed -e 's/[§]//g' -i installguide.xhtml
8 % Strip off header for pasting into the website at
9 % http://www.gromacs.org/Documentation/Installation_Instructions:
11 % grep -A 99999 "class=\"main\"" installguide.xhtml > installguide_web.xhtml
13 \documentclass{article}[12pt,a4paper,twoside]
14 \usepackage{hyperref}
15 % haven't made these work with LaTeXML yet...
16 %\usepackage[strings]{underscore}
17 %\usepackage[english]{babel}
19 \title{GROMACS installation guide}
21 % macros to keep style uniform
22 \newcommand{\gromacs}{GROMACS}
23 \newcommand{\nvidia}{NVIDIA}
24 \newcommand{\cuda}{CUDA}
25 \newcommand{\fftw}{FFTW}
26 \newcommand{\mkl}{MKL}
27 \newcommand{\mpi}{MPI}
28 \newcommand{\threadmpi}{ThreadMPI}
29 \newcommand{\openmpi}{OpenMPI}
30 \newcommand{\openmp}{OpenMP}
31 \newcommand{\openmm}{OpenMM}
32 \newcommand{\lammpi}{LAM/MPI}
33 \newcommand{\mpich}{MPICH}
34 \newcommand{\cmake}{CMake}
35 \newcommand{\sse}{SSE}
36 \newcommand{\ssetwo}{SSE2}
37 \newcommand{\avx}{AVX}
38 \newcommand{\fft}{FFT}
39 \newcommand{\blas}{BLAS}
40 \newcommand{\lapack}{LAPACK}
41 \newcommand{\vmd}{VMD}
42 \newcommand{\pymol}{PyMOL}
43 \newcommand{\grace}{Grace}
44 %\newcommand{\}{}
45 %\newcommand{\}{}
47 % later, make CMake keep this version current for us
48 \newcommand{\fftwversion}{3.3.2}
49 \newcommand{\cmakeversion}{2.8.0}
50 \newcommand{\cudaversion}{3.2}
52 \begin{document}
53 \section{Building GROMACS}
55 These instructions pertain to building \gromacs{} 4.6 and newer releases
56 using our new CMake-based build system.
57 For installations instructions for old \gromacs{} versions,
58 see the documentation at
59 \url{http://www.gromacs.org/Documentation/Installation_Instructions_4.5}.
61 \section{Quick and dirty installation}
63 \begin{enumerate}
64 \item Get the latest version of your compiler.
65 \item Check you have \cmake{} version 2.8.x or later.
66 \item Unpack the \gromacs{} tarball.
67 \item Make a separate build directory and change to it.
68 \item Run \cmake{} with the path to the source as an argument
69 \item Run make and make install
70 \end{enumerate}
71 Or, as a sequence of commands to execute:
72 \begin{verbatim}
73 tar xfz gromacs-4.6.3.tar.gz
74 cd gromacs-4.6.3
75 mkdir build
76 cd build
77 cmake .. -DGMX_BUILD_OWN_FFTW=ON
78 make
79 sudo make install
80 \end{verbatim}
81 This will download and build first the prerequisite FFT library followed by \gromacs{}. If you already have
82 FFTW installed, you can remove that argument to cmake. Overall, this build
83 of \gromacs{} will be correct and reasonably fast on the
84 machine upon which \cmake{} ran. It will generally be 30-50\% faster
85 than \gromacs{} 4.5.x, but if you want to get the maximum value
86 for your hardware with \gromacs{}, you'll have to read further.
87 Sadly, the interactions of hardware, libraries, and compilers
88 are only going to continue to get more complex.
90 \section{Prerequisites}
91 \subsection{Platform}
92 \gromacs{} can be compiled for any distribution of Linux, Mac OS X,
93 Windows (native, Cygwin or MinGW), BlueGene, Cray and many other architectures.
94 Technically, it can be compiled on any platform with an ANSI C
95 compiler and supporting libraries, such as the GNU C library. However, Gromacs
96 also comes with many hardware-specific extensions to provide very high performance
97 on those platforms, and to enable these we have slightly more specific requirements
98 since old compilers do not support new features, or they can be buggy.
100 \subsection{Compiler}
102 \gromacs{} requires an ANSI C compiler that complies with the C89
103 standard. For best performance, the \gromacs{} team strongly
104 recommends you get the most recent version of your preferred compiler
105 for your platform (e.g. GCC 4.7 or Intel 12.0 or newer on x86
106 hardware). There is a large amount of \gromacs{} code introduced in
107 version 4.6 that depends on effective compiler optimization to get
108 high performance - the old raw assembly-language kernel routines are all gone.
109 Unfortunately this makes \gromacs{} more sensitive to the compiler
110 used, and the binary will only work on the hardware for which it is compiled,
111 but the good news is that it has enabled us to significantly accelerate performance
112 compared to version 4.5.
114 \begin{itemize}
115 \item On Intel-based x86 hardware, we recommend you to use
116 the Intel compiler for best performance. It is usually better at instruction
117 scheduling, although it does not hurt to try gcc too. Recent versions can
118 give icc a run for the money.
119 \item On AMD-based x86 hardware up through the Magny-Cours architecture
120 (e.g. Opteron 6100-series processors), it is worth using the Intel compiler for
121 better performance, but gcc-4.7 and later are also reasonable.
122 \item On the AMD Bulldozer architecture (Opteron 6200), AMD introduced fused multiply-add
123 instructions and an "FMA4" instruction format not available on Intel x86 processors. Thus,
124 on the most recent AMD processors you want to use gcc-4.7 or later for better performance!
125 icc will only generate code for the subset also supported by Intel processors, and that
126 is significantly slower right now.
127 \item If you are running on Mac OS X, the best option is the Intel compiler.
128 Both clang and gcc will work, but they produce lower performance and each have some
129 shortcomings. Clang does not fully support OpenMP, and the current gcc ports do not
130 support AVX instructions.
131 \item For all non-x86 platforms, your best option is typically to use the vendor's
132 default compiler, and check for specialized information below.
133 \end{itemize}
135 \subsubsection{Running in parallel}
137 \gromacs{} can run in parallel on multiple cores of a single
138 workstation using its built-in \threadmpi. No user action is required
139 in order to enable this.
141 If you wish to use the excellent new native GPU support in \gromacs,
142 \nvidia{}'s \cuda{}
143 \url{http://www.nvidia.com/object/cuda_home_new.html} version
144 \cudaversion{} software development kit is required, and the latest
145 version is strongly encouraged. \nvidia{} GPUs with at least \nvidia{} compute
146 capability 2.0 are required, e.g. Fermi or Kepler cards.
148 The GPU support from \gromacs{} version 4.5 using \openmm{}
149 \url{https://simtk.org/home/openmm} is still contained in the code,
150 but in the ``user contributions'' section (\verb+src/contrib+). You
151 will need to set
152 \verb+-DGMX_OPENMM=on -DGMX_GPU=off -DGMX_MPI=off
153 -DGMX_THREAD_MPI=off\+ in order to build it. It also requires \cuda{},
154 and remains the only hardware-based acceleration available for
155 implicit solvent simulations in \gromacs{} at the moment. However, the
156 long-term plan is to enable this functionality in core Gromacs, and
157 not have the OpenMM interface supported by the \gromacs team.
159 If you wish to run in parallel on multiple machines across a network,
160 you will need to have
161 \begin{itemize}
162 \item an \mpi{} library installed that supports the \mpi{} 1.3
163 standard, and
164 \item wrapper compilers that will compile code using that library.
165 \end{itemize}
166 The \gromacs{} team recommends \openmpi{}
167 \url{http://www.open-mpi.org/} version 1.4.1 (or higher), \mpich{}
168 \url{http://www.mpich.org/} version 1.4.1 (or higher), or your
169 hardware vendor's \mpi{} installation. The most recent version of
170 either of this is likely to be the best. More specialized networks
171 might depend on accelerations only available in the vendor's library.
172 \lammpi{}
173 \url{http://www.lam-mpi.org/} might work, but since it has been
174 deprecated for years, it is not supported.
176 In some cases, \openmp{} parallelism is an advantage for \gromacs{},
177 but support for this is generally built into your compiler and detected
178 automatically. The one common exception is Mac OS X, where the default
179 clang compiler currently does not fully support OpenMP. You can install
180 gcc-4.7 instead, but the currently available binary distribution of gcc
181 uses an old system assembler that does not support AVX acceleration
182 instructions. There are some examples on the internet where people have
183 hacked this to work, but presently the only straightforward way to get
184 both OpenMP and AVX support on Mac OS X is to get the Intel compiler.
186 In summary, for maximum performance you will need to
187 examine how you will use \gromacs{}, what hardware you plan to run
188 on, and whether you can afford a non-free compiler for slightly better
189 performance. The only way to find out is unfortunately to test different
190 options and parallelization schemes for the actual simulations you
191 want to run. You will still get {\em good}\, performance with the default
192 build and runtime options (better than in version 4.5), but if you truly
193 want to push your hardware to the performance limit the days of just blindly
194 starting programs like '\verb+mdrun+' are gone.
196 \subsection{CMake}
198 From version 4.6, \gromacs{} uses the build system
199 \cmake{}. The previous build system that used \verb+configure+ from
200 the GNU autotools package has been removed permanently. \cmake{}
201 permits the \gromacs{} team to support a very wide range of hardware,
202 compilers and build configurations while continuing to provide the
203 portability, robustness and performance for which \gromacs{} is known.
205 \gromacs{} requires \cmake{} version \cmakeversion{} or higher. Lower
206 versions will not work. You can check whether \cmake{} is installed,
207 and what version it is, with \verb+cmake --version+. If you need to
208 install \cmake{}, then first check whether your platform's package
209 management system provides a suitable version, or visit
210 \url{http://www.cmake.org/cmake/help/install.html} for pre-compiled
211 binaries, source code and installation instructions. The \gromacs{}
212 team recommends you install the most recent version of \cmake{} you
213 can. If you need to compile \cmake{} yourself and have a really old environment,
214 you might first have to compile a moderately recent version (say, 2.6) to
215 bootstrap version 2.8. This is a one-time job, and you can find lots of
216 documentation on the \cmake{} website if you run into problems.
218 \subsection{Fast Fourier Transform library}
220 Many simulations in \gromacs{} make extensive use of fast Fourier transforms,
221 and a software library to perform these is always required. We
222 recommend \fftw{} \url{http://www.fftw.org/} (version 3 or higher
223 only) or Intel's \mkl{} \url{http://software.intel.com/en-us/intel-mkl}.
225 \subsubsection{\fftw{}}
227 \fftw{} is likely to be available for your platform via its package
228 management system, but there can be compatibility and significant
229 performance issues associated with these packages. In particular,
230 \gromacs{} simulations are normally run in single floating-point
231 precision whereas the default \fftw{} package is normally in double
232 precision, and good compiler options to use for \fftw{} when linked to
233 \gromacs{} may not have been used. Accordingly, the \gromacs{} team
234 recommends either
235 \begin{itemize}
236 \item that you permit the \gromacs{} installation to download and
237 build \fftw{} \fftwversion{} from source automatically for you (use
238 \verb+cmake -DGMX_BUILD_OWN_FFTW=ON+), or
239 \item that you build \fftw{} from the source code.
240 Note that the GROMACS-managed download of the FFTW tarball has a
241 slight chance of posing a security risk. If you use this option, you
242 will see a warning that advises how you can eliminate this risk.
243 \end{itemize}
245 If you build \fftw{} from source yourself, get the most recent version
246 and follow its installation guide available from \url{http://www.fftw.org}.
247 Choose the precision (i.e. single or float vs.\ double) to match what you will
248 later require for \gromacs{}. There is no need to compile with
249 threading or \mpi{} support, but it does no harm. On x86 hardware,
250 compile \emph{only} with \verb+--enable-sse2+ (regardless of
251 precision) even if your processors can take advantage of \avx{}
252 extensions. Since \gromacs{} uses fairly short transform lengths we
253 do not benefit from the \fftw{} \avx{} acceleration, and because of
254 memory system performance limitations, it can even degrade \gromacs{}
255 performance by around 20\%. There is no way for \gromacs{} to
256 limit the use to \ssetwo{} acceleration at run time if \avx{}
257 support has been compiled into \fftw{}, so you need to set this at compile time.
259 \subsubsection{\mkl{}}
261 Using \mkl{} with icc 11 or higher is very simple. Set up your
262 compiler environment correctly, perhaps with a command like
263 \verb+source /path/to/compilervars.sh intel64+ (or consult your local
264 documentation). Then set \verb+-DGMX_FFT_LIBRARY=mkl+ when you run
265 \cmake{}. In this case, \gromacs{} will also use \mkl{} for \blas{}
266 and \lapack{} (see \hyperref{linear-algebra}{here}).
268 Otherwise, you can configure \mkl{} by setting
269 \verb+-DGMX_FFT_LIBRARY=mkl
270 -DMKL_LIBRARIES="/full/path/to/libone.so;/full/path/to/libtwo.so"
271 -DMKL_INCLUDE_DIR="/full/path/to/mkl/include"+,
272 where the full list (and order!) of libraries you require are found in
273 Intel's \mkl{} documentation for your system.
275 \subsection{Optional build components}
277 \begin{itemize}
278 \item Hardware-optimized \blas{} and \lapack{} libraries are useful
279 for a few of the \gromacs{} utilities focused on normal modes and
280 matrix manipulation, but they do not provide any benefits for normal
281 simulations. Configuring these are discussed
282 \hyperlink{linear-algebra}{here}.
283 \item The built-in \gromacs{} trajectory viewer \verb+ngmx+ requires
284 X11 and Motif/Lesstif libraries and header files. Generally, the
285 \gromacs{} team rather recommends you use third-party software for
286 visualization, such as \vmd{}
287 \url{http://www.ks.uiuc.edu/Research/vmd/} or \pymol{}
288 \url{http://www.pymol.org/}.
289 \item A few \gromacs{} tools get some extra functionality when linked with the
290 GNU scientific library GSL.
291 \end{itemize}
293 \section{Doing a build of \gromacs}
295 This section will cover a general build of \gromacs{} with \cmake{},
296 but it is not an exhaustive discussion of how to use \cmake{}. There
297 are many resources available on the web, which we suggest you search
298 for when you encounter problems not covered here. The material below
299 applies specifically to builds on Unix-like systems, including Linux,
300 Mac OS X, MinGW and Cygwin. For other platforms, see the specialist
301 instructions below.
303 \subsection{Configuring with \cmake{}}
305 \cmake{} will run many tests on your system and do its best to work
306 out how to build \gromacs{} for you. If you are building \gromacs{} on
307 hardware that is identical to that where you will run \verb+mdrun+,
308 then you can be sure that the defaults will be pretty good. The build
309 configuration will for instance attempt to detect the specific hardware
310 instructions available in your processor. However, if
311 you want to control aspects of the build, there are plenty of things you
312 can set manually.
314 The best way to use \cmake{} to configure \gromacs{} is to do an
315 ``out-of-source'' build, by making another directory from which you
316 will run \cmake{}. This can be a subdirectory or not, it doesn't
317 matter. It also means you can never corrupt your source code by trying
318 to build it! So, the only required argument on the \cmake{} command
319 line is the name of the directory containing the
320 \verb+CMakeLists.txt+ file of the code you want to build. For
321 example, download the source tarball and use
322 % TODO: keep up to date with new releases!
323 \begin{verbatim}
324 $ tar xfz gromacs-4.6.3.tgz
325 $ cd gromacs-4.6.3
326 $ mkdir build-cmake
327 $ cd build-cmake
328 $ cmake ..
329 \end{verbatim}
331 You will see \verb+cmake+ report the results of a large number of
332 tests on your system made by \cmake{} and by \gromacs{}. These are
333 written to the \cmake{} cache, kept in \verb+CMakeCache.txt+. You
334 can edit this file by hand, but this is not recommended because it is
335 easy to reach an inconsistent state. You should not attempt to move or
336 copy this file to do another build, because file paths are hard-coded
337 within it. If you mess things up, just delete this file and start
338 again with '\verb+cmake+'.
340 If there's a serious problem detected at this stage, then you will see
341 a fatal error and some suggestions for how to overcome it. If you're
342 not sure how to deal with that, please start by searching on the web
343 (most computer problems already have known solutions!) and then
344 consult the gmx-users mailing list. There are also informational
345 warnings that you might like to take on board or not. Piping the
346 output of \verb+cmake+ through \verb+less+ or \verb+tee+ can be
347 useful, too.
349 \cmake{} works in an iterative fashion, re-running each time a setting
350 is changed to try to make sure other things are consistent. Once
351 things seem consistent, the iterations stop. Once \verb+cmake+
352 returns, you can see all the settings that were chosen and information
353 about them by using e.g. the curses interface
354 \begin{verbatim}
355 $ ccmake ..
356 \end{verbatim}
357 You can actually use \verb+ccmake+ directly in the first step, but then
358 most of the status messages will merely blink in the lower part
359 of the terminal rather than be written to standard out. Some platforms
360 like Windows or Mac even have native graphical user interfaces for
361 \cmake{}, and it can create project files for almost any build environment
362 you want (including Visual Studio or Xcode).
363 Check out \url{http://www.cmake.org/cmake/help/runningcmake.html} for
364 general advice on what you are seeing and how to navigate and change
365 things. The settings you might normally want to change are already
366 presented. If you make any changes, then \verb+ccmake+ will notice
367 that and require that you re-configure (using '\verb+c+'), so that it
368 gets a chance to make changes that depend on yours and perform more
369 checking. This might require several configuration stages when you are
370 using \verb+ccmake+ - when you are using \verb+cmake+ the
371 iteration is done behind the scenes.
373 A key thing to consider here is the setting of
374 \verb+CMAKE_INSTALL_PREFIX+. You will need to be able to write to
375 this directory in order to install \gromacs{} later, and if you change
376 your mind later, changing it in the cache triggers a full re-build,
377 unfortunately. So if you do not have super-user privileges on your
378 machine, then you will need to choose a sensible location within your
379 home directory for your \gromacs{} installation.
381 When \verb+cmake+ or \verb+ccmake+ have completed iterating, the
382 cache is stable and a build tree can be generated, with '\verb+g+' in
383 \verb+ccmake+ or automatically with \verb+cmake+.
385 You should not attempt to change compilers after the initial run of
386 \cmake{}. If you need to change, clean up and start again.
388 \subsection{Using CMake command-line options}
389 Once you become comfortable with setting and changing options, you
390 may know in advance how you will configure GROMACS. If so, you can
391 speed things up by invoking \verb+cmake+ with a command like:
392 \begin{verbatim}
393 $ cmake .. -DGMX_GPU=ON -DGMX_MPI=ON -DCMAKE_INSTALL_PREFIX=/home/marydoe/programs
394 \end{verbatim}
395 to build with GPUs, MPI and install in a custom location. You can even
396 save that in a shell script to make it even easier next time. You can
397 also do this kind of thing with \verb+ccmake+, but you should avoid
398 this, because the options set with '\verb+-D+' will not be able to be
399 changed interactively in that run of \verb+ccmake+.
401 \subsection{CMake advanced options}
402 The options that can be seen with \verb+ccmake+ are ones that we
403 think a reasonable number of users might want to consider
404 changing. There are a lot more options available, which you can see by
405 toggling the advanced mode in \verb+ccmake+ on and off with
406 '\verb+t+'. Even there, most of the variables that you might want to
407 change have a '\verb+CMAKE_+' or '\verb+GMX_+' prefix.
409 \subsection{Helping CMake find the right libraries/headers/programs}
411 If libraries are installed in non-default locations their location can
412 be specified using the following environment variables:
413 \begin{itemize}
414 \item \verb+CMAKE_INCLUDE_PATH+ for header files
415 \item \verb+CMAKE_LIBRARY_PATH+ for libraries
416 \item \verb+CMAKE_PREFIX_PATH+ for header, libraries and binaries
417 (e.g. '\verb+/usr/local+').
418 \end{itemize}
419 The respective '\verb+include+', '\verb+lib+', or '\verb+bin+' is
420 appended to the path. For each of these variables, a list of paths can
421 be specified (on Unix separated with ":"). Note that these are
422 enviroment variables (and not \cmake{} command-line arguments) and in
423 a '\verb+bash+' shell are used like:
424 \begin{verbatim}
425 $ CMAKE_PREFIX_PATH=/opt/fftw:/opt/cuda cmake ..
426 \end{verbatim}
428 The \verb+CC+ and \verb+CXX+ environment variables are also useful
429 for indicating to \cmake{} which compilers to use, which can be very
430 important for maximising \gromacs{} performance. Similarly,
431 \verb+CFLAGS+/\verb+CXXFLAGS+ can be used to pass compiler
432 options, but note that these will be appended to those set by
433 \gromacs{} for your build platform and build type. You can customize
434 some of this with advanced options such as \verb+CMAKE_C_FLAGS+
435 and its relatives.
437 See also: \url{http://cmake.org/Wiki/CMake_Useful_Variables#Environment_Variables}
439 \subsection{Linear algebra libraries}\hypertarget{linear-algebra}
440 As mentioned above, sometimes vendor \blas{} and \lapack{} libraries
441 can provide performance enhancements for \gromacs{} when doing
442 normal-mode analysis or covariance analysis. For simplicity, the text
443 below will refer only to \blas{}, but the same options are available
444 for \lapack{}. By default, CMake will search for \blas{}, use it if it
445 is found, and otherwise fall back on a version of \blas{} internal to
446 \gromacs{}. The \cmake{} option \verb+GMX_EXTERNAL_BLAS+ will be set
447 accordingly. The internal versions are fine for normal use. If you
448 need to specify a non-standard path to search, use
449 \verb+-DCMAKE_PREFIX_PATH=/path/to/search+. If you need to specify a
450 library with a non-standard name (e.g. ESSL on AIX or BlueGene), then
451 set \verb+-DGMX_BLAS_USER=/path/to/reach/lib/libwhatever.a+.
453 If you are using Intel's \mkl{} for \fft{}, then the \blas{} and
454 \lapack{} it provides are used automatically. This could be
455 over-ridden with \verb+GMX_BLAS_USER+, etc.
457 On Apple platforms where the Accelerate Framework is available, these
458 will be automatically used for \blas{} and \lapack{}. This could be
459 over-ridden with \verb+GMX_BLAS_USER+, etc.
461 \subsection{Native GPU acceleration}
462 If you have the \cuda{} Software Development Kit installed, you can
463 use \cmake{} with:
464 \begin{verbatim}
465 cmake .. -DGMX_GPU=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
466 \end{verbatim}
467 (or whichever path has your installation). Note that this will require
468 a working C++ compiler, and in some cases you might need to handle
469 this manually, e.g. with the advanced option
470 \verb+CUDA_HOST_COMPILER+.
472 Historically, Linux GPU builds have received most testing, but we
473 want to support GPU builds both under x86 Linux, Windows, Mac OS X and in the
474 future ARM. Any feedback on this build process (and fixes in particular) are very
475 welcome!
477 \subsection{Static linking}
478 Dynamic linking of the \gromacs{} executables will lead to a
479 smaller disk footprint when installed, and so is the default on
480 platforms where we believe it has been tested repeatedly and found to work.
481 In general, this includes Linux, Windows, Mac OS X and BSD systems.
482 Static binaries take much more space, but on some hardware and/or under
483 some conditions they are necessary, most commonly when you are running a parallel
484 simulation using MPI libraries.
486 \begin{itemize}
487 \item To link \gromacs{} binaries
488 statically against the internal \gromacs{} libraries, set
489 \verb+BUILD_SHARED_LIBS=OFF+.
490 \item To link statically against external
491 libraries as well, the \verb+GMX_PREFER_STATIC_LIBS=ON+ option can be
492 used. Note, that in general \cmake{} picks up whatever is available,
493 so this option only instructs \cmake{} to prefer static libraries when
494 both static and shared are available. If no static version of an
495 external library is available, even when the aforementioned option is
496 ON, the shared library will be used. Also note, that the resulting
497 binaries will still be dynamically linked against system libraries if
498 that is all that is available (common on Mac OS X).
499 \end{itemize}
501 \subsection{Changing the names of GROMACS binaries and libraries}
502 It is sometimes convenient to have different versions of the same
503 \gromacs{} libraries installed. The most common use cases have been
504 single and double precision, and with and without \mpi{}. By default,
505 \gromacs{} will suffix binaries and libraries for such builds with
506 '\verb+_d+' for double precision and/or '\verb+_mpi+' for \mpi{} (and
507 nothing otherwise). This can be controlled manually with
508 \verb+GMX_DEFAULT_SUFFIX (ON/OFF)+, \verb+GMX_BINARY_SUFFIX+ (takes
509 a string) and \verb+GMX_LIBS_SUFFIX+ (also takes a string).
510 This can also be useful for resolving libary-naming conflicts with
511 existing packges (\verb+GMX_PREFIX_LIBMD+ also can be useful).
512 For instance, to set a custom suffix for binaries and libraries,
513 one might specify:
515 \begin{verbatim}
516 cmake .. -DGMX_DEFAULT_SUFFIX=OFF -DGMX_BINARY_SUFFIX=_mod -DGMX_LIBS_SUFFIX=_mod
517 \end{verbatim}
519 Thus the names of all binaries and libraries will be appended with
520 "\_mod."
522 \subsection{Building \gromacs{}}
524 Once you have a stable cache, you can build \gromacs{}. If you're not
525 sure the cache is stable, you can re-run \verb+cmake ..+ or
526 \verb+ccmake ..+' to see. Then you can run \verb+make+ to start the
527 compilation. Before actual compilation starts, \verb+make+ checks
528 that the cache is stable, so if it isn't you will see \cmake{} run
529 again.
531 So long as any changes you've made to the configuration are sensible,
532 it is expected that the \verb+make+ procedure will always complete
533 successfully. The tests \gromacs{} makes on the settings you choose
534 are pretty extensive, but there are probably a few cases we haven't
535 thought of yet. Search the web first for solutions to problems, but if
536 you need help, ask on gmx-users, being sure to provide as much
537 information as possible about what you did, the system you are
538 building on, and what went wrong.
540 If you have a multi-core or multi-CPU machine with \verb+N+
541 processors, then using
542 \begin{verbatim}
543 $ make -j N
544 \end{verbatim}
545 will generally speed things up by quite a bit.
547 \subsection{Installing \gromacs{}}
549 Finally, \verb+make install+ will install \gromacs{} in the
550 directory given in \verb+GMX_INSTALL_PREFIX+. If this is an system
551 directory, then you will need permission to write there, and you
552 should use super-user privileges only for \verb+make install+ and
553 not the whole procedure.
555 \subsection{Getting access to \gromacs{} after installation}
557 \gromacs{} installs the script \verb+GMXRC+ in the \verb+bin+
558 subdirectory of the installation directory
559 (e.g. \verb+/usr/local/gromacs/bin/GMXRC+), which you should source
560 from your shell:
561 \begin{verbatim}
562 $ source your-installation-prefix-here/bin/GMXRC
563 \end{verbatim}
565 It will detect what kind of shell you are running and set up your
566 environment for using \gromacs{}. You may wish to arrange for your
567 login scripts to do this automatically; please search the web for
568 instructions on how to do this for your shell.
570 Many of the \gromacs{} programs rely on data installed in our
571 \verb+share/gromacs+ directory. By default, the programs will use
572 the environment variables set in the GMXRC script, and if this is not
573 available they will try to guess the path based on their own location.
574 This usually works well unless you change the names of directories
575 inside the install tree. If you still need to do that, you might want to recompile
576 with the new install location properly set, or edit the \verb+GMXRC+ script.
578 \subsection{Testing \gromacs{} for correctness}
579 Since 2011, the \gromacs{} development uses an automated system where
580 every new patch is subject to regression testing. While this improves
581 reliability quite a lot, not everything is tested, and since we
582 increasingly rely on cutting edge compiler features there is
583 non-negligible risk that the default compiler on your system could
584 have bugs. We have tried our best to test and refuse to use known bad
585 versions in \cmake{}, but we strongly recommend that you run through
586 the regression tests yourself. It only takes a few minutes, after
587 which you can trust your build.
589 The simplest way to run the checks is to build \gromacs{} with
590 \verb+-DREGRESSIONTEST_DOWNLOAD+, and run \verb+make check+.
591 \gromacs{} will automatically download and run the tests for you.
592 Alternatively, you can download and unpack the tarball yourself from
593 \url{http://gerrit.gromacs.org/download/regressiontests-4.6.1.tar.gz},
594 and use the advanced \cmake{} option \verb+REGRESSIONTEST_PATH+ to
595 specify the path to the unpacked tarball, which will then be used for
596 testing. If this doesn't work, then please read on.
598 The regression tests are available from the \gromacs{} website and ftp
599 site. Once you have downloaded them, unpack the tarball, source
600 \verb+GMXRC+ as described above, and run \verb+./gmxtest.pl all+
601 inside the regression tests folder. You can find more options
602 (e.g. adding \verb+double+ when using double precision) if you just
603 execute the script without options.
605 Hopefully you will get a report that all tests have passed. If there
606 are individual failed tests it could be a sign of a compiler bug, or
607 that a tolerance is just a tiny bit too tight. Check the output files
608 the script directs you too, and try a different or newer compiler if
609 the errors appear to be real. If you cannot get it to pass the
610 regression tests, you might try dropping a line to the gmx-users
611 mailing list, but then you should include a detailed description of
612 your hardware and an example logfile from mdrun (which contains
613 valuable information in the header).
615 \subsection{Testing \gromacs{} for performance}
616 We are still working on a set of benchmark systems for testing
617 the performance of \gromacs{}. Until that is ready, we recommend that
618 you start by comparing the performance to release 4.5, and also try
619 a few different parallelization options.
621 \subsection{Having difficulty?}
622 You're not alone - this can be a complex task! If you encounter a
623 problem with installing \gromacs{}, then there are a number of
624 locations where you can find assistance. It is recommended that you
625 follow these steps to find the solution:
627 \begin{enumerate}
628 \item Read the installation instructions again, taking note that you
629 have followed each and every step correctly.
630 \item Search the \gromacs{} website and users emailing list for
631 information on the error.
632 \item Search the internet using a search engine such as Google.
633 \item Post to the \gromacs{} users emailing list gmx-users for
634 assistance. Be sure to give a full description of what you have done
635 and why you think it didn't work. Give details about the system on
636 which you are installing.
637 Copy and paste your command line and as
638 much of the output as you think might be relevant - certainly from
639 the first indication of a problem. In particular, please try to include at
640 least the header from the mdrun logfile, and preferably the entire file.
641 People who might volunteer to
642 help you do not have time to ask you interactive detailed follow-up
643 questions, so you will get an answer faster if you provide as much
644 information as you think could possibly help. High quality bug reports
645 tend to receive rapid high quality answers.
646 \end{enumerate}
648 \section{Special instructions for some platforms}
650 \subsection{Building on Windows}
651 Building on Cygwin/MinGW/etc. works just like Unix. Please see the
652 instructions above.
654 Building on Windows using native compilers is rather similar to
655 building on Unix, so please start by reading the above. Then, download
656 and unpack the GROMACS source archive. The UNIX-standard .tar.gz
657 format can be managed on Windows, but you may prefer to browse
658 \url{ftp://ftp.gromacs.org/pub/gromacs} to obtain a zip format file,
659 which doesn't need any external tools to unzip on recent Windows
660 systems. Make a folder in which to do the out-of-source build of
661 \gromacs{}. For example, make it within the folder unpacked from the
662 source archive, and call it ``build-cmake''.
664 For \cmake{}, you can either use the graphical user interface provided
665 on Windows, or you can use a command line shell with instructions
666 similar to the UNIX ones above. If you open a shell from within
667 your IDE (e.g. Microsoft Visual Studio), it will configure the
668 environment for you, but you might need to tweak this in order to
669 get either a 32-bit or 64-bit build environment. The latter provides the
670 fastest executable. If you use a normal Windows command shell, then
671 you will need to either set up the environment to find your compilers
672 and libraries yourself, or run the \verb+vcvarsall.bat+ batch script
673 provided by MSVC (just like sourcing a bash script under
674 Unix).
676 With the graphical user interface you will be asked about what compilers
677 to use at the initial configuration stage, and if you use the command line
678 they can be set in a similar way as under UNIX.
679 You will probably make your life easier and faster by using the
680 new facility to download and install \fftw{} automatically.
682 For the build, you can either load the generated solutions file into
683 e.g. Visual Studio, or use the command line with \verb+cmake --build .+
684 so the right tools get used.
686 \subsection{Building on Cray}
688 Gromacs builds mostly out of the box on modern Cray machines,
689 but you want to use static libraries due to the peculiarities with
690 parallel job execution.
692 \subsection{Building on BlueGene}
694 \subsubsection{BlueGene/P}
696 There is currently no native acceleration on this platform and no
697 plans to make one. The default plain C kernels will work.
699 \subsubsection{BlueGene/Q}
701 There is currently native acceleration on this platform for the Verlet
702 cut-off scheme. Accelerated kernels for the group cut-off scheme may
703 come in the future, but the default plain C kernels will work.
705 Only static linking with XL compilers is supported by \gromacs{}. Dynamic
706 linking would be supported by the architecture and \gromacs{}, but has no
707 advantages other than disk space, and is generally discouraged on
708 BlueGene for performance reasons.
710 Computation on BlueGene floating-point units is always done in
711 double-precision. However, single-precision builds of \gromacs{} are
712 still normal and encouraged since they use cache more efficiently.
713 The BlueGene hardware automatically
714 converts values stored in single precision in memory to double
715 precision in registers for computation, converts the results back to
716 single precision correctly, and does so for no additional cost. As
717 with other platforms, doing the whole computation in double precision
718 normally shows no improvement in accuracy and costs twice as much time
719 moving memory around.
721 You need to arrange for FFTW to be installed correctly, following the
722 above instructions.
724 mpicc is used for compiling and linking. This can make it awkward to
725 attempt to use IBM's optimized BLAS/LAPACK called ESSL (see the
726 section on linear algebra). Since mdrun is the only part of \gromacs{}
727 that should normally run on the compute nodes, and there is nearly no
728 need for linear algebra support for mdrun, it is recommended to use
729 the \gromacs{} built-in linear algebra routines - it is rare for this
730 to be a bottleneck.
732 The recommended configuration is to use
733 \begin{verbatim}
734 cmake .. -DCMAKE_TOOLCHAIN_FILE=Platform/BlueGeneQ-static-XL-CXX \
735 -DCMAKE_PREFIX_PATH=/your/fftw/installation/prefix \
736 -DGMX_MPI=on
737 make mdrun
738 make install-mdrun
739 \end{verbatim}
740 which will build a statically-linked MPI-enabled mdrun for the back
741 end. Otherwise, GROMACS default configuration behaviour applies.
743 It is possible to configure and make the remaining \gromacs{} tools
744 with the compute-node toolchain, but as none of those tools are
745 \mpi{}-aware and could then only run on the compute nodes, this
746 would not normally be useful. Instead, these should be planned
747 to run on the login node, and a separate \gromacs{} installation
748 performed for that using the login node's toolchain - not the
749 above platform file, or any other compute-node toolchain.
751 Note that only the MPI build is available for the compute-node
752 toolchains. The GROMACS thread-MPI or serial builds are not useful at
753 all on BlueGene/Q.
755 \subsubsection{Fujitsu PRIMEHPC}
757 This is the architecture of the K computer, which uses Fujitsu Sparc64viiifx
758 chips. Gromacs-4.6 will build with default C kernels on this architecture,
759 and Gromacs-4.6.2 will add accelerated kernels and a custom toolchain.
761 \section{Tested platforms}
763 While it is our best belief that \gromacs{} will build and run pretty
764 much everywhere, it's important that we tell you where we really know
765 it works because we've tested it. We do test on Linux, Windows, and
766 Mac with a range of compilers and libraries for a range of our
767 configuration options. Every commit in our git source code
768 repository is currently tested on x86 with gcc versions ranging
769 from 4.4 through 4.7, and versions 12 and 13 of the Intel compiler.
770 Under Windows we test both the visual studio compilers and icc,
772 We test irregularly on BlueGene/Q, Cray,
773 Fujitsu PRIMEHPC, Google nativeclient and other environments. In
774 the future we expect ARM to be an important test target too, but this
775 is currently not included.
777 Contributions to this section are welcome.
779 Later we might set up the ability for users to contribute test results
780 to Jenkins.
782 \section{Other issues}
784 The \gromacs{} utility programs often write data files in formats
785 suitable for the \grace{} plotting tool, but it is straightforward to
786 use these files in other plotting programs, too.
788 \end{document}