From 3f0c1c31971a4051da9b690b8603a2250e944e3f Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" Date: Mon, 3 Jul 2017 18:11:18 +0100 Subject: [PATCH 1/2] repartitioning: make the trigger correctly with a value of 2, previously the minimum no. of steps was in fact 3 Also match sanity checks to same as documented allowed values for trigger --- src/engine.c | 7 ++++--- src/partition.c | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/engine.c b/src/engine.c index 827778100..e82930d9d 100644 --- a/src/engine.c +++ b/src/engine.c @@ -891,13 +891,14 @@ void engine_repartition_trigger(struct engine *e) { /* Do nothing if there have not been enough steps since the last * repartition, don't want to repeat this too often or immediately after * a repartition step. */ - if (e->step - e->last_repartition > 2) { + if (e->step - e->last_repartition >= 2) { /* Old style if trigger is >1 or this is the second step (want an early * repartition following the initial repartition). */ if (e->reparttype->trigger > 1 || e->step == 2) { if (e->reparttype->trigger > 1) { - if (e->step % (int)e->reparttype->trigger == 2) e->forcerepart = 1; + if ((e->step % (int)e->reparttype->trigger) == 0) + e->forcerepart = 1; } else { e->forcerepart = 1; } @@ -4064,7 +4065,7 @@ void engine_init(struct engine *e, struct space *s, e->parameter_file = params; #ifdef WITH_MPI e->cputime_last_step = 0; - e->last_repartition = -1; + e->last_repartition = 0; #endif engine_rank = nodeID; diff --git a/src/partition.c b/src/partition.c index e0d7b289a..1588aa248 100644 --- a/src/partition.c +++ b/src/partition.c @@ -1070,6 +1070,9 @@ void partition_init(struct partition *partition, parser_get_opt_param_float(params, "DomainDecomposition:trigger", 0.05f); if (repartition->trigger <= 0) error("Invalid DomainDecomposition:trigger, must be greater than zero"); + if (repartition->trigger < 2 && repartition->trigger >= 1) + error("Invalid DomainDecomposition:trigger, must be 2 or greater or less" + " than 1"); /* Fraction of particles that should be updated before a repartition * based on CPU time is considered. */ -- GitLab From 3bedd6540373315c07df6410f06273fa9c83a7ee Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" Date: Mon, 3 Jul 2017 18:13:46 +0100 Subject: [PATCH 2/2] formatting --- examples/main.c | 2 +- src/partition.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/main.c b/examples/main.c index 25eaf92a3..bf7b43f04 100644 --- a/examples/main.c +++ b/examples/main.c @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) { error("Call to MPI_Comm_set_errhandler failed with error %i.", res); if (myrank == 0) printf("[0000] [00000.0] main: MPI is up and running with %i node(s).\n\n", - nr_nodes); + nr_nodes); if (nr_nodes == 1) { message("WARNING: you are running with one MPI rank."); message("WARNING: you should use the non-MPI version of this program."); diff --git a/src/partition.c b/src/partition.c index 1588aa248..f30e5d0ad 100644 --- a/src/partition.c +++ b/src/partition.c @@ -1071,8 +1071,9 @@ void partition_init(struct partition *partition, if (repartition->trigger <= 0) error("Invalid DomainDecomposition:trigger, must be greater than zero"); if (repartition->trigger < 2 && repartition->trigger >= 1) - error("Invalid DomainDecomposition:trigger, must be 2 or greater or less" - " than 1"); + error( + "Invalid DomainDecomposition:trigger, must be 2 or greater or less" + " than 1"); /* Fraction of particles that should be updated before a repartition * based on CPU time is considered. */ -- GitLab