Gromacs 2025.2 installation with CUDA 12.8

GROMACS version: 2025.2
GROMACS modification: No
Hi all ! Is gromacs 2025.2 compatible with CUDA 12.8. I have the error ptxas error when trying to install it Value of threads per SM for entry _ZN3gmx23nbnxn_kernel_prune_cudaILb0EEEvNS_13NBAtomDataGpuENS_10NBParamGpuENS_11GpuPairlistEi is out of range. .minnctapersm will be ignored ptxas fatal : Ptx assembly aborted due to errors.

Thank you !

Hi,

GROMACS 2025.2 is compatible with CUDA 12.8 (and 12.9 too). CUDA 13 compatibility will be added in 2025.3, to be released soon.

If you are trying to build for a GPU with sm_101 or sm_110, then this error is expected and will be fixed in GROMACS 2025.3 too.

Otherwise, please share more details: what GPU do you have, CMake version, how are you running CMake, etc.

Thank you for your answer !

I use a NVIDIA L4 so I don’t think it’s sm_101 or sm_110. I also have access to the NVDIA A10G Gpus but my simulations are slightly slower on these.

CMake version: 4.1.0

Here is my dockerfile so that you can see how I installa and then use CMake. It’s patched with libtorch 2.7.1. The base image is a mirror from a NVIDIA one if I am not mistaken. I plan to run my computation on a single node with 8 Open MP threads (my best performance so far) so I don’t install OpenMPI.

FROM library/ubuntu:22.04-cuda12.8.0-cudnn

# Install system dependencies
RUN apt update && apt install -y \
    build-essential \
    git \
    wget \
    unzip \
    libboost-all-dev \
    libfftw3-dev \
    libssl-dev \
    libhwloc-dev \
    libxml2-dev \
    python3.10 \
    python3.10-dev \
    libpython3.10

WORKDIR /opt/

# Install CMake >= 3.28
ENV CMAKE_VERSION=4.1.0
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz && \
    tar -zxvf cmake-4.1.0.tar.gz && \
    cd cmake-4.1.0 && \
    ./bootstrap && \
    make && \
    make install

# Install libtorch
ENV TORCH_VERSION=2.7.1
ENV TORCH_ZIP=libtorch-cxx11-abi-shared-with-deps-${TORCH_VERSION}%2Bcu128.zip
RUN wget https://download.pytorch.org/libtorch/cu128/${TORCH_ZIP} -O libtorch.zip && \
    unzip libtorch.zip -d /opt/libtorch && \
    rm libtorch.zip
ENV Torch_DIR=/opt/libtorch/libtorch/share/cmake/Torch
ENV LD_LIBRARY_PATH=/opt/libtorch/lib:$LD_LIBRARY_PATH

# Install GROMACS 2025.2
ENV GMX_VERSION=2025.2
RUN wget https://ftp.gromacs.org/gromacs/gromacs-${GMX_VERSION}.tar.gz && \
    tar -xzf gromacs-${GMX_VERSION}.tar.gz && \
    rm gromacs-${GMX_VERSION}.tar.gz

RUN cd gromacs-${GMX_VERSION} && \
    mkdir build && cd build && \
    cmake .. \
        -DGMX_GPU=CUDA \
        -DGMX_MPI=OFF \
        -DGMX_BUILD_OWN_FFTW=ON \
        -DCMAKE_INSTALL_PREFIX=/opt/gromacs \
        -DGMX_NNPOT=TORCH \
        -DPython_EXECUTABLE=/usr/bin/python3.10 \
        -DPython_INCLUDE_DIRS=/usr/include/python3.10 \
        -DPython_LIBRARIES=/usr/lib/x86_64-linux-gnu/libpython3.10.so \
        -DTorch_DIR=/opt/libtorch/libtorch/share/cmake/Torch && \
    make -j$(nproc) && \
    make install

# Add GROMACS to PATH
ENV PATH="/opt/gromacs/bin:$PATH"


Thank you for your help !

Hi,

The problem here (thanks for providing the Dockerfile!) is that Torch changes the build configuration such that all CUDA architectures are targeted, including uncommon ones like sm_101.

The solution would be to add -DTORCH_CUDA_ARCH_LIST=8.9 to GROMACS’s cmake command (or 8.6 when building for A10; nice list to look up the architecture).

Alternatively, you can wait for GROMACS 2025.3 (which will compile fine for all hardware) or try downgrading CMake to 3.29.

Not related to the issue, but if you want to speed up your Dockerfile build:

  1. Instead of building CMake yourself, you can download a pre-built version from https://github.com/Kitware/CMake/releases/download/v4.1.0/cmake-4.1.0-linux-x86_64.tar.gz
  2. You are installing libfftw3-dev with apt, so you should not need to use -DGMX_BUILD_OWN_FFTW=ON.

Hi,

Thank you for your answer. I implemented you suggested fix-DTORCH_CUDA_ARCH_LIST=8.9 and I removed DGMX_BUILD_OWN_FFTW=ON and it worked ! I now need to test it more thorougly. I tested it on a short unbiased trajectory and it worked well which is a start.

Regarding the cmake install pre-built version, that’s a nice tip to know for next time thank you.

Have a nice day !

1 Like