Fixes for install guide page.
[alexxy/gromacs.git] / admin / installguide / installguide.tex
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
4 %
5 % Crude hack to remove ugly symbols:
6 % sed -e 's/§//g' -i installguide.xhtml
7 %
8 % Strip off header for pasting into the website at
9 % http://www.gromacs.org/Documentation/Installation_Instructions:
10 %
11 % grep -A 99999 "class=\"main\"" installguide.xhtml > installguide_web.xhtml
12
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}
18
19 \title{GROMACS installation guide}
20
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{\}{}
46
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}
51
52 \begin{document}
53 \section{Building GROMACS}
54
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}.
60
61 \section{Quick and dirty installation}
62
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.1.tar.gz
74 cd gromacs-4.6.1
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. 
89
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.
99
100 \subsection{Compiler}
101
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. 
113
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}
134
135 \subsubsection{Running in parallel}
136
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.
140
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.
147
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 edit \verb+src/contrib/CMakeLists.txt+ to enable it. It
152 also requires \cuda{}, and remains the only hardware-based
153 acceleration available for implicit solvent simulations in
154 \gromacs{} at the moment. However, the long-term plan is to enable 
155 this functionality in core Gromacs, and not have the OpenMM
156 interface supported by the \gromacs team. Right now there are
157 some build issues for OpenMM.
158
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.
175
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.
185
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. 
195
196 \subsection{CMake}
197
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.
204
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.
217
218 \subsection{Fast Fourier Transform library}
219
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}. 
224
225 \subsubsection{\fftw{}}
226
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 \end{itemize}
241
242 If you build \fftw{} from source yourself, get the most recent version
243 and follow its installation guide available from \url{http://www.fftw.org}.
244 Choose the precision (i.e. single or float vs.\ double) to match what you will
245 later require for \gromacs{}. There is no need to compile with
246 threading or \mpi{} support, but it does no harm. On x86 hardware,
247 compile \emph{only} with \verb+--enable-sse2+ (regardless of
248 precision) even if your processors can take advantage of \avx{}
249 extensions. Since \gromacs{} uses fairly short transform lengths we
250 do not benefit from the \fftw{} \avx{} acceleration, and because of
251 memory system performance limitations, it can even degrade \gromacs{}
252 performance by around 20\%. There is no way for \gromacs{} to
253 limit the use to \ssetwo{} acceleration at run time if \avx{}
254 support has been compiled into \fftw{}, so you need to set this at compile time.
255
256 \subsubsection{\mkl{}}
257
258 Using \mkl{} requires a set of linker flags that \gromacs{} is not
259 able to detect for you, so setting up optimal linking is tricky at the
260 moment. You will need to consult your compiler documentation and
261 use \verb+CMAKE_C_FLAGS+ and \verb+-DCMAKE_EXE_LINKER_FLAGS+
262 accordingly.
263
264 \subsection{Optional build components}
265
266 \begin{itemize}
267 \item Hardware-optimized \blas{} and \lapack{} libraries are useful for
268   a few of the \gromacs{} utilities focused on normal modes and matrix manipulation, 
269   but they does not provide any benefits for normal simulations.
270 \item The built-in \gromacs{} trajectory viewer \verb+ngmx+ requires
271   X11 and Motif/Lesstif libraries and header files. Generally, the
272   \gromacs{} team rather recommends you use third-party software for
273   visualization, such as \vmd{}
274   \url{http://www.ks.uiuc.edu/Research/vmd/} or \pymol{}
275   \url{http://www.pymol.org/}.
276 \item A few \gromacs{} tools get some extra functionality when linked with the
277 GNU scientific library GSL.
278 \end{itemize}
279
280 \section{Doing a build of \gromacs}
281
282 This section will cover a general build of \gromacs{} with \cmake{},
283 but it is not an exhaustive discussion of how to use \cmake{}. There
284 are many resources available on the web, which we suggest you search
285 for when you encounter problems not covered here. The material below
286 applies specifically to builds on Unix-like systems, including Linux,
287 Mac OS X, MinGW and Cygwin. For other platforms, see the specialist
288 instructions below.
289
290 \subsection{Configuring with \cmake{}}
291
292 \cmake{} will run many tests on your system and do its best to work
293 out how to build \gromacs{} for you. If you are building \gromacs{} on
294 hardware that is identical to that where you will run \verb+mdrun+,
295 then you can be sure that the defaults will be pretty good. The build
296 configuration will for instance attempt to detect the specific hardware
297 instructions available in your processor. However, if
298 you want to control aspects of the build, there are plenty of things you
299 can set manually.
300
301 The best way to use \cmake{} to configure \gromacs{} is to do an
302 ``out-of-source'' build, by making another directory from which you
303 will run \cmake{}. This can be a subdirectory or not, it doesn't
304 matter. It also means you can never corrupt your source code by trying
305 to build it! So, the only required argument on the \cmake{} command
306 line is the name of the directory containing the
307 \verb+CMakeLists.txt+ file of the code you want to build. For
308 example, download the source tarball and use
309 % TODO: keep up to date with new releases!
310 \begin{verbatim}
311 $ tar xfz gromacs-4.6.1.tgz
312 $ cd gromacs-4.6.1
313 $ mkdir build-cmake
314 $ cd build-cmake
315 $ cmake ..
316 \end{verbatim}
317
318 You will see \verb+cmake+ report the results of a large number of
319 tests on your system made by \cmake{} and by \gromacs{}. These are
320 written to the \cmake{} cache, kept in \verb+CMakeCache.txt+. You
321 can edit this file by hand, but this is not recommended because it is
322 easy to reach an inconsistent state. You should not attempt to move or
323 copy this file to do another build, because file paths are hard-coded
324 within it. If you mess things up, just delete this file and start
325 again with '\verb+cmake+'.
326
327 If there's a serious problem detected at this stage, then you will see
328 a fatal error and some suggestions for how to overcome it. If you're
329 not sure how to deal with that, please start by searching on the web
330 (most computer problems already have known solutions!) and then
331 consult the gmx-users mailing list. There are also informational
332 warnings that you might like to take on board or not. Piping the
333 output of \verb+cmake+ through \verb+less+ or \verb+tee+ can be
334 useful, too.
335
336 \cmake{} works in an iterative fashion, re-running each time a setting
337 is changed to try to make sure other things are consistent. Once
338 things seem consistent, the iterations stop. Once \verb+cmake+
339 returns, you can see all the settings that were chosen and information
340 about them by using e.g. the curses interface
341 \begin{verbatim}
342 $ ccmake ..
343 \end{verbatim}
344 You can actually use \verb+ccmake+ directly in the first step, but then
345 most of the status messages will merely blink in the lower part
346 of the terminal rather than be written to standard out. Some platforms
347 like Windows or Mac even have native graphical user interfaces for
348 \cmake{}, and it can create project files for almost any build environment
349 you want (including Visual Studio or Xcode).
350 Check out \url{http://www.cmake.org/cmake/help/runningcmake.html} for
351 general advice on what you are seeing and how to navigate and change
352 things. The settings you might normally want to change are already
353 presented. If you make any changes, then \verb+ccmake+ will notice
354 that and require that you re-configure (using '\verb+c+'), so that it
355 gets a chance to make changes that depend on yours and perform more
356 checking. This might require several configuration stages when you are
357 using \verb+ccmake+ - when you are using \verb+cmake+ the
358 iteration is done behind the scenes.
359
360 A key thing to consider here is the setting of
361 \verb+CMAKE_INSTALL_PREFIX+. You will need to be able to write to
362 this directory in order to install \gromacs{} later, and if you change
363 your mind later, changing it in the cache triggers a full re-build,
364 unfortunately. So if you do not have super-user privileges on your
365 machine, then you will need to choose a sensible location within your
366 home directory for your \gromacs{} installation.
367
368 When \verb+cmake+ or \verb+ccmake+ have completed iterating, the
369 cache is stable and a build tree can be generated, with '\verb+g+' in
370 \verb+ccmake+ or automatically with \verb+cmake+.
371
372 You should not attempt to change compilers after the initial run of
373 \cmake{}. If you need to change, clean up and start again.
374
375 \subsection{Using CMake command-line options}
376 Once you become comfortable with setting and changing options, you
377 may know in advance how you will configure GROMACS. If so, you can
378 speed things up by invoking \verb+cmake+ with a command like:
379 \begin{verbatim}
380 $ cmake .. -DGMX_GPU=ON -DGMX_MPI=ON -DCMAKE_INSTALL_PREFIX=/home/marydoe/programs
381 \end{verbatim}
382 to build with GPUs, MPI and install in a custom location. You can even
383 save that in a shell script to make it even easier next time. You can
384 also do this kind of thing with \verb+ccmake+, but you should avoid
385 this, because the options set with '\verb+-D+' will not be able to be
386 changed interactively in that run of \verb+ccmake+.
387
388 \subsection{CMake advanced options}
389 The options that can be seen with \verb+ccmake+ are ones that we
390 think a reasonable number of users might want to consider
391 changing. There are a lot more options available, which you can see by
392 toggling the advanced mode in \verb+ccmake+ on and off with
393 '\verb+t+'. Even there, most of the variables that you might want to
394 change have a '\verb+CMAKE_+' or '\verb+GMX_+' prefix.
395
396 \subsection{Helping CMake find the right libraries/headers/programs}
397
398 If libraries are installed in non-default locations their location can
399 be specified using the following environment variables:
400 \begin{itemize}
401 \item \verb+CMAKE_INCLUDE_PATH+ for header files
402 \item \verb+CMAKE_LIBRARY_PATH+ for libraries
403 \item \verb+CMAKE_PREFIX_PATH+ for header, libraries and binaries
404   (e.g. '\verb+/usr/local+').
405 \end{itemize}
406 The respective '\verb+include+', '\verb+lib+', or '\verb+bin+' is
407 appended to the path. For each of these variables, a list of paths can
408 be specified (on Unix seperated with ":"). Note that these are
409 enviroment variables (and not \cmake{} command-line arguments) and in
410 a '\verb+bash+' shell are used like:
411 \begin{verbatim}
412 $ CMAKE_PREFIX_PATH=/opt/fftw:/opt/cuda cmake ..
413 \end{verbatim}
414
415 The \verb+CC+ and \verb+CXX+ environment variables are also useful
416 for indicating to \cmake{} which compilers to use, which can be very
417 important for maximising \gromacs{} performance. Similarly,
418 \verb+CFLAGS+/\verb+CXXFLAGS+ can be used to pass compiler
419 options, but note that these will be appended to those set by
420 \gromacs{} for your build platform and build type. You can customize
421 some of this with advanced options such as \verb+CMAKE_C_FLAGS+
422 and its relatives.
423
424 See also: \url{http://cmake.org/Wiki/CMake_Useful_Variables#Environment_Variables}
425
426 \subsection{Native GPU acceleration}
427 If you have the \cuda{} Software Development Kit installed, you can
428 use \cmake{} with:
429 \begin{verbatim}
430 cmake .. -DGMX_GPU=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
431 \end{verbatim}
432 (or whichever path has your installation). Note that this will require
433 a working C++ compiler, and in some cases you might need to handle
434 this manually, e.g. with the advanced option
435 \verb+CUDA_HOST_COMPILER+.
436
437 Historically, Linux GPU builds have received most testing, but we 
438 want to support GPU builds both under x86 Linux, Windows, Mac OS X and in the
439 future ARM. Any feedback on this build process (and fixes in particular) are very
440 welcome!
441
442 \subsection{Static linking}
443 Dynamic linking of the \gromacs{} executables will lead to a
444 smaller disk footprint when installed, and so is the default on
445 platforms where we believe it has been tested repeatedly and found to work.
446 In general, this includes Linux, Windows, Mac OS X and BSD systems.
447 Static binaries take much more space, but on some hardware and/or under
448 some conditions they are necessary, most commonly when you are running a parallel
449 simulation using MPI libraries. 
450
451 \begin{itemize}
452 \item To link \gromacs{} binaries
453 statically against the internal \gromacs{} libraries, set
454 \verb+BUILD_SHARED_LIBS=OFF+.
455 \item To link statically against external
456 libraries as well, the \verb+GMX_PREFER_STATIC_LIBS=ON+ option can be
457 used. Note, that in general \cmake{} picks up whatever is available,
458 so this option only instructs \cmake{} to prefer static libraries when
459 both static and shared are available. If no static version of an
460 external library is available, even when the aforementioned option is
461 ON, the shared library will be used. Also note, that the resulting
462 binaries will still be dynamically linked against system libraries if
463 that is all that is available (common on Mac OS X).
464 \end{itemize}
465
466 \subsection{Changing the names of GROMACS binaries and libraries}
467 It is sometimes convenient to have different versions of the same
468 \gromacs{} libraries installed. The most common use cases have been
469 single and double precision, and with and without \mpi{}. By default,
470 \gromacs{} will suffix binaries and libraries for such builds with
471 '\verb+_d+' for double precision and/or '\verb+_mpi+' for \mpi{} (and
472 nothing otherwise). This can be controlled manually with
473 \verb+GMX_DEFAULT_SUFFIX (ON/OFF)+, \verb+GMX_BINARY_SUFFIX+ (takes 
474 a string) and \verb+GMX_LIBS_SUFFIX+ (also takes a string). 
475 This can also be useful for resolving libary-naming conflicts with 
476 existing packges (\verb+GMX_PREFIX_LIBMD+ also can be useful).
477 For instance, to set a custom suffix for binaries and libraries, 
478 one might specify:
479
480 \begin{verbatim}
481 cmake .. -DGMX_DEFAULT_SUFFIX=OFF -DGMX_BINARY_SUFFIX=_mod -DGMX_LIBS_SUFFIX=_mod
482 \end{verbatim}
483
484 Thus the names of all binaries and libraries will be appended with
485 "_mod."
486
487 \subsection{Building \gromacs{}}
488
489 Once you have a stable cache, you can build \gromacs{}. If you're not
490 sure the cache is stable, you can re-run \verb+cmake ..+ or
491 \verb+ccmake ..+' to see. Then you can run \verb+make+ to start the
492 compilation. Before actual compilation starts, \verb+make+ checks
493 that the cache is stable, so if it isn't you will see \cmake{} run
494 again.
495
496 So long as any changes you've made to the configuration are sensible,
497 it is expected that the \verb+make+ procedure will always complete
498 successfully. The tests \gromacs{} makes on the settings you choose
499 are pretty extensive, but there are probably a few cases we haven't
500 thought of yet. Search the web first for solutions to problems, but if
501 you need help, ask on gmx-users, being sure to provide as much
502 information as possible about what you did, the system you are
503 building on, and what went wrong.
504
505 If you have a multi-core or multi-CPU machine with \verb+N+
506 processors, then using
507 \begin{verbatim}
508 $ make -j N
509 \end{verbatim}
510 will generally speed things up by quite a bit.
511
512 \subsection{Installing \gromacs{}}
513
514 Finally, \verb+make install+ will install \gromacs{} in the
515 directory given in \verb+GMX_INSTALL_PREFIX+. If this is an system
516 directory, then you will need permission to write there, and you
517 should use super-user privileges only for \verb+make install+ and
518 not the whole procedure.
519
520 \subsection{Getting access to \gromacs{} after installation}
521
522 \gromacs{} installs the script \verb+GMXRC+ in the \verb+bin+
523 subdirectory of the installation directory
524 (e.g. \verb+/usr/local/gromacs/bin/GMXRC+), which you should source
525 from your shell:
526 \begin{verbatim}
527 $ source your-installation-prefix-here/bin/GMXRC
528 \end{verbatim}
529
530 It will detect what kind of shell you are running and set up your
531 environment for using \gromacs{}. You may wish to arrange for your
532 login scripts to do this automatically; please search the web for
533 instructions on how to do this for your shell. 
534
535 Many of the \gromacs{} programs rely on data installed in our
536 \verb+share/gromacs+ directory. By default, the programs will use
537 the environment variables set in the GMXRC script, and if this is not
538 available they will try to guess the path based on their own location.
539 This usually works well unless you change the names of directories
540 inside the install tree. If you still need to do that, you might want to recompile
541 with the new install location properly set, or edit the \verb+GMXRC+ script.
542
543 \subsection{Testing \gromacs{} for correctness}
544 Since 2011, the \gromacs{} development uses an automated system where
545 every new patch is subject to regression testing. While this improves
546 reliability quite a lot, not everything is tested, and since we
547 increasingly rely on cutting edge compiler features there is
548 non-negligible risk that the default compiler on your system could
549 have bugs. We have tried our best to test and refuse to use known bad
550 versions in \cmake{}, but we strongly recommend that you run through
551 the regression tests yourself. It only takes a few minutes, after
552 which you can trust your build.
553
554 The simplest way to run the checks is to build \gromacs{} with
555 \verb+-DREGRESSIONTEST_DOWNLOAD+, and run \verb+make check+.
556 \gromacs{} will automatically download and run the tests for you.
557 Alternatively, you can download and unpack the tarball yourself from
558 \url{http://gerrit.gromacs.org/download/regressiontests-4.6.1.tar.gz},
559 and use the advanced \cmake{} option \verb+REGRESSIONTEST_PATH+ to
560 specify the path to the unpacked tarball, which will then be used for
561 testing. If this doesn't work, then please read on.
562
563 The regression tests are available from the \gromacs{} website and ftp
564 site.  Once you have downloaded them, unpack the tarball, source
565 \verb+GMXRC+ as described above, and run \verb+./gmxtest.pl all+
566 inside the regression tests folder. You can find more options
567 (e.g. adding \verb+double+ when using double precision) if you just
568 execute the script without options.
569
570 Hopefully you will get a report that all tests have passed. If there
571 are individual failed tests it could be a sign of a compiler bug, or
572 that a tolerance is just a tiny bit too tight. Check the output files
573 the script directs you too, and try a different or newer compiler if
574 the errors appear to be real. If you cannot get it to pass the
575 regression tests, you might try dropping a line to the gmx-users
576 mailing list, but then you should include a detailed description of
577 your hardware and an example logfile from mdrun (which contains
578 valuable information in the header).
579
580 \subsection{Testing \gromacs{} for performance}
581 We are still working on a set of benchmark systems for testing
582 the performance of \gromacs{}. Until that is ready, we recommend that
583 you start by comparing the performance to release 4.5, and also try
584 a few different parallelization options.
585
586 \subsection{Having difficulty?}
587 You're not alone - this can be a complex task! If you encounter a
588 problem with installing \gromacs{}, then there are a number of
589 locations where you can find assistance. It is recommended that you
590 follow these steps to find the solution:
591
592 \begin{enumerate}
593 \item Read the installation instructions again, taking note that you
594   have followed each and every step correctly.
595 \item Search the \gromacs{} website and users emailing list for
596   information on the error.
597 \item Search the internet using a search engine such as Google.
598 \item Post to the \gromacs{} users emailing list gmx-users for
599   assistance. Be sure to give a full description of what you have done
600   and why you think it didn't work. Give details about the system on
601   which you are installing. 
602   Copy and paste your command line and as
603   much of the output as you think might be relevant - certainly from
604   the first indication of a problem. In particular, please try to include at
605   least the header from the mdrun logfile, and preferably the entire file.
606   People who might volunteer to
607   help you do not have time to ask you interactive detailed follow-up
608   questions, so you will get an answer faster if you provide as much
609   information as you think could possibly help. High quality bug reports 
610   tend to receive rapid high quality answers.
611 \end{enumerate}
612
613 \section{Special instructions for some platforms}
614
615 \subsection{Building on Windows}
616 Building on Cygwin/MinGW/etc. works just like Unix. Please see the
617 instructions above.
618
619 Building on Windows using native compilers is rather similar to
620 building on Unix, so please start by reading the above. Then, download
621 and unpack the GROMACS source archive. The UNIX-standard .tar.gz
622 format can be managed on Windows, but you may prefer to browse
623 \url{ftp://ftp.gromacs.org/pub/gromacs} to obtain a zip format file,
624 which doesn't need any external tools to unzip on recent Windows
625 systems. Make a folder in which to do the out-of-source build of
626 \gromacs{}. For example, make it within the folder unpacked from the
627 source archive, and call it ``build-cmake''. 
628
629 For \cmake{}, you can either use the graphical user interface provided
630 on Windows, or you can use a command line shell with instructions
631 similar to the UNIX ones above. If you open a shell from within
632 your IDE (e.g. Microsoft Visual Studio), it will configure the
633 environment for you, but you might need to tweak this in order to 
634 get either a 32-bit or 64-bit build environment. The latter provides the
635 fastest executable. If you use a normal Windows command shell, then
636 you will need to either set up the environment to find your compilers
637 and libraries yourself, or run the \verb+vcvarsall.bat+ batch script
638 provided by MSVC (just like sourcing a bash script under
639 Unix). 
640
641 With the graphical user interface you will be asked about what compilers
642 to use at the initial configuration stage, and if you use the command line
643 they can be set in a similar way as under UNIX.
644 You will probably make your life easier and faster by using the
645 new facility to download and install \fftw{} automatically. 
646
647 For the build, you can either load the generated solutions file into
648 e.g. Visual Studio, or use the command line with \verb+cmake --build .+ 
649 so the right tools get used.
650
651 \subsection{Building on Cray}
652
653 Gromacs builds mostly out of the box on modern Cray machines,
654 but you want to use static libraries due to the peculiarities with
655 parallel job execution.
656
657 \subsection{Building on BlueGene}
658
659 \subsubsection{BlueGene/P}
660
661 There is currently no native acceleration on this platform, but the
662 default plain C kernels will work.
663
664 \subsubsection{BlueGene/Q}
665
666 There is currently no native acceleration on this platform, but the
667 default plain C kernels will work. We have accelerated kernels in
668 progress for this platform, but they are not quite done yet.
669
670 Only static linking with XL compilers is supported by \gromacs{}. Dynamic
671 linking would be supported by the architecture and \gromacs{}, but has no
672 advantages other than disk space, and is generally discouraged on
673 BlueGene for performance reasons.
674
675 Computation on BlueGene floating-point units is always done in
676 double-precision. However, single-precision builds of \gromacs{} are
677 still normal and encouraged since they use cache more efficiently. 
678 The BlueGene hardware automatically
679 converts values stored in single precision in memory to double
680 precision in registers for computation, converts the results back to
681 single precision correctly, and does so for no additional cost. As
682 with other platforms, doing the whole computation in double precision
683 normally shows no improvement in accuracy and costs twice as much time
684 moving memory around.
685
686 You need to arrange for FFTW to be installed correctly, following the
687 above instructions.
688
689 mpicc is used for compiling and linking. This can make it awkward to
690 attempt to use IBM's optimized BLAS/LAPACK called ESSL. Since mdrun is
691 the only part of \gromacs{} that should normally run on the compute
692 nodes, and there is nearly no need for linear algebra support for
693 mdrun, it is recommended to use the \gromacs{} built-in linear algebra
694 routines - it is rare for this to be a bottleneck.
695
696 \begin{verbatim}
697 cmake .. -DCMAKE_TOOLCHAIN_FILE=BlueGeneQ-static-XL-C \
698          -DCMAKE_PREFIX_PATH=/your/fftw/installation/prefix
699 make mdrun
700 make install-mdrun
701 \end{verbatim}
702 It is possible to configure and make the remaining \gromacs{} tools
703 with the compute node toolchain, but as none of those tools are
704 \mpi{}-aware, this would not normally be useful. Instead, these should
705 be planned to run on the login node, and a seperate \gromacs{}
706 installation performed for that using the login node's toolchain.
707
708 \subsubsection{Fujitsu PRIMEHPC}
709
710 This is the architecture of the K computer, which uses Fujitsu Sparc64viiifx 
711 chips. Gromacs-4.6 will build with default C kernels on this architecture,
712 and Gromacs-4.6.2 will add accelerated kernels and a custom toolchain.
713
714 \section{Tested platforms}
715
716 While it is our best belief that \gromacs{} will build and run pretty
717 much everywhere, it's important that we tell you where we really know
718 it works because we've tested it. We do test on Linux, Windows, and
719 Mac with a range of compilers and libraries for a range of our
720 configuration options. Every commit in our git source code
721 repository is currently tested on x86 with gcc versions ranging
722 from 4.4 through 4.7, and versions 12 and 13 of the Intel compiler.
723 Under Windows we test both the visual studio compilers and icc,
724
725 We test irregularly on BlueGene/L, BlueGene/P, BlueGene/Q, Cray, 
726 Fujitsu PRIMEHPC, Google nativeclient and other environments. In 
727 the future we expect ARM to be an important test target too, but this
728 is currently not included.
729
730 Contributions to this section are welcome.
731
732 Later we might set up the ability for users to contribute test results
733 to Jenkins.
734
735 \section{Other issues}
736
737 The \gromacs{} utility programs often write data files in formats
738 suitable for the \grace{} plotting tool, but it is straightforward to
739 use these files in other plotting programs, too.
740
741 \end{document}