diff --git a/src/cell.c b/src/cell.c index 0dbd38a6a73127d2f83fc33e6af761e5a76a30ca..ae79e14009773047e1107d3aa9cfb1b39f9bfd5c 100644 --- a/src/cell.c +++ b/src/cell.c @@ -99,6 +99,7 @@ int cell_unpack(struct pcell *pc, struct cell *c, struct space *s) { c->h_max = pc->h_max; c->ti_end_min = pc->ti_end_min; c->ti_end_max = pc->ti_end_max; + c->ti_old = pc->ti_old; c->count = pc->count; c->gcount = pc->gcount; c->tag = pc->tag; @@ -127,6 +128,7 @@ int cell_unpack(struct pcell *pc, struct cell *c, struct space *s) { temp->dx_max = 0.f; temp->nodeID = c->nodeID; temp->parent = c; + temp->ti_old = c->ti_old; c->progeny[k] = temp; c->split = 1; count += cell_unpack(&pc[pc->progeny[k]], temp, s); @@ -209,6 +211,7 @@ int cell_pack(struct cell *c, struct pcell *pc) { pc->h_max = c->h_max; pc->ti_end_min = c->ti_end_min; pc->ti_end_max = c->ti_end_max; + pc->ti_old = c->ti_old; pc->count = c->count; pc->gcount = c->gcount; c->tag = pc->tag = atomic_inc(&cell_next_tag) % cell_max_tag; @@ -714,7 +717,7 @@ void cell_check_drift_point(struct cell *c, void *data) { const int ti_current = *(int *)data; - if (c->ti_old != ti_current) + if (c->ti_old != ti_current && c->nodeID == engine_rank) error("Cell in an incorrect time-zone! c->ti_old=%d ti_current=%d", c->ti_old, ti_current); } diff --git a/src/cell.h b/src/cell.h index 08dc568c954ec188a268b7d271439e6ebbc1ab8b..3772cfe929a52601f407614f7f94929126f27514 100644 --- a/src/cell.h +++ b/src/cell.h @@ -67,7 +67,7 @@ struct pcell { /* Stats on this cell's particles. */ double h_max; - int ti_end_min, ti_end_max; + int ti_end_min, ti_end_max, ti_old; /* Number of particles in this cell. */ int count, gcount; diff --git a/src/engine.c b/src/engine.c index fb5f24eb45f8de7488d4dafcf75cdb48f5ccfd2b..4aa0ddb1b5c3b887cf23357f54c67005d0cadd21 100644 --- a/src/engine.c +++ b/src/engine.c @@ -143,6 +143,7 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) { c->kick = scheduler_addtask(s, task_type_kick, task_subtype_none, 0, 0, c, NULL, 0); + /* Add the drift task and dependency. */ c->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, 0, 0, c, NULL, 0); @@ -673,6 +674,11 @@ void engine_addtasks_send(struct engine *e, struct cell *ci, struct cell *cj, /* Create the tasks and their dependencies? */ if (t_xv == NULL) { + + if(ci->super->drift == NULL) + ci->super->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, 0, 0, + ci->super, NULL, 0); + t_xv = scheduler_addtask(s, task_type_send, task_subtype_none, 4 * ci->tag, 0, ci, cj, 0); t_rho = scheduler_addtask(s, task_type_send, task_subtype_none, @@ -708,6 +714,8 @@ void engine_addtasks_send(struct engine *e, struct cell *ci, struct cell *cj, /* The send_xv task should unlock the super-cell's ghost task. */ scheduler_addunlock(s, t_xv, ci->super->ghost); + + scheduler_addunlock(s, ci->super->drift, t_xv); #endif /* The super-cell's kick task should unlock the send_ti task. */ diff --git a/src/runner.c b/src/runner.c index 24003d960729814ceeb9b5e67ecd7c765d4215b9..52f91d620ad483ddae366d36e1129efe1f91df9f 100644 --- a/src/runner.c +++ b/src/runner.c @@ -958,7 +958,7 @@ void runner_do_recv_cell(struct runner *r, struct cell *c, int timer) { const struct gpart *restrict gparts = c->gparts; const size_t nr_parts = c->count; const size_t nr_gparts = c->gcount; - // const int ti_current = r->e->ti_current; + const int ti_current = r->e->ti_current; TIMER_TIC; @@ -1001,6 +1001,7 @@ void runner_do_recv_cell(struct runner *r, struct cell *c, int timer) { /* ... and store. */ c->ti_end_min = ti_end_min; c->ti_end_max = ti_end_max; + c->ti_old = ti_current; c->h_max = h_max; if (timer) TIMER_TOC(timer_dorecv_cell); @@ -1051,8 +1052,9 @@ void *runner_main(void *data) { /* Check that we haven't scheduled an inactive task */ #ifdef SWIFT_DEBUG_CHECKS +#ifndef WITH_MPI if (cj == NULL) { /* self */ - if (!cell_is_active(ci, e) && t->type != task_type_sort) + if (!cell_is_active(ci, e) && t->type != task_type_sort && t->type != task_type_send && t->type != task_type_recv) error( "Task (type='%s/%s') should have been skipped ti_current=%d " "c->ti_end_min=%d", @@ -1070,12 +1072,15 @@ void *runner_main(void *data) { } else { /* pair */ if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) + + if(t->type != task_type_send && t->type != task_type_recv) error( "Task (type='%s/%s') should have been skipped ti_current=%d " "ci->ti_end_min=%d cj->ti_end_min=%d", taskID_names[t->type], subtaskID_names[t->subtype], e->ti_current, ci->ti_end_min, cj->ti_end_min); } +#endif #endif /* Different types of tasks... */