Hi there,
I am trying to create a docker image with a GPU-enabled version of LAMMPS. In the Dockerfile, I am trying to use CMake to build LAMMPS but am facing an error where by CMake cannot find MPI_CXX.
The error specifically is:
------
> [ 8/11] RUN cmake "/opt/lammps/cmake" -D LAMMPS_SOURCE_DIR="/opt/lammps" -D CMAKE_BUILD_TYPE=Release -C "/opt/lammps/cmake/presets/most.cmake" -D BUILD_SHARED_LIBS=ON -D PKG_PYTHON=ON -D PKG_OPENMP=ON -D BUILD_MPI=ON -D BUILD_OMP=ON -D PKG_KOKKOS=ON -D Kokkos_ENABLE_SERIAL=ON -D Kokkos_ENABLE_CUDA=ON -D Kokkos_ENABLE_OPENMP=ON -D Kokkos_ARCH_NATIVE=ON -D Kokkos_ARCH_ADA89=ON -D CMAKE_CXX_COMPILER=$(which mpicxx) -D CMAKE_CUDA_COMPILER=$(which nvcc) -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -D CMAKE_CUDA_HOST_COMPILER=$(which g++) -D CMAKE_CUDA_STANDARD=17:
1.024 CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
1.024 Could NOT find MPI (missing: MPI_CXX_FOUND CXX)
1.024 Call Stack (most recent call first):
1.024 /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
1.024 /usr/share/cmake-3.28/Modules/FindMPI.cmake:1837 (find_package_handle_standard_args)
1.024 CMakeLists.txt:393 (find_package)
1.024
1.024
1.024 -- Could NOT find MPI_CXX (missing: MPI_CXX_WORKS)
1.024 -- Configuring incomplete, errors occurred!
------
I think that I’ve installed it correctly, as earlier in the log file I can check the version and the location of some relevant packages:
#6 24.84 --- Checking mpicxx ---
#6 24.84 /usr/bin/mpicxx
#6 24.85 g++ (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
#6 24.85 Copyright (C) 2023 Free Software Foundation, Inc.
#6 24.85 This is free software; see the source for copying conditions. There is NO
#6 24.85 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#6 24.85
#6 24.85 --- Checking nvcc ---
#6 24.85 /usr/local/cuda/bin/nvcc
#6 24.85 nvcc: NVIDIA (R) Cuda compiler driver
#6 24.85 Copyright (c) 2005-2025 NVIDIA Corporation
#6 24.85 Built on Tue_May_27_02:21:03_PDT_2025
#6 24.85 Cuda compilation tools, release 12.9, V12.9.86
#6 24.85 Build cuda_12.9.r12.9/compiler.36037853_0
#6 24.85 --- Checking CMake ---
#6 24.85 /usr/bin/cmake
#6 24.86 cmake version 3.28.3
I’m a bit confused as to what is going on because it almost seems to me like CMake actually can find it as per the output below:
#12 0.333 -- The CXX compiler identification is GNU 13.3.0
#12 0.605 -- The C compiler identification is GNU 13.3.0
#12 0.620 -- Detecting CXX compiler ABI info
#12 0.696 -- Detecting CXX compiler ABI info - done
#12 0.702 -- Check for working CXX compiler: /usr/bin/mpicxx - skipped
#12 0.702 -- Detecting CXX compile features
#12 0.703 -- Detecting CXX compile features - done
#12 0.709 -- Detecting C compiler ABI info
#12 0.772 -- Detecting C compiler ABI info - done
#12 0.777 -- Check for working C compiler: /usr/bin/cc - skipped
#12 0.777 -- Detecting C compile features
#12 0.777 -- Detecting C compile features - done
#12 0.783 -- Found Git: /usr/bin/git (found version "2.43.0")
#12 0.783 -- Appending /usr/local/cuda/lib64/stubs to CMAKE_LIBRARY_PATH: /usr/local/cuda/lib64/stubs
#12 0.784 -- Running check for auto-generated files from make-based build system
#12 1.024 CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
#12 1.024 Could NOT find MPI (missing: MPI_CXX_FOUND CXX)
#12 1.024 Call Stack (most recent call first):
#12 1.024 /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
#12 1.024 /usr/share/cmake-3.28/Modules/FindMPI.cmake:1837 (find_package_handle_standard_args)
#12 1.024 CMakeLists.txt:393 (find_package)
#12 1.024
#12 1.024
Hopefully this is the right place to post this issue. Any advice would be much appreciated!
Thanks in advance,