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

Make use of METIS an option when ParMETIS is configured

Make reports a little less specific
parent 0aa63048
No related branches found
No related tags found
1 merge request!506Add ParMETIS support
...@@ -492,12 +492,20 @@ int main(int argc, char *argv[]) { ...@@ -492,12 +492,20 @@ int main(int argc, char *argv[]) {
/* Let's report what we did */ /* Let's report what we did */
if (myrank == 0) { if (myrank == 0) {
message("Using initial partition %s", #if defined(HAVE_PARMETIS)
if (reparttype.usemetis)
message("Using METIS serial partitioning:");
else
message("Using ParMETIS partitioning:");
#else
message("Using METIS serial partitioning:");
#endif
message(" initial partitioning: %s",
initial_partition_name[initial_partition.type]); initial_partition_name[initial_partition.type]);
if (initial_partition.type == INITPART_GRID) if (initial_partition.type == INITPART_GRID)
message("grid set to [ %i %i %i ].", initial_partition.grid[0], message(" grid set to [ %i %i %i ].", initial_partition.grid[0],
initial_partition.grid[1], initial_partition.grid[2]); initial_partition.grid[1], initial_partition.grid[2]);
message("Using %s repartitioning", repartition_name[reparttype.type]); message(" repartitioning: %s", repartition_name[reparttype.type]);
} }
#endif #endif
......
...@@ -125,7 +125,9 @@ DomainDecomposition: ...@@ -125,7 +125,9 @@ DomainDecomposition:
# new decomposition, or number of steps (>1) between decompositions # new decomposition, or number of steps (>1) between decompositions
minfrac: 0.9 # (Optional) Fractional of all particles that should be updated in previous step when minfrac: 0.9 # (Optional) Fractional of all particles that should be updated in previous step when
# using CPU time trigger # using CPU time trigger
itr 0.1 # Ratio of inter node communication time to data redistribution time, in the range 0.00001 to 10000000.0. usemetis 0 # Use serial METIS when ParMETIS is also available.
adaptive 1 # Use adaptive repartition when ParMETIS is available, otherwise simple refinement.
itr 100 # When adaptive defines the ratio of inter node communication time to data redistribution time, in the range 0.00001 to 10000000.0.
# Lower values give less data movement during redistributions, at the cost of global balance which may require more communication. # Lower values give less data movement during redistributions, at the cost of global balance which may require more communication.
# Parameters related to the equation of state ------------------------------------------ # Parameters related to the equation of state ------------------------------------------
......
...@@ -60,17 +60,18 @@ ...@@ -60,17 +60,18 @@
/* Simple descriptions of initial partition types for reports. */ /* Simple descriptions of initial partition types for reports. */
const char *initial_partition_name[] = { const char *initial_partition_name[] = {
"axis aligned grids of cells", "vectorized point associated cells", "axis aligned grids of cells",
"memory balanced, using METIS particle weighted cells", "vectorized point associated cells",
"similar sized regions, using METIS unweighted cells"}; "memory balanced, using particle weighted cells",
"similar sized regions, using unweighted cells"};
/* Simple descriptions of repartition types for reports. */ /* Simple descriptions of repartition types for reports. */
const char *repartition_name[] = { const char *repartition_name[] = {
"no", "none",
"METIS edge and vertex task cost weights", "edge and vertex task cost weights",
"METIS task cost edge weights", "task cost edge weights",
"METIS task cost vertex weights", "task cost vertex weights",
"METIS vertex task costs and edge delta timebin weights" "vertex task costs and edge delta timebin weights"
}; };
/* Local functions, if needed. */ /* Local functions, if needed. */
...@@ -871,7 +872,7 @@ static void pick_parmetis(int nodeID, struct space *s, int nregions, ...@@ -871,7 +872,7 @@ static void pick_parmetis(int nodeID, struct space *s, int nregions,
} }
#endif #endif
#if defined(WITH_MPI) && defined(HAVE_METIS) && !defined(HAVE_PARMETIS) #if defined(WITH_MPI) && defined(HAVE_METIS)
/** /**
* @brief Partition the given space into a number of connected regions. * @brief Partition the given space into a number of connected regions.
* *
...@@ -1246,9 +1247,13 @@ static void repart_edge_metis(int vweights, int eweights, int timebins, ...@@ -1246,9 +1247,13 @@ static void repart_edge_metis(int vweights, int eweights, int timebins,
/* And repartition/ partition, using both weights or not as requested. */ /* And repartition/ partition, using both weights or not as requested. */
#ifdef HAVE_PARMETIS #ifdef HAVE_PARMETIS
pick_parmetis(nodeID, s, nr_nodes, weights_v, weights_e, refine, if (repartition->usemetis) {
repartition->adaptive, repartition->itr, pick_metis(nodeID, s, nr_nodes, weights_v, weights_e, repartition->celllist);
repartition->celllist); } else {
pick_parmetis(nodeID, s, nr_nodes, weights_v, weights_e, refine,
repartition->adaptive, repartition->itr,
repartition->celllist);
}
#else #else
pick_metis(nodeID, s, nr_nodes, weights_v, weights_e, repartition->celllist); pick_metis(nodeID, s, nr_nodes, weights_v, weights_e, repartition->celllist);
#endif #endif
...@@ -1423,7 +1428,11 @@ void partition_initial_partition(struct partition *initial_partition, ...@@ -1423,7 +1428,11 @@ void partition_initial_partition(struct partition *initial_partition,
if ((celllist = (int *)malloc(sizeof(int) * s->nr_cells)) == NULL) if ((celllist = (int *)malloc(sizeof(int) * s->nr_cells)) == NULL)
error("Failed to allocate celllist"); error("Failed to allocate celllist");
#ifdef HAVE_PARMETIS #ifdef HAVE_PARMETIS
if (initial_partition->usemetis) {
pick_metis(nodeID, s, nr_nodes, weights, NULL, celllist);
} else {
pick_parmetis(nodeID, s, nr_nodes, weights, NULL, 0, 0, 0.0f, celllist); pick_parmetis(nodeID, s, nr_nodes, weights, NULL, 0, 0, 0.0f, celllist);
}
#else #else
pick_metis(nodeID, s, nr_nodes, weights, NULL, celllist); pick_metis(nodeID, s, nr_nodes, weights, NULL, celllist);
#endif #endif
...@@ -1595,13 +1604,18 @@ void partition_init(struct partition *partition, ...@@ -1595,13 +1604,18 @@ void partition_init(struct partition *partition,
"Invalid DomainDecomposition:minfrac, must be greater than 0 and less " "Invalid DomainDecomposition:minfrac, must be greater than 0 and less "
"than equal to 1"); "than equal to 1");
/* Use METIS or ParMETIS when ParMETIS is also available. */
repartition->usemetis =
parser_get_opt_param_int(params, "DomainDecomposition:usemetis", 0);
partition->usemetis = repartition->usemetis;
/* Use adaptive or simple refinement when repartitioning. */ /* Use adaptive or simple refinement when repartitioning. */
repartition->adaptive = repartition->adaptive =
parser_get_opt_param_int(params, "DomainDecomposition:adaptive", 1 ); parser_get_opt_param_int(params, "DomainDecomposition:adaptive", 1);
/* Ratio of interprocess communication time to data redistribution time. */ /* Ratio of interprocess communication time to data redistribution time. */
repartition->itr = repartition->itr =
parser_get_opt_param_float(params, "DomainDecomposition:itr", 0.1f); parser_get_opt_param_float(params, "DomainDecomposition:itr", 100.0f);
/* Clear the celllist for use. */ /* Clear the celllist for use. */
repartition->ncelllist = 0; repartition->ncelllist = 0;
......
...@@ -38,6 +38,7 @@ extern const char *initial_partition_name[]; ...@@ -38,6 +38,7 @@ extern const char *initial_partition_name[];
struct partition { struct partition {
enum partition_type type; enum partition_type type;
int grid[3]; int grid[3];
int usemetis;
}; };
/* Repartition type to use. */ /* Repartition type to use. */
...@@ -55,6 +56,7 @@ struct repartition { ...@@ -55,6 +56,7 @@ struct repartition {
float trigger; float trigger;
float minfrac; float minfrac;
float itr; float itr;
int usemetis;
int adaptive; int adaptive;
/* The partition as a cell-list. */ /* The partition as a cell-list. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment