Gromacs 2021.7 with GPU support

Webpage

http://www.gromacs.org/

Version

2021.7

Build Environment

  • GCC 10.3.1 (gcc-toolset-10)
  • HPC-X 2.11 (Open MPI 4.1.4)
  • CUDA 11.6

Files Required

  • gromacs-2021.7.tar.gz
  • regressiontests-2021.7.tar.gz
  • fftw-3.3.8.tar.gz
    • (computation node cannot access to download site)

Build Procedure

Following script was submitted as a job, since login node does not have GPUs.

#!/bin/sh
#PBS -l select=1:ncpus=16:mpiprocs=8:ompthreads=1:ngpus=2
#PBS -l walltime=24:00:00

cd $PBS_O_WORKDIR

VERSION=2021.7
INSTALL_PREFIX=/apl/gromacs/${VERSION}-CUDA

BASEDIR=/home/users/${USER}/Software/Gromacs/${VERSION}/
GROMACS_TARBALL=${BASEDIR}/gromacs-${VERSION}.tar.gz
REGRESSION_TARBALL=${BASEDIR}/regressiontests-${VERSION}.tar.gz
WORKDIR=/gwork/users/${USER}
REGRESSION_PATH=${WORKDIR}/regressiontests-${VERSION}

PARALLEL=12
export LANG=C
unset OMP_NUM_THREADS

FFTW_VER=3.3.8
FFTW_PATH=${BASEDIR}/fftw-${FFTW_VER}.tar.gz

#---------------------------------------------------------------------
umask 0022

module purge
module load gcc-toolset/10
#module load mpi/intelmpi/2019.8.254
module load openmpi/4.1.4-hpcx/gcc10
module load cuda/11.6

export CUDA_VISIBLE_DEVICES=0,1

cd ${WORKDIR}
if [ -d gromacs-${VERSION} ]; then
  mv gromacs-${VERSION} gromacs_erase
  rm -rf gromacs_erase &
fi

if [ -d regressiontests-${VERSION} ]; then
  mv regressiontests-${VERSION} regressiontests_erase
  rm -rf regressiontests_erase &
fi

tar xzf ${GROMACS_TARBALL}
tar xzf ${REGRESSION_TARBALL}
cd gromacs-${VERSION}

# single precision, no MPI
mkdir rccs-s
cd rccs-s
cmake .. \
   -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
   -DCMAKE_VERBOSE_MAKEFILE=ON \
   -DCMAKE_C_COMPILER=gcc \
   -DCMAKE_CXX_COMPILER=g++ \
   -DGMX_MPI=OFF \
   -DGMX_GPU=CUDA \
   -DGMX_DOUBLE=OFF \
   -DGMX_THREAD_MPI=ON \
   -DGMX_BUILD_OWN_FFTW=ON \
   -DGMX_BUILD_OWN_FFTW_URL=${FFTW_PATH} \
   -DREGRESSIONTEST_DOWNLOAD=OFF \
   -DREGRESSIONTEST_PATH=${REGRESSION_PATH}
make -j${PARALLEL} && make check && make install
cd ..

# single precision, with MPI
mkdir rccs-mpi-s
cd rccs-mpi-s
cmake .. \
   -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
   -DCMAKE_VERBOSE_MAKEFILE=ON \
   -DCMAKE_C_COMPILER=mpicc \
   -DCMAKE_CXX_COMPILER=mpicxx \
   -DGMX_MPI=ON \
   -DGMX_GPU=CUDA \
   -DGMX_DOUBLE=OFF \
   -DGMX_THREAD_MPI=OFF \
   -DGMX_BUILD_OWN_FFTW=ON \
   -DGMX_BUILD_OWN_FFTW_URL=${FFTW_PATH} \
   -DREGRESSIONTEST_DOWNLOAD=OFF \
   -DREGRESSIONTEST_PATH=${REGRESSION_PATH}
make -j${PARALLEL} && make check && make install
cd ..