From 43d8be2da6eda1bffeca001d450868d75b692fda Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" <p.w.draper@durham.ac.uk> Date: Mon, 23 Jan 2017 15:42:49 +0000 Subject: [PATCH] After repartitioning don't check if all cells have been drifted Post repartition we can have cells if a bad state if they have previously been inactive on a rank (so they hold particles, but the cell data do not match) --- src/engine.c | 17 ++++++++++------- src/engine.h | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/engine.c b/src/engine.c index 98b4eb9b34..db8aef0176 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2291,15 +2291,16 @@ void engine_rebuild(struct engine *e) { * @param drift_all Whether to drift particles before rebuilding or not. Will * not be necessary if all particles have already been * drifted (before repartitioning for instance). - * @param deferskip Whether to defer the skip until after the rebuild. - * Needed after a repartition. + * @param postrepart If we have just repartitioned, if so we need to defer the + * skip until after the rebuild and not check the if all + * cells have been drifted. */ -void engine_prepare(struct engine *e, int drift_all, int deferskip) { +void engine_prepare(struct engine *e, int drift_all, int postrepart) { TIMER_TIC; /* Unskip active tasks and check for rebuild */ - if (!deferskip) engine_unskip(e); + if (!postrepart) engine_unskip(e); /* Run through the tasks and mark as skip or not. */ int rebuild = e->forcerebuild; @@ -2320,13 +2321,15 @@ void engine_prepare(struct engine *e, int drift_all, int deferskip) { if (drift_all) engine_drift_all(e); #ifdef SWIFT_DEBUG_CHECKS - /* Check that all cells have been drifted to the current time */ - space_check_drift_point(e->s, e->ti_current); + /* Check that all cells have been drifted to the current time, unless + * we have just repartitioned, that can include cells that have not + * previously been active on this rank. */ + if (!postrepart) space_check_drift_point(e->s, e->ti_current); #endif engine_rebuild(e); } - if (deferskip) engine_unskip(e); + if (postrepart) engine_unskip(e); /* Re-rank the tasks every now and then. */ if (e->tasks_age % engine_tasksreweight == 1) { diff --git a/src/engine.h b/src/engine.h index 72d54f6d26..db5a7317d2 100644 --- a/src/engine.h +++ b/src/engine.h @@ -225,7 +225,7 @@ void engine_init(struct engine *e, struct space *s, const struct cooling_function_data *cooling, struct sourceterms *sourceterms); void engine_launch(struct engine *e, int nr_runners); -void engine_prepare(struct engine *e, int drift_all, int deferskip); +void engine_prepare(struct engine *e, int drift_all, int postrepart); void engine_print(struct engine *e); void engine_init_particles(struct engine *e, int flag_entropy_ICs); void engine_step(struct engine *e); -- GitLab