Skip to content
Snippets Groups Projects
Commit 1c6c0c24 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Add features to get PLATFORM MPI library name reported

parent 65f04687
Branches
Tags
2 merge requests!136Master,!72Print information about the libraries used in the greeting message
......@@ -60,6 +60,7 @@ AC_ARG_ENABLE([mpi],
good_mpi="yes"
if test "$enable_mpi" = "yes"; then
AX_MPI([CC="$MPICC" AC_DEFINE(HAVE_MPI, 1, [Define if you have the MPI library.]) ])
MPI_LIBRARY="Unknown MPI"
# Various MPI implementations require additional libraries when also using
# threads. Use mpirun (on PATH) as that seems to be only command with
......@@ -83,14 +84,17 @@ if test "$enable_mpi" = "yes"; then
case "$version" in
*Intel*MPI*)
MPI_THREAD_LIBS="-mt_mpi"
MPI_LIBRARY="Intel MPI"
AC_MSG_RESULT([Intel MPI])
;;
*Platform*)
MPI_THREAD_LIBS="-lmtmpi"
MPI_LIBRARY="PLATFORM MPI"
AC_MSG_RESULT([PLATFORM MPI])
;;
*"Open MPI"*)
MPI_THREAD_LIBS=""
MPI_LIBRARY="Open MPI"
AC_MSG_RESULT([Open MPI])
# OpenMPI should be 1.8.6 or later, if not complain.
# Version is last word on first line of -version output.
......@@ -109,6 +113,7 @@ if test "$enable_mpi" = "yes"; then
esac
AC_SUBST([MPI_THREAD_LIBS])
fi
AC_DEFINE_UNQUOTED([SWIFT_MPI_LIBRARY], ["$MPI_LIBRARY"], [The MPI library name, if known.])
fi
AM_CONDITIONAL([HAVEMPI],[test $enable_mpi = "yes"])
......
......@@ -140,21 +140,26 @@ const char *compiler_version(void) {
const char *mpi_version(void) {
static char version[256] = {0};
#ifdef WITH_MPI
int len, std_version, std_subversion;
/* Check that the library implements the version string routine */
int std_version, std_subversion;
/* Check that the library implements the version string routine */
#ifdef MPI_MAX_LIBRARY_VERSION_STRING
static char lib_version[MPI_MAX_LIBRARY_VERSION_STRING] = {0};
int len;
MPI_Get_library_version(lib_version, &len);
/* Find first \n and truncate string to this length, get many lines from
/* Find first \n and truncate string to this length, can get many lines from
* some MPIs (MPICH). */
char *ptr = strchr(lib_version, '\n');
if (ptr != NULL) *ptr = '\0';
#else
/* Use autoconf guessed value. */
static char lib_version[256] = {0};
sprintf(lib_version, "Unknown library");
sprintf(lib_version, SWIFT_MPI_LIBRARY);
#endif
/* Numeric version. */
MPI_Get_version(&std_version, &std_subversion);
snprintf(version, 256, "%s (implementing MPI standard v %i.%i)", lib_version,
std_version, std_subversion);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment