diff --git a/INSTALL.swift b/INSTALL.swift index 758a5a517fb796cdbde4dd89afabef0403355cdc..5ced7083e2c32751364ab08b9818b84445f4334a 100644 --- a/INSTALL.swift +++ b/INSTALL.swift @@ -58,10 +58,35 @@ for instance. GCC address sanitizer flags can be included using the option. Note this requires a GCC compiler version of at least 4.8. -Dependencies: needs to be filled in... +SWIFT currently requires a compiler with OpenMP support. - + Dependencies + ============ +SWIFT depends on a number of thirdparty libraries that should be available +before you can build it. +HDF5: a HDF5 library is required to read and write particle data. One of the +commands "h5cc" or "h5pcc" should be available. If "h5pcc" is located them a +parallel HDF5 built for the version of MPI located should be provided. If +the command is not available then it can be located using the "--with-hfd5" +configure option. The value should be the full path to the "h5cc" or "h5pcc" +commands. + + +MPI: an optional MPI library that fully supports MPI_THREAD_MULTIPLE. +Before running configure the "mpirun" command should be available in the +shell. + + +METIS: a build of the METIS library can be optionally used to optimize the +load between MPI nodes (requires an MPI library). This should be found in the +standard installation directories, or pointed at using the "--with-metis" +configuration option. In this case the top-level installation directory of +the METIS build should be given. Note to use METIS you should at least supply +"--with-metis". + + +DOXYGEN: the doxygen library is required to create the SWIFT API documentation. diff --git a/configure.ac b/configure.ac index b55de0aeb81db74cc3f5a12d1910233f172eb49d..933f2ba453f7190855c4e5d8f9e3c41b3256c3d1 100644 --- a/configure.ac +++ b/configure.ac @@ -67,6 +67,7 @@ if test "$enable_mpi" = "yes"; then 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]) + enable_mpi="no" else # Special options we know about. # Intel: -mt_mpi @@ -105,9 +106,7 @@ if test "$enable_mpi" = "yes"; then AC_SUBST([MPI_THREAD_LIBS]) fi fi -AM_CONDITIONAL([HAVEMPI],[test -n "$MPICC"]) - - +AM_CONDITIONAL([HAVEMPI],[test $enable_mpi = "yes"]) # Need C99 and inline support. AC_PROG_CC_C99 @@ -199,22 +198,25 @@ fi # don't use that. AC_ARG_WITH([metis], [AS_HELP_STRING([--with-metis=PATH], - [prefix where the metis library is installed @<:@default=yes@:>@] + [root directory where metis 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" + METIS_LIBS="-L$with_metis/lib -lmetis" + METIS_INCS="-I$with_metis/include" else METIS_LIBS="-lmetis" + METIS_INCS="" 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]) +AC_SUBST([METIS_INCS]) AM_CONDITIONAL([HAVEMETIS],[test -n "$METIS_LIBS"]) # Check for zlib. diff --git a/examples/Makefile.am b/examples/Makefile.am index eff15afef3ed0597f95c38f5160178d9868abe48..0ae3cbba9ded84e94b4cbe583344064b391d1c4a 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -20,13 +20,13 @@ MYFLAGS = -DTIMER # Add the source directory and debug to CFLAGS -AM_CFLAGS = -Wall -Werror -I../src -DCPU_TPS=2.67e9 +AM_CFLAGS = -Wall -Werror -I../src -DCPU_TPS=2.67e9 $(HDF5_CPPFLAGS) AM_LDFLAGS = -METIS_LIBS = @METIS_LIBS@ MPI_THREAD_LIBS = @MPI_THREAD_LIBS@ MPI_LIBS = $(METIS_LIBS) $(MPI_THREAD_LIBS) +MPI_FLAGS = -DWITH_MPI $(METIS_INCS) # Set-up the library bin_PROGRAMS = test test_fixdt test_mindt test_single @@ -53,17 +53,17 @@ test_mindt_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS) # Sources for test_mpi test_mpi_SOURCES = test.c -test_mpi_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DWITH_MPI -DENGINE_POLICY="engine_policy_multistep | engine_policy_keep" +test_mpi_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) $(MPI_FLAGS) -DENGINE_POLICY="engine_policy_multistep | engine_policy_keep" test_mpi_LDADD = ../src/.libs/libswiftsim_mpi.a $(HDF5_LDFLAGS) $(HDF5_LIBS) $(MPI_LIBS) # Sources for test_fixdt_mpi test_fixdt_mpi_SOURCES = test.c -test_fixdt_mpi_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DWITH_MPI -DENGINE_POLICY="engine_policy_fixdt | engine_policy_keep" +test_fixdt_mpi_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) $(MPI_FLAGS) -DENGINE_POLICY="engine_policy_fixdt | engine_policy_keep" test_fixdt_mpi_LDADD = ../src/.libs/libswiftsim_mpi.a $(HDF5_LDFLAGS) $(HDF5_LIBS) $(MPI_LIBS) # Sources for test_mindt_mpi test_mindt_mpi_SOURCES = test.c -test_mindt_mpi_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DWITH_MPI -DENGINE_POLICY="engine_policy_keep" +test_mindt_mpi_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) $(MPI_FLAGS) -DENGINE_POLICY="engine_policy_keep" test_mindt_mpi_LDADD = ../src/.libs/libswiftsim_mpi.a $(HDF5_LDFLAGS) $(HDF5_LIBS) $(MPI_LIBS) # Sources for test_single diff --git a/src/Makefile.am b/src/Makefile.am index f203cc49c742d5f7f3cc0f199a93cad344b2ae7a..78f29fe5b87b0ef8ef6a0948039df2ca52e712aa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,7 +17,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Add the debug flag to the whole thing -AM_CFLAGS = -DTIMER -DCOUNTER -DCPU_TPS=2.30e9 +AM_CFLAGS = -DTIMER -DCOUNTER -DCPU_TPS=2.30e9 $(HDF5_CPPFLAGS) # Assign a "safe" version number AM_LDFLAGS = $(LAPACK_LIBS) $(BLAS_LIBS) $(HDF5_LDFLAGS) -version-info 0:0:0 # -fsanitize=address @@ -52,7 +52,7 @@ libswiftsim_la_SOURCES = $(AM_SOURCES) # Sources and flags for MPI library libswiftsim_mpi_la_SOURCES = $(AM_SOURCES) -libswiftsim_mpi_la_CFLAGS = $(AM_CFLAGS) -DWITH_MPI +libswiftsim_mpi_la_CFLAGS = $(AM_CFLAGS) -DWITH_MPI $(METIS_INCS) libswiftsim_mpi_la_SHORTNAME = mpi diff --git a/src/engine.c b/src/engine.c index 3ed6564e711e88fcd1307a9b46b5e62a94125cf7..2633acdd7857978ff6ac90e63442546ae6660480 100644 --- a/src/engine.c +++ b/src/engine.c @@ -35,11 +35,11 @@ /* MPI headers. */ #ifdef WITH_MPI #include <mpi.h> -#endif -/* METIS headers. */ -#ifdef HAVE_METIS - #include <metis.h> +/* METIS headers only used when MPI is also available. */ + #ifdef HAVE_METIS + #include <metis.h> + #endif #endif /* Local headers. */