Commit 7c2c2cc0 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Drift task now scheduled correctly

parent 456d9fad
...@@ -879,15 +879,9 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { ...@@ -879,15 +879,9 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
} }
/* Activate the drift on both sides */ /* Activate the drift on both sides */
if (t->type == task_type_pair || t->type == task_type_sub_pair) { if (ci == c && cj != NULL) scheduler_activate(s, cj->drift);
if (ci->drift != NULL) scheduler_activate(s, ci->drift); if (cj == c && ci != NULL) scheduler_activate(s, ci->drift);
if (cj->drift != NULL) scheduler_activate(s, cj->drift);
}
if (t->type == task_type_self || t->type == task_type_sub_self) {
if (ci->drift != NULL) scheduler_activate(s, ci->drift);
}
/* Check whether there was too much particle motion */ /* Check whether there was too much particle motion */
if (t->type == task_type_pair || t->type == task_type_sub_pair) { if (t->type == task_type_pair || t->type == task_type_sub_pair) {
if (t->tight && if (t->tight &&
......
...@@ -139,9 +139,6 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) { ...@@ -139,9 +139,6 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) {
c->init = scheduler_addtask(s, task_type_init, task_subtype_none, 0, 0, c, c->init = scheduler_addtask(s, task_type_init, task_subtype_none, 0, 0, c,
NULL, 0); NULL, 0);
/* c->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, 0, 0, */
/* c, NULL, 0); */
c->kick = scheduler_addtask(s, task_type_kick, task_subtype_none, 0, 0, c, c->kick = scheduler_addtask(s, task_type_kick, task_subtype_none, 0, 0, c,
NULL, 0); NULL, 0);
...@@ -1993,9 +1990,9 @@ void engine_marktasks_mapper(void *map_data, int num_elements, ...@@ -1993,9 +1990,9 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
const struct cell *ci = t->ci; const struct cell *ci = t->ci;
/* Activate the drift */ /* Activate the drift */
if(ci->drift) scheduler_activate(s, ci->drift); if (ci->drift) scheduler_activate(s, ci->drift);
} }
/* Pair? */ /* Pair? */
else if (t->type == task_type_pair || t->type == task_type_sub_pair) { else if (t->type == task_type_pair || t->type == task_type_sub_pair) {
...@@ -2004,8 +2001,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements, ...@@ -2004,8 +2001,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
const struct cell *cj = t->cj; const struct cell *cj = t->cj;
/* Activate the drift on both sides */ /* Activate the drift on both sides */
if(ci->drift) scheduler_activate(s, ci->drift); if (ci->drift) scheduler_activate(s, ci->drift);
if(cj->drift) scheduler_activate(s, cj->drift); if (cj->drift) scheduler_activate(s, cj->drift);
/* Too much particle movement? */ /* Too much particle movement? */
if (t->tight && if (t->tight &&
......
...@@ -1127,7 +1127,8 @@ void *runner_main(void *data) { ...@@ -1127,7 +1127,8 @@ void *runner_main(void *data) {
/* Check that we haven't scheduled an inactive task */ /* Check that we haven't scheduled an inactive task */
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (cj == NULL) { /* self */ if (cj == NULL) { /* self */
if (!cell_is_active(ci, e) && t->type != task_type_sort && t->type != task_type_drift) if (!cell_is_active(ci, e) && t->type != task_type_sort &&
t->type != task_type_drift)
error( error(
"Task (type='%s/%s') should have been skipped ti_current=%d " "Task (type='%s/%s') should have been skipped ti_current=%d "
"c->ti_end_min=%d", "c->ti_end_min=%d",
...@@ -1143,10 +1144,11 @@ void *runner_main(void *data) { ...@@ -1143,10 +1144,11 @@ void *runner_main(void *data) {
taskID_names[t->type], subtaskID_names[t->subtype], e->ti_current, taskID_names[t->type], subtaskID_names[t->subtype], e->ti_current,
ci->ti_end_min, t->flags); ci->ti_end_min, t->flags);
/* Special treatement for drifts */ /* Special treatement for drifts */
if (!cell_is_active(ci, e) && t->type == task_type_drift) if (!cell_is_active(ci, e) && t->type == task_type_drift) {
{;} ;
}
} else { /* pair */ } else { /* pair */
if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) if (!cell_is_active(ci, e) && !cell_is_active(cj, e))
error( error(
...@@ -1237,7 +1239,7 @@ void *runner_main(void *data) { ...@@ -1237,7 +1239,7 @@ void *runner_main(void *data) {
break; break;
#endif #endif
case task_type_drift: case task_type_drift:
// runner_do_drift(r, ci, 1); runner_do_drift(r, ci, 1);
break; break;
case task_type_kick: case task_type_kick:
runner_do_kick(r, ci, 1); runner_do_kick(r, ci, 1);
......
...@@ -133,7 +133,7 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) { ...@@ -133,7 +133,7 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) {
/* Non-splittable task? */ /* Non-splittable task? */
if ((t->ci == NULL || (t->type == task_type_pair && t->cj == NULL)) || if ((t->ci == NULL || (t->type == task_type_pair && t->cj == NULL)) ||
((t->type == task_type_kick) && t->ci->nodeID != s->nodeID) || ((t->type == task_type_kick) && t->ci->nodeID != s->nodeID) ||
((t->type == task_type_drift) && t->ci->nodeID != s->nodeID) || ((t->type == task_type_drift) && t->ci->nodeID != s->nodeID) ||
((t->type == task_type_init) && t->ci->nodeID != s->nodeID)) { ((t->type == task_type_init) && t->ci->nodeID != s->nodeID)) {
t->type = task_type_none; t->type = task_type_none;
t->skip = 1; t->skip = 1;
...@@ -614,19 +614,17 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) { ...@@ -614,19 +614,17 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) {
1 << sid, 0, ci, NULL, 0); 1 << sid, 0, ci, NULL, 0);
else else
ci->sorts->flags |= (1 << sid); ci->sorts->flags |= (1 << sid);
scheduler_addunlock(s, ci->sorts, t);
/* Create the drift for ci. */ scheduler_addunlock(s, ci->sorts, t);
if (ci->drift == NULL) {
ci->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, /* Create the drift for ci. */
if (ci->drift == NULL) {
ci->drift = scheduler_addtask(s, task_type_drift, task_subtype_none,
0, 0, ci, NULL, 0); 0, 0, ci, NULL, 0);
scheduler_addunlock(s, ci->drift, ci->sorts); scheduler_addunlock(s, ci->drift, ci->sorts);
} }
lock_unlock_blind(&ci->lock); lock_unlock_blind(&ci->lock);
/* Create the sort for cj. */ /* Create the sort for cj. */
lock_lock(&cj->lock); lock_lock(&cj->lock);
if (cj->sorts == NULL) if (cj->sorts == NULL)
...@@ -637,13 +635,13 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) { ...@@ -637,13 +635,13 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) {
scheduler_addunlock(s, cj->sorts, t); scheduler_addunlock(s, cj->sorts, t);
/* Create the drift for cj. */ /* Create the drift for cj. */
if (cj->drift == NULL) { if (cj->drift == NULL) {
cj->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, cj->drift = scheduler_addtask(s, task_type_drift, task_subtype_none,
0, 0, cj, NULL, 0); 0, 0, cj, NULL, 0);
scheduler_addunlock(s, cj->drift, cj->sorts); scheduler_addunlock(s, cj->drift, cj->sorts);
} }
lock_unlock_blind(&cj->lock); lock_unlock_blind(&cj->lock);
} }
} /* pair interaction? */ } /* pair interaction? */
...@@ -802,8 +800,9 @@ void scheduler_set_unlocks(struct scheduler *s) { ...@@ -802,8 +800,9 @@ void scheduler_set_unlocks(struct scheduler *s) {
for (int j = i + 1; j < t->nr_unlock_tasks; j++) { for (int j = i + 1; j < t->nr_unlock_tasks; j++) {
if (t->unlock_tasks[i] == t->unlock_tasks[j]) if (t->unlock_tasks[i] == t->unlock_tasks[j])
error("duplicate unlock! t->type=%s/%s unlocking type=%s/%s", error("duplicate unlock! t->type=%s/%s unlocking type=%s/%s",
taskID_names[t->type], subtaskID_names[t->subtype], taskID_names[t->type], subtaskID_names[t->subtype],
taskID_names[t->unlock_tasks[i]->type], subtaskID_names[t->unlock_tasks[i]->subtype]); taskID_names[t->unlock_tasks[i]->type],
subtaskID_names[t->unlock_tasks[i]->subtype]);
} }
} }
} }
...@@ -1102,10 +1101,11 @@ void scheduler_start(struct scheduler *s) { ...@@ -1102,10 +1101,11 @@ void scheduler_start(struct scheduler *s) {
taskID_names[t->type], subtaskID_names[t->subtype], ti_current, taskID_names[t->type], subtaskID_names[t->subtype], ti_current,
ci->ti_end_min, t->flags); ci->ti_end_min, t->flags);
/* Special treatement for drifts */ /* Special treatement for drifts */
if (ci->ti_end_min == ti_current && t->skip && if (ci->ti_end_min == ti_current && t->skip &&
t->type == task_type_drift) t->type == task_type_drift) {
{;} ;
}
} else { /* pair */ } else { /* pair */
...@@ -1174,7 +1174,7 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) { ...@@ -1174,7 +1174,7 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
case task_type_sort: case task_type_sort:
case task_type_ghost: case task_type_ghost:
case task_type_kick: case task_type_kick:
case task_type_drift: case task_type_drift:
case task_type_init: case task_type_init:
qid = t->ci->super->owner; qid = t->ci->super->owner;
break; break;
......
...@@ -409,6 +409,7 @@ void space_regrid(struct space *s, int verbose) { ...@@ -409,6 +409,7 @@ void space_regrid(struct space *s, int verbose) {
s->cells_top[k].extra_ghost = NULL; s->cells_top[k].extra_ghost = NULL;
s->cells_top[k].ghost = NULL; s->cells_top[k].ghost = NULL;
s->cells_top[k].kick = NULL; s->cells_top[k].kick = NULL;
s->cells_top[k].drift = NULL;
s->cells_top[k].cooling = NULL; s->cells_top[k].cooling = NULL;
s->cells_top[k].sourceterms = NULL; s->cells_top[k].sourceterms = NULL;
s->cells_top[k].super = &s->cells_top[k]; s->cells_top[k].super = &s->cells_top[k];
......
...@@ -48,10 +48,10 @@ ...@@ -48,10 +48,10 @@
/* Task type names. */ /* Task type names. */
const char *taskID_names[task_type_count] = { const char *taskID_names[task_type_count] = {
"none", "sort", "self", "pair", "sub_self", "none", "sort", "self", "pair", "sub_self",
"sub_pair", "init", "ghost", "extra_ghost", "drift", "kick", "sub_pair", "init", "ghost", "extra_ghost", "drift",
"send", "recv", "grav_gather_m", "grav_fft", "grav_mm", "kick", "send", "recv", "grav_gather_m", "grav_fft",
"grav_up", "cooling", "sourceterms"}; "grav_mm", "grav_up", "cooling", "sourceterms"};
const char *subtaskID_names[task_subtype_count] = { const char *subtaskID_names[task_subtype_count] = {
"none", "density", "gradient", "force", "grav", "external_grav", "tend"}; "none", "density", "gradient", "force", "grav", "external_grav", "tend"};
......
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