From: Roland Schulz Date: Fri, 29 Jan 2021 15:20:25 +0000 (+0000) Subject: Use cxx mpi X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=ef88aa7f48223ea0ec4e742baa9c0eec5685344b;p=alexxy%2Fgromacs.git Use cxx mpi --- diff --git a/api/gmxapi/CMakeLists.txt b/api/gmxapi/CMakeLists.txt index d136d315cb..1fcf9b69ec 100644 --- a/api/gmxapi/CMakeLists.txt +++ b/api/gmxapi/CMakeLists.txt @@ -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 () diff --git a/cmake/gmxManageMPI.cmake b/cmake/gmxManageMPI.cmake index 82737aaed8..ea6cf95725 100644 --- a/cmake/gmxManageMPI.cmake +++ b/cmake/gmxManageMPI.cmake @@ -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) diff --git a/docs/install-guide/index.rst b/docs/install-guide/index.rst index bdbcabe93b..75e98e1cdc 100644 --- a/docs/install-guide/index.rst +++ b/docs/install-guide/index.rst @@ -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