From 30fb1f555c854b3ab4e050abc4de569a8710a3d4 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Fri, 26 Oct 2018 17:24:38 +0200 Subject: [PATCH] When drifting all, only consider the cells that have tasks. --- src/cell.c | 6 +++--- src/engine.c | 16 ++++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/cell.c b/src/cell.c index 60e2e9393f..fd58f900a6 100644 --- a/src/cell.c +++ b/src/cell.c @@ -1309,12 +1309,12 @@ void cell_check_multipole_drift_point(struct cell *c, void *data) { const integertime_t ti_drift = *(integertime_t *)data; - if (c->grav.ti_old_multipole != ti_drift) + if (c->grav.ti_old_multipole != ti_drift && c->nodeID == engine_rank) error( "Cell multipole in an incorrect time-zone! " "c->grav.ti_old_multipole=%lld " - "ti_drift=%lld (depth=%d)", - c->grav.ti_old_multipole, ti_drift, c->depth); + "ti_drift=%lld (depth=%d, node=%d)", + c->grav.ti_old_multipole, ti_drift, c->depth, c->nodeID); #else error("Calling debugging code without debugging flag activated."); diff --git a/src/engine.c b/src/engine.c index 6d32ce4362..ab2adfa027 100644 --- a/src/engine.c +++ b/src/engine.c @@ -5869,12 +5869,15 @@ void engine_unskip(struct engine *e) { void engine_do_drift_all_mapper(void *map_data, int num_elements, void *extra_data) { - struct engine *e = (struct engine *)extra_data; - struct cell *cells = (struct cell *)map_data; + const struct engine *e = (const struct engine *)extra_data; + struct space *s = e->s; + int *local_cells = (int *)map_data; for (int ind = 0; ind < num_elements; ind++) { - struct cell *c = &cells[ind]; - if (c != NULL && c->nodeID == e->nodeID) { + struct cell *c = &s->cells_top[local_cells[ind]]; + + if (c->nodeID == e->nodeID) { + /* Drift all the particles */ cell_drift_part(c, e, 1); @@ -5910,8 +5913,9 @@ void engine_drift_all(struct engine *e) { } #endif - threadpool_map(&e->threadpool, engine_do_drift_all_mapper, e->s->cells_top, - e->s->nr_cells, sizeof(struct cell), 0, e); + threadpool_map(&e->threadpool, engine_do_drift_all_mapper, + e->s->local_cells_with_tasks_top, + e->s->nr_local_cells_with_tasks, sizeof(int), 0, e); /* Synchronize particle positions */ space_synchronize_particle_positions(e->s); -- GitLab