diff --git a/configure.ac b/configure.ac index 470c60d9a2ac27b6a10c3d21a7e91dfec909f02c..3d90fba4a0582153567cebef5b1fbabe3aee6d0b 100644 --- a/configure.ac +++ b/configure.ac @@ -426,70 +426,64 @@ AC_CHECK_LIB(pthread, posix_fallocate, AC_DEFINE([HAVE_POSIX_FALLOCATE], [1], [The posix library implements file allocation functions.]), AC_MSG_WARN(POSIX implementation does not have file allocation functions.)) -# Check for METIS or PARMETIS. -have_metis="no" +# Check for PARMETIS. have_parmetis="no" -AC_ARG_WITH([metis], - [AS_HELP_STRING([--with-metis=PATH], - [root directory where metis or parmetis is installed @<:@yes/no@:>@] +AC_ARG_WITH([parmetis], + [AS_HELP_STRING([--with-parmetis=PATH], + [root directory where ParMETIS is installed @<:@yes/no@:>@] )], [], - [with_metis="no"] + [with_parmetis="no"] +) + +# Don't proceed with old --with-metis option. +used_metis="no" +AC_ARG_WITH([metis], + [AS_HELP_STRING([--with-metis], + [no longer supported, use --with-parmetis] + )], + [used_metis="yes"], + [] ) -if test "x$with_metis" != "xno"; then +if test "x$used_metis" != "xno"; then + AC_MSG_ERROR([Using unsupported --with-metis option, use --with-parmetis]) +fi + +if test "x$with_parmetis" != "xno"; then # Check if we have ParMETIS. - if test "x$with_metis" != "xyes" -a "x$with_metis" != "x"; then - METIS_LIBS="-L$with_metis/lib -lparmetis" - METIS_INCS="-I$with_metis/include" + if test "x$with_parmetis" != "xyes" -a "x$with_parmetis" != "x"; then + PARMETIS_LIBS="-L$with_parmetis/lib -lparmetis" + PARMETIS_INCS="-I$with_parmetis/include" else - METIS_LIBS="-lparmetis" - METIS_INCS="" + PARMETIS_LIBS="-lparmetis" + PARMETIS_INCS="" fi - AC_CHECK_LIB([metis],[ParMETIS_V3_RefineKway], [have_parmetis="yes"], - [have_parmetis="no"], $METIS_LIBS) + AC_CHECK_LIB([parmetis],[ParMETIS_V3_RefineKway], [have_parmetis="yes"], + [have_parmetis="no"], $PARMETIS_LIBS) if test "$have_parmetis" == "no"; then # A build may use an external METIS library, check for that. - if test "x$with_metis" != "xyes" -a "x$with_metis" != "x"; then - METIS_LIBS="-L$with_metis/lib -lparmetis -lmetis" - METIS_INCS="-I$with_metis/include" + if test "x$with_parmetis" != "xyes" -a "x$with_parmetis" != "x"; then + PARMETIS_LIBS="-L$with_parmetis/lib -lparmetis -lmetis" + PARMETIS_INCS="-I$with_parmetis/include" else - METIS_LIBS="-lparmetis -lmetis" - METIS_INCS="" + PARMETIS_LIBS="-lparmetis -lmetis" + PARMETIS_INCS="" fi - AC_CHECK_LIB([metis],[ParMETIS_V3_RefineKway], [have_parmetis="yes"], - [have_parmetis="no"], $METIS_LIBS) + AC_CHECK_LIB([parmetis],[ParMETIS_V3_RefineKway], [have_parmetis="yes"], + [have_parmetis="no"], $PARMETIS_LIBS) fi - if test "$have_parmetis" == "no"; then - -# Finally check for serial METIS. - if test "x$with_metis" != "xyes" -a "x$with_metis" != "x"; then - 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],[have_metis="yes"], - [have_metis="no"], $METIS_LIBS) - - if test "$have_metis" == "yes"; then - AC_DEFINE([HAVE_METIS],1,[The metis library appears to be present.]) - else - AC_MSG_ERROR(something is wrong with the metis library!) - fi - else - AC_DEFINE([HAVE_METIS],1,[The METIS library appears to be present.]) - AC_DEFINE([HAVE_PARMETIS],1,[The ParMETIS library is also present.]) + if test "$have_parmetis" == "yes"; then + AC_DEFINE([HAVE_PARMETIS],1,[The ParMETIS library is present.]) fi fi -AC_SUBST([METIS_LIBS]) -AC_SUBST([METIS_INCS]) -AM_CONDITIONAL([HAVEMETIS],[test -n "$METIS_LIBS"]) +AC_SUBST([PARMETIS_LIBS]) +AC_SUBST([PARMETIS_INCS]) +AM_CONDITIONAL([HAVEPARMETIS],[test -n "$PARMETIS_LIBS"]) # Check for grackle. have_grackle="no" @@ -1078,7 +1072,6 @@ AC_MSG_RESULT([ MPI enabled : $enable_mpi HDF5 enabled : $with_hdf5 - parallel : $have_parallel_hdf5 - Metis enabled : $have_metis ParMETIS enabled : $have_parmetis FFTW3 enabled : $have_fftw3 libNUMA enabled : $have_numa diff --git a/examples/Makefile.am b/examples/Makefile.am index bddb32943781e9326e05cc5c55a87086fc96cf02..c5537441d5792f00cac9f71a3c9b99a71b13b8e6 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -27,8 +27,8 @@ AM_LDFLAGS = $(HDF5_LDFLAGS) EXTRA_LIBS = $(HDF5_LIBS) $(FFTW_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(GRACKLE_LIBS) # MPI libraries. -MPI_LIBS = $(METIS_LIBS) $(MPI_THREAD_LIBS) -MPI_FLAGS = -DWITH_MPI $(METIS_INCS) +MPI_LIBS = $(PARMETIS_LIBS) $(MPI_THREAD_LIBS) +MPI_FLAGS = -DWITH_MPI $(PARMETIS_INCS) # Programs. bin_PROGRAMS = swift diff --git a/src/Makefile.am b/src/Makefile.am index 82b7aa73e10c1fa0b369886c48322985aadbc618..3c51aea784b2370aa38878a5997a723535b6f72b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,8 +28,8 @@ GIT_CMD = @GIT_CMD@ EXTRA_LIBS = $(HDF5_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(GRACKLE_LIB) # MPI libraries. -MPI_LIBS = $(METIS_LIBS) $(MPI_THREAD_LIBS) -MPI_FLAGS = -DWITH_MPI $(METIS_INCS) +MPI_LIBS = $(PARMETIS_LIBS) $(MPI_THREAD_LIBS) +MPI_FLAGS = -DWITH_MPI $(PARMETIS_INCS) # Build the libswiftsim library lib_LTLIBRARIES = libswiftsim.la diff --git a/src/common_io.c b/src/common_io.c index 7d0b0cb3ef026eb7bbbe17b82fb072f83c395305..8db707ff81ac0122d1781db3c40590473bbb5bfe 100644 --- a/src/common_io.c +++ b/src/common_io.c @@ -397,8 +397,9 @@ void io_write_code_description(hid_t h_file) { #endif #ifdef WITH_MPI io_write_attribute_s(h_grpcode, "MPI library", mpi_version()); -#ifdef HAVE_METIS - io_write_attribute_s(h_grpcode, "METIS library version", metis_version()); +#ifdef HAVE_PARMETIS + io_write_attribute_s(h_grpcode, "ParMETIS library version", + parmetis_version()); #endif #else io_write_attribute_s(h_grpcode, "MPI library", "Non-MPI version of SWIFT"); diff --git a/src/debug.c b/src/debug.c index 77d791a31787c7997a9a56e3204dac1160178976..ee19c26f03bf4d05086b27c3e5872448edb11b2f 100644 --- a/src/debug.c +++ b/src/debug.c @@ -394,16 +394,16 @@ void dumpCells(const char *prefix, int active, int mpiactive, int pactive, fclose(file); } -#if defined(WITH_MPI) && defined(HAVE_METIS) +#if defined(WITH_MPI) && defined(HAVE_PARMETIS) /** - * @brief Dump the METIS graph in standard format, simple format and weights - * only, to a file. + * @brief Dump the ParMETIS graph in standard METIS format, simple format and + * weights only, to a file. * - * The standard format output can be read into the METIS - * command-line tools. The simple format is just the cell connectivity (this - * should not change between calls). The weights format is the standard one, - * minus the cell connectivity. + * The standard format output can be read into the METIS and some ParMETIS + * command-line tools and tests. The simple format is just the cell + * connectivity (this should not change between calls). The weights format is + * the standard one, minus the cell connectivity. * * The output filenames are generated from the prefix and the sequence number * of calls. So the first is called {prefix}_std_001.dat, @@ -419,9 +419,10 @@ void dumpCells(const char *prefix, int active, int mpiactive, int pactive, * @param vertexsizes size of vertices * @param edgeweights weights of edges */ -void dumpMETISGraph(const char *prefix, idx_t nvertices, idx_t nvertexweights, - idx_t *cellconruns, idx_t *cellcon, idx_t *vertexweights, - idx_t *vertexsizes, idx_t *edgeweights) { +void dumpParMETISGraph(const char *prefix, idx_t nvertices, + idx_t nvertexweights, idx_t *cellconruns, + idx_t *cellcon, idx_t *vertexweights, + idx_t *vertexsizes, idx_t *edgeweights) { FILE *stdfile = NULL; FILE *simplefile = NULL; FILE *weightfile = NULL; @@ -532,7 +533,7 @@ void dumpMETISGraph(const char *prefix, idx_t nvertices, idx_t nvertexweights, } } -#endif /* HAVE_METIS */ +#endif /* HAVE_PARMETIS */ #ifdef HAVE_MPI /** diff --git a/src/debug.h b/src/debug.h index 5a646948204cc809c66430bb01c9ee90e21d720a..8d2748944013e99cc3f22d25855ac60baa7fb3f7 100644 --- a/src/debug.h +++ b/src/debug.h @@ -39,10 +39,11 @@ int checkCellhdxmax(const struct cell *c, int *depth); void dumpCells(const char *prefix, int active, int mpiactive, int pactive, struct space *s, int rank, int step); -#if defined(WITH_MPI) && defined(HAVE_METIS) -#include "metis.h" -void dumpMETISGraph(const char *prefix, idx_t nvtxs, idx_t ncon, idx_t *xadj, - idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt); +#if defined(WITH_MPI) && defined(HAVE_PARMETIS) +#include "parmetis.h" +void dumpParMETISGraph(const char *prefix, idx_t nvtxs, idx_t ncon, + idx_t *xadj, idx_t *adjncy, idx_t *vwgt, idx_t *vsize, + idx_t *adjwgt); #endif #ifdef HAVE_MPI diff --git a/src/engine.c b/src/engine.c index 6f6d91ca77ce8ca015d0f26e5d1a1bb33983b1b6..a8782d7b78d7d6b7fc225448a5f714a5dfd30712 100644 --- a/src/engine.c +++ b/src/engine.c @@ -976,7 +976,7 @@ void engine_redistribute(struct engine *e) { */ void engine_repartition(struct engine *e) { -#if defined(WITH_MPI) && defined(HAVE_METIS) +#if defined(WITH_MPI) && defined(HAVE_PARMETIS) ticks tic = getticks(); @@ -993,7 +993,7 @@ void engine_repartition(struct engine *e) { /* Clear the repartition flag. */ e->forcerepart = 0; - /* Nothing to do if only using a single node. Also avoids METIS + /* Nothing to do if only using a single node. Also avoids ParMETIS * bug that doesn't handle this case well. */ if (e->nr_nodes == 1) return; @@ -1034,7 +1034,7 @@ void engine_repartition(struct engine *e) { clocks_getunit()); #else if (e->reparttype->type != REPART_NONE) - error("SWIFT was not compiled with MPI and METIS support."); + error("SWIFT was not compiled with MPI and ParMETIS support."); /* Clear the repartition flag. */ e->forcerepart = 0; diff --git a/src/scheduler.c b/src/scheduler.c index 0d96368e5711935813322107df4286176210552a..fea6f632f4924dab2d059aa116ac4ade6065a194 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1289,7 +1289,7 @@ void scheduler_reweight(struct scheduler *s, int verbose) { cost = 0; break; } -#if defined(WITH_MPI) && defined(HAVE_METIS) +#if defined(WITH_MPI) && defined(HAVE_PARMETIS) t->cost = cost; #endif t->weight += cost; diff --git a/src/space.c b/src/space.c index 0b2007ad1d8a6a4691a17a6fda721119caee07ee..c38ae6b405095e75c286c07ee265186975615040 100644 --- a/src/space.c +++ b/src/space.c @@ -500,7 +500,7 @@ void space_regrid(struct space *s, int verbose) { /* Failed, try another technique that requires no settings. */ message("Failed to get a new partition, trying less optimal method"); struct partition initial_partition; -#ifdef HAVE_METIS +#ifdef HAVE_PARMETIS initial_partition.type = INITPART_PARMETIS_NOWEIGHT; #else initial_partition.type = INITPART_VECTORIZE; diff --git a/src/task.h b/src/task.h index 73dc272a763162bfcc8a10774c8c05f1b9a401f6..3e21bb4426ccb40f9a06fdce27deddc8cf1137cc 100644 --- a/src/task.h +++ b/src/task.h @@ -140,7 +140,7 @@ struct task { /*! Weight of the task */ int weight; -#if defined(WITH_MPI) && defined(HAVE_METIS) +#if defined(WITH_MPI) && defined(HAVE_PARMETIS) /*! Individual cost estimate for this task. */ int cost; #endif diff --git a/src/version.c b/src/version.c index f4177e5c83c776ea063ad32fd00895199c94b182..9e343bae357369dd1a5401af5c01f6819ca6fe16 100644 --- a/src/version.c +++ b/src/version.c @@ -24,8 +24,8 @@ /* MPI headers. */ #ifdef WITH_MPI #include <mpi.h> -#ifdef HAVE_METIS -#include <metis.h> +#ifdef HAVE_PARMETIS +#include <parmetis.h> #endif #endif @@ -300,16 +300,16 @@ const char *hdf5_version(void) { } /** - * @brief return the METIS version used when SWIFT was built. + * @brief return the ParMETIS version used when SWIFT was built. * - * @result description of the METIS version. + * @result description of the ParMETIS version. */ -const char *metis_version(void) { +const char *parmetis_version(void) { static char version[256] = {0}; -#if defined(WITH_MPI) && defined(HAVE_METIS) - sprintf(version, "%i.%i.%i", METIS_VER_MAJOR, METIS_VER_MINOR, - METIS_VER_SUBMINOR); +#if defined(WITH_MPI) && defined(HAVE_PARMETIS) + sprintf(version, "%i.%i.%i", PARMETIS_MAJOR_VERSION, PARMETIS_MINOR_VERSION, + PARMETIS_SUBMINOR_VERSION); #else sprintf(version, "Unknown version"); #endif @@ -378,8 +378,8 @@ void greetings(void) { #endif #ifdef WITH_MPI printf(" MPI library: %s\n", mpi_version()); -#ifdef HAVE_METIS - printf(" METIS library version: %s\n", metis_version()); +#ifdef HAVE_PARMETIS + printf(" ParMETIS library version: %s\n", parmetis_version()); #endif #endif printf("\n"); diff --git a/src/version.h b/src/version.h index 1af76b647b2d401bb4a7998b281864fb3e63a0c8..bb62920c76f2aabcc8fa1e0def865f1088cf2d23 100644 --- a/src/version.h +++ b/src/version.h @@ -31,7 +31,7 @@ const char* compilation_cflags(void); const char* compiler_name(void); const char* compiler_version(void); const char* mpi_version(void); -const char* metis_version(void); +const char* parmetis_version(void); const char* hdf5_version(void); const char* fftw3_version(void); const char* thread_barrier_version(void);