Use cxx mpi
authorRoland Schulz <roland.schulz@intel.com>
Fri, 29 Jan 2021 15:20:25 +0000 (15:20 +0000)
committerPaul Bauer <paul.bauer.q@gmail.com>
Fri, 29 Jan 2021 15:20:25 +0000 (15:20 +0000)
api/gmxapi/CMakeLists.txt
cmake/gmxManageMPI.cmake
docs/install-guide/index.rst

index d136d315cbf65c34b6a3a1ce8707ff4cd288ed55..1fcf9b69ec88d1e96c6723e59890ffddbf91f8e6 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -67,11 +67,11 @@ if (GMX_LIB_MPI)
     # Clarification should be possible with resolution of #3672.
     set(_gmx_mpi_type "library")
     # Ref https://cmake.org/cmake/help/v3.13/module/FindMPI.html#variables-for-using-mpi
-    find_package(MPI COMPONENTS C)
-    if (MPI_C_FOUND)
-        target_link_libraries(gmxapi PRIVATE MPI::MPI_C)
+    find_package(MPI COMPONENTS CXX)
+    if (MPI_CXX_FOUND)
+target_link_libraries(gmxapi PRIVATE MPI::MPI_CXX)
         # If clients also need to link this target, we need to provide help in gmxapi-config.cmake
-        set(_gmxapi_find_dependencies "find_dependency(MPI COMPONENTS C)")
+        set(_gmxapi_find_dependencies "find_dependency(MPI COMPONENTS CXX)")
     else()
         message(FATAL_ERROR "Building gmxapi for MPI-enabled GROMACS, but no MPI toolchain found.")
     endif ()
index 82737aaed8c31c4a29876299c65afbe665ca7beb..ea6cf957252bb4daf320f0765990a22637812659 100644 (file)
@@ -2,7 +2,7 @@
 # This file is part of the GROMACS molecular simulation package.
 #
 # Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
-# Copyright (c) 2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -50,15 +50,15 @@ if(GMX_MPI)
   # If CMAKE_C_COMPILER is not a MPI wrapper. Try to find MPI using cmake module as fall-back.
   if(NOT MPI_FOUND)
       find_package(MPI)
-      if(MPI_C_FOUND)
-          set(MPI_COMPILE_FLAGS ${MPI_C_COMPILE_FLAGS})
+      if(MPI_CXX_FOUND)
+          set(MPI_COMPILE_FLAGS ${MPI_CXX_COMPILE_FLAGS})
           separate_arguments(MPI_COMPILE_FLAGS)
-          set(MPI_LINKER_FLAGS ${MPI_C_LINK_FLAGS})
-          separate_arguments(MPI_C_LINK_FLAGS)
-          include_directories(SYSTEM ${MPI_C_INCLUDE_PATH})
-          list(APPEND GMX_COMMON_LIBRARIES ${MPI_C_LIBRARIES})
+          set(MPI_LINKER_FLAGS ${MPI_CXX_LINK_FLAGS})
+          separate_arguments(MPI_CXX_LINK_FLAGS)
+          include_directories(SYSTEM ${MPI_CXX_INCLUDE_PATH})
+          list(APPEND GMX_COMMON_LIBRARIES ${MPI_CXX_LIBRARIES})
       endif()
-      set(MPI_FOUND ${MPI_C_FOUND})
+      set(MPI_FOUND ${MPI_CXX_FOUND})
   else()
       # The following defaults are based on FindMPI.cmake in cmake
       # 3.1.2. (That package does not actually do any detection of the
@@ -91,8 +91,8 @@ if(GMX_MPI)
     endif()
 
     # Find path of the mpi compilers
-    if (${MPI_C_FOUND})
-        get_filename_component(_mpi_c_compiler_path "${MPI_C_COMPILER}" PATH)
+    if (${MPI_CXX_FOUND})
+        get_filename_component(_mpi_c_compiler_path "${MPI_CXX_COMPILER}" PATH)
         get_filename_component(_mpiexec_path "${MPIEXEC}" PATH)
     else()
         get_filename_component(_cmake_c_compiler_path "${CMAKE_C_COMPILER}" PATH)
@@ -172,7 +172,7 @@ if(GMX_MPI)
       message(FATAL_ERROR
         "MPI support requested, but no MPI compiler found. Either set the "
         "C-compiler (CMAKE_C_COMPILER) to the MPI compiler (often called mpicc), "
-        "or set the variables reported missing for MPI_C above.")
+        "or set the variables reported missing for MPI_CXX above.")
   endif()
 
   set(GMX_LIB_MPI 1)
index bdbcabe93bf6b2a5ec2ae87cc1b48d950afcd72f..75e98e1cdc55902187be084b79cd567a703f7a02 100644 (file)
@@ -235,7 +235,7 @@ library. LAM-MPI_ might work, but since it has
 been deprecated for years, it is not supported.
 
 For example, depending on your actual MPI library, use ``cmake
--DMPI_C_COMPILER=mpicc -DGMX_MPI=on``.
+-DMPI_CXX_COMPILER=mpic++ -DGMX_MPI=on``.
 
 
 CMake