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

Add MPI and METIS support, neither is enabled by default

For future requirements
parent 81c1067a
No related branches found
No related tags found
1 merge request!5Autotools update
......@@ -45,6 +45,59 @@ LT_INIT
AX_COMPILER_VENDOR
AX_COMPILER_VERSION
# Check for MPI. Need to do this before characterising the compiler (C99 mode),
# as this changes the compiler.
# We should consider using AX_PROG_CC_MPI to replace AC_PROG_CC when compiling
# whole applications. There are issues with mixing compilers when using this
# macro. See
# http://lists.gnu.org/archive/html/autoconf-archive-maintainers/2011-05/msg00004.html.
AC_ARG_ENABLE([mpi],
[AS_HELP_STRING([--enable-mpi],
[Compile with functionality for distributed-memory parallelism using MPI @<:@default=yes@:>@]
)],
[enable_mpi="$enableval"],
[enable_mpi="no"]
)
if test "$enable_mpi" = "yes"; then
AX_MPI([CC="$MPICC" AC_DEFINE(HAVE_MPI, 1, [Define if you have the MPI library.]) ])
# Various MPI implementations require additional libraries when also using
# threads. Use mpirun (on PATH) as that seems to be only command with
# version flag.
AC_PATH_PROG([MPIRUN],[mpirun],[notfound])
if test "$MPIRUN" = "notfound"; then
AC_MSG_WARN([Cannot find mpirun command on PATH, thread support may not be correct])
else
# Special options we know about.
# Intel: -mt_mpi
# PLATFORM: -lmtmpi
# OpenMPI: nothing, but library should be built correctly.
# Set MPI_THREAD_LIBS and add to linker commands as necessary.
AC_MSG_CHECKING([MPI threads options])
version=`$MPIRUN -version 2>&1`
case "$version" in
*Intel*MPI*)
MPI_THREAD_LIBS="-mt_mpi"
AC_MSG_RESULT([Intel MPI])
;;
*Platform*)
MPI_THREAD_LIBS="-lmtmpi"
AC_MSG_RESULT([PLATFORM MPI])
;;
*"Open MPI"*)
MPI_THREAD_LIBS=""
AC_MSG_RESULT([Open MPI])
;;
*)
MPI_THREAD_LIBS=""
AC_MSG_RESULT([unknown])
;;
esac
AC_SUBST([MPI_THREAD_LIBS])
fi
fi
AM_CONDITIONAL([HAVEMPI],[test -n "$MPICC"])
# Need C99 and inline support.
AC_PROG_CC_C99
AC_C_INLINE
......@@ -125,6 +178,29 @@ else
AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])
fi
# Check for metis. Note AX_LIB_METIS exists, but cannot be configured
# to be default off (i.e. given no option it tries to locate METIS), so we
# don't use that.
AC_ARG_WITH([metis],
[AS_HELP_STRING([--with-metis=PATH],
[prefix where the metis library is installed @<:@default=yes@:>@]
)],
[],
[with_metis="no"]
)
if test "x$with_metis" != "xno"; then
if test "x$with_metis" != "xyes" -a "x$with_metis" != "x"; then
METIS_LIBS="-L$with_metis -lmetis"
else
METIS_LIBS="-lmetis"
fi
AC_CHECK_LIB([metis],[METIS_PartGraphKway],
AC_DEFINE([HAVE_METIS],1,[The metis library appears to be present.]),
AC_MSG_ERROR(something is wrong with the metis library!),$METIS_LIBS)
fi
AC_SUBST([METIS_LIBS])
AM_CONDITIONAL([HAVEMETIS],[test -n "$METIS_LIBS"])
# Check for timing functions needed by cycle.h
AC_C_INLINE
AC_HEADER_TIME
......@@ -164,7 +240,9 @@ AC_MSG_RESULT([
vendor: $ax_cv_c_compiler_vendor
version: $ax_cv_c_compiler_version
flags: $CFLAGS
MPI enabled: $enable_mpi
OpenMP enabled: $enable_openmp
Metis enabled: $with_metis
])
# generate output.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment