Skip to content
Snippets Groups Projects
Commit ac6885f8 authored by Steffen Müthing's avatar Steffen Müthing
Browse files

[Release][MPI] Add check for MPI standard version and warn if installed version is < 2.1

As decided in the doodle for FS#1395, really old MPI versions will be
deprecated in the 2.3 release.

This patch adds an additional check to the MPI tests for autotools and
cmake that makes sure the user has an MPI which is at least compliant
with MPI-2.1. If the user's version is older, a warning is generated.

The test uses version macros instead of the more standard runtime
MPI version query interface to avoid problems when cross-compiling.
parent 3e9a414d
No related branches found
No related tags found
No related merge requests found
......@@ -42,12 +42,34 @@ if(MPI_CXX_FOUND)
# Check whether the MPI-2 standard is supported
include(CMakePushCheckState)
include(CheckFunctionExists)
include(CheckCXXSourceCompiles)
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_DUNE_LIBRARIES})
set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} "-DENABLE_MPI=1 -DMPICH_SKIP_MPICXX -DMPIPP_H")
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_DUNE_INCLUDE_PATH})
check_function_exists(MPI_Finalized MPI_2)
# proper version check
check_cxx_source_compiles("
#include <mpi.h>
#if !((MPI_VERSION > 2) || (MPI_VERSION == 2 && MPI_SUBVERSION >= 1))
fail with a horribe compilation error due to old MPI version
#endif
int main(int argc, char** argv)
{
MPI_Init(&argc,&argv);
MPI_Finalize();
}
" MPI_VERSION_SUPPORTED)
cmake_pop_check_state()
# TODO: Turn into an error after 2.3 release
if(NOT MPI_VERSION_SUPPORTED)
MESSAGE(WARNING "Support for your MPI implementation is DEPRECATED and will be removed after the next release. Please upgrade to an MPI-2.1 compliant version.")
endif()
endif(MPI_CXX_FOUND)
# adds MPI flags to the targets
......
......@@ -157,6 +157,28 @@ AC_DEFUN([DUNE_MPI],[
with_mpi=no]
)
AC_MSG_CHECKING([whether MPI is recent enough (MPI-2.1)])
# check MPI version and issue a deprecation warning if MPI is older than 2.1
# TODO: Replace with error after 2.3 release
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[ #include <mpi.h>
#if !((MPI_VERSION > 2) || (MPI_VERSION == 2 && MPI_SUBVERSION >= 1))
fail with a horribe compilation error due to old MPI version
#endif
int main (int argc, char** argv) {
MPI_Init(&argc, &argv);
MPI_Finalize(); }])],
[ AC_MSG_RESULT([yes]) ],
[ AC_MSG_RESULT([no])
AC_MSG_WARN([You are using a very old version of MPI that
is not compatible with the MPI-2.1 standard. Support for your
version of MPI is deprecated and will be removed after the next
release!])
mpi_deprecated=yes]
)
AS_IF([test "x$mpiruntest" != "xyes"],[
AC_MSG_WARN([Disabled test whether running with $dune_MPI_VERSION works.])
],[
......@@ -210,7 +232,11 @@ AC_DEFUN([DUNE_MPI],[
AM_CONDITIONAL(MPI, [test "x$with_mpi" != "xno"])
DUNE_ADD_SUMMARY_ENTRY([MPI],[$with_mpi])
AS_IF([test "x$mpi_deprecated" == "xyes"],[
DUNE_ADD_SUMMARY_ENTRY([MPI],[$with_mpi (deprecated MPI version)])
],[
DUNE_ADD_SUMMARY_ENTRY([MPI],[$with_mpi])
])
AC_LANG_POP
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment