Skip to main content

GROMACS

Gromacs is an architecture-specific software. It performs best when installed and configured for the specific hardware. On Palmetto 2, we still provide several general versions of GROMACS which can be loaded by all users. Since the general versions are optimized for specific hardware, the performance might be degraded. In the following, we present how to use the pre-built general versions of GROMACS and how to install/compile GROMACS for specific hardware manually.

GROMACS Official Documentation

GROMACS Official Tutorials

GROMACS Community Forum

Global GROMACS Module installed on Palmetto 2

We currently provide GROMACS 2025.1 as a global module. Modules may be updated annually during system maintenance.

CPU version

The CPU version of GROMACS can be load by:

module load gromacs/gromacs-2025.1-cpu

Example of using pre-built versions of GROMACS

Users can copy the entire directory /project/rcde/public_examples/gromacs/example_input/ to their home directory or scratch space to run the simulation.

cp -r /project/rcde/public_examples/gromacs/example_input/ ~
cd ~/example_input
sbatch gmx_cpu.slurm

Input files summary

Typically, the following files are required to initiate a simulation:

rf_verlet.mdp: Molecular dynamics parameter file

topol.top: Molecular topology file

conf.gro: Molecular structure file

Output files summary

After the job finishes, the following files will be generated in the ~/example_input directory:

em.tpr: Run input structure file

job-output.edr: Energy file

job-output.gro: Molecular structure file

job-output.log: Job log file

We can use the following command to find the walltime/efficiency of the job.

tail -n 6 job-output.log | head -n 4

And it returns:

               Core t (s)   Wall t (s)        (%)
Time: 1632.272 136.024 1200.0
(ns/day) (hour/ns)
Performance: 12.705 1.889

We encourage users to test different combinations of nodes and constraints to find a good balance between resource usage and computing performance. More information on GROMACS performance optimization can be found in the GROMACS User Guide: mdrun performance section, and details on available constraints can be found at Job Submission Guide on our documentation page.

For newer versions of GROMACS, not all CPU types may be supported. For this global module on Palmetto 2, the supported CPU types and the corresponding constraints to include in your job files are listed below. If you are using a CPU model that is not listed, or if you have other specific requirements, please refer to the custom compilation instructions for more information.

What CPU models are available?

To make optimal use of the available hardware and ensure the best performance, only the following CPU architectures are supported. Running on unsupported CPUs may result in an Illegal instruction error.

cpu_gen_genoa

cpu_gen_sapphirerapids

cpu_gen_icelake

cpu_gen_cascadelake

cpu_gen_skylake

When submitting your job, it is recommended to include the following constraint to ensure compatibility and performance consistency:

--constraint cpu_gen_genoa

For details on adding other constraints, please refer to the Job Submission Guide on our documentation page.

GPU version

GPU acceleration supports NVIDIA architectures (V100, A100) on GPU partitions.

The GPU version of GROMACS can be load by:

module load gromacs/gromacs-2025.1-gpu

Manually installing GROMACS on your home directory

You may want to compile GROMACS manually if:

  • You need a newer or older version
  • You want to use specific compiler/MPI/CUDA combinations
  • You want optimized instruction sets (AVX512, AMD Zen4, etc.)
  • You want to build with PLUMED, double precision, or CMake options

Installation Process

The easiest way is to use the gmx_install.slurm script in this repo. Simply download it to your account and submit a batch job using sbatch gmx_install.slurm. The Gromacs will be installed at /home/$USER/software_slurm/Gromacs...

To simplify the process of setting up gromacs, we recommend that you use existing modules on Palmetto 2, such as Intel-MKL, openmpi, etc.

caution

Please note that different versions of GROMACS may require different combinations of modules. Some modules may be outdated or no longer included in the global module list, and users may need to identify the appropriate modules for their installation.

If you are curious about the installation, you can read the next section.

Installation Details

  • Get a node (choose the node type you wish to run Gromacs on)
salloc --nodes=1 --ntasks-per-node=12 --gpus-per-node=1 --mem=20G --time=01:00:00
  • Creating a local software directory
cd ~
mkdir software_slurm
  • Get Gromacs Source Code. The source code of Gromacs can be downloaded from official website GROMACS download link. For simplicity, one can use the following commands to download the 2025.1 version:
wget https://ftp.gromacs.org/gromacs/gromacs-2025.1.tar.gz
tar zxvf gromacs-2025.1.tar.gz
cd gromacs-2025.1
  • Create build directory
mkdir build_slurm
cd build_slurm
  • Load available modules on Palmetto
module load cmake/3.30.5
module load gcc/12.3.0
module load anaconda3 intel-oneapi-mkl openmpi
  • Identify architecture type and SIMD:

This is because Gromacs depends greatly on the architecture of the hardware as mentioned at the beginning.

lscpu | grep "Model name"

Select the correct architecture based on the CPU model and corresponding SIMD:

AVX_256AVX_512
E5-2665: sandybridge6148G: skylake
E5-2680: sandybridge6252G: cascadelake
E5-2670v2: ivybridge6238R: cascadelake
E5-2680v3: haswell6248: cascadelake
E5-2680v4: broadwell8358: icelake

In this example, given the previous salloc command, we most likely will get a node with AVX_512, which will be the input value for the below -DGMX_SIMD.

  • Compiling Gromacs
cmake .. -DGMX_MPI=on  -DGMX_FFT_LIBRARY=mkl -DGMX_SIMD=AVX_512 -DCMAKE_INSTALL_PREFIX=/home/$USER/software_slurm/gromacs-2025.1/gmx_cpu -DCMAKE_C_COMPILER=gcc
make -j 12
make install -j 12