How to compile Gromacs

From ChengLab
Revision as of 20:49, 6 February 2021 by Kevin (talk | contribs) (The Exacct Machine)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Quick and dirty installation on a Ubuntu/CentOS machine

If you do not know what you are doing and you just wanna run Gromacs, follow this.

Linux machine, Ubuntu 16.04, GTX 1080

tar xfz gromacs-2020.1.tar.gz
cd gromacs-2020.1
mkdir build
cd build
cmake .. -DGMX_DOUBLE=OFF -DGMX_GPU=ON -DCMAKE_INSTALL_PREFIX=/opt/gromacs/2019.3 -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -DGMX_BUILD_OWN_FFTW=ON
make -j8
make check
make -j8 install
source /usr/local/gromacs/bin/GMXRC


Options

Must-have

cmake ..  -DCMAKE_INSTALL_PREFIX=path/to/gromacs/5.0.6

C++ compilers (optional)

-DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc 

FFT Generally, there is no advantage in using MKL with GROMACS, and FFTW is often faster.

-DGMX_BUILD_OWN_FFTW=ON

MPI

-DGMX_MPI=ON -DMPI_CXX_COMPILER=mpicxx -DMPI_C_COMPILER=mpicc 

Double precision (important to cg minimization; unimportant for MD)

-DGMX_DOUBLE=ON

GPU (NO double precision)

-DGMX_GPU=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda/

Usually you would have to add suffix for GPU version

-DGMX_DEFAULT_SUFFIX=OFF -DGMX_BINARY_SUFFIX=_cuda_mpi -DGMX_LIBS_SUFFIX=_cuda_mpi

The Exacct Machine

A few prerequisites before you install Gromacs on the Exacct machine:

  1. Install CMake (here)
  2. Update the GCC compiler to >5.0
    1. sudo yum install centos-release-scl
    2. sudo yum install devtoolset-7-gcc*
    3. scl enable devtoolset-7 bash

Then you can compile Gromacs as always:

mkdir build
cd build
cmake .. -DGMX_DOUBLE=OFF -DGMX_GPU=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -DGMX_BUILD_OWN_FFTW=ON -DCMAKE_INSTALL_PREFIX=/opt/gromacs/2020
make -j12
make -j12 install