Commit ab72a00c authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Add drift-->send dependency and update ti_old on reception

parent 24555216
......@@ -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);
}
......
......@@ -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;
......
......@@ -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. */
......
......@@ -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... */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment