Commit 2c4e9683 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Remove all remaining traces of serial METIS

parent 04b2ba4b
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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");
......
......@@ -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
/**
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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");
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment