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

Fixed a bug (reported by Stefan) that was leading to the creation of external...

Fixed a bug (reported by Stefan) that was leading to the creation of external gravity pair tasks in scheduler_splittasks()
parent 7c2f75fa
...@@ -1379,6 +1379,9 @@ void engine_count_and_link_tasks(struct engine *e) { ...@@ -1379,6 +1379,9 @@ void engine_count_and_link_tasks(struct engine *e) {
engine_addlink(e, &ci->grav, t); engine_addlink(e, &ci->grav, t);
engine_addlink(e, &cj->grav, t); engine_addlink(e, &cj->grav, t);
} }
if (t->subtype == task_subtype_external_grav) {
error("Found a pair/external-gravity task...");
}
/* Link sub-self tasks to cells. */ /* Link sub-self tasks to cells. */
} else if (t->type == task_type_sub_self) { } else if (t->type == task_type_sub_self) {
...@@ -1407,8 +1410,6 @@ void engine_count_and_link_tasks(struct engine *e) { ...@@ -1407,8 +1410,6 @@ void engine_count_and_link_tasks(struct engine *e) {
} }
if (t->subtype == task_subtype_external_grav) { if (t->subtype == task_subtype_external_grav) {
error("Found a sub-pair/external-gravity task..."); error("Found a sub-pair/external-gravity task...");
engine_addlink(e, &ci->grav, t);
engine_addlink(e, &cj->grav, t);
} }
} }
} }
......
...@@ -1279,7 +1279,7 @@ void *runner_main(void *data) { ...@@ -1279,7 +1279,7 @@ void *runner_main(void *data) {
else if (t->subtype == task_subtype_external_grav) else if (t->subtype == task_subtype_external_grav)
runner_do_grav_external(r, ci, 1); runner_do_grav_external(r, ci, 1);
else else
error("Unknown task subtype."); error("Unknown/invalid task subtype (%d).", t->subtype);
break; break;
case task_type_pair: case task_type_pair:
...@@ -1293,10 +1293,8 @@ void *runner_main(void *data) { ...@@ -1293,10 +1293,8 @@ void *runner_main(void *data) {
runner_dopair2_force(r, ci, cj); runner_dopair2_force(r, ci, cj);
else if (t->subtype == task_subtype_grav) else if (t->subtype == task_subtype_grav)
runner_dopair_grav(r, ci, cj, 1); runner_dopair_grav(r, ci, cj, 1);
else if (t->subtype == task_subtype_external_grav)
error("Found a pair/external-gravity task...");
else else
error("Unknown task subtype."); error("Unknown/invalid task subtype (%d).", t->subtype);
break; break;
case task_type_sub_self: case task_type_sub_self:
...@@ -1313,7 +1311,7 @@ void *runner_main(void *data) { ...@@ -1313,7 +1311,7 @@ void *runner_main(void *data) {
else if (t->subtype == task_subtype_external_grav) else if (t->subtype == task_subtype_external_grav)
runner_do_grav_external(r, ci, 1); runner_do_grav_external(r, ci, 1);
else else
error("Unknown task subtype."); error("Unknown/invalid task subtype (%d).", t->subtype);
break; break;
case task_type_sub_pair: case task_type_sub_pair:
...@@ -1327,10 +1325,8 @@ void *runner_main(void *data) { ...@@ -1327,10 +1325,8 @@ void *runner_main(void *data) {
runner_dosub_pair2_force(r, ci, cj, t->flags, 1); runner_dosub_pair2_force(r, ci, cj, t->flags, 1);
else if (t->subtype == task_subtype_grav) else if (t->subtype == task_subtype_grav)
runner_dosub_grav(r, ci, cj, 1); runner_dosub_grav(r, ci, cj, 1);
else if (t->subtype == task_subtype_external_grav)
error("Found a sub-pair/external-gravity task...");
else else
error("Unknown task subtype."); error("Unknown/invalid task subtype (%d).", t->subtype);
break; break;
case task_type_sort: case task_type_sort:
...@@ -1386,7 +1382,7 @@ void *runner_main(void *data) { ...@@ -1386,7 +1382,7 @@ void *runner_main(void *data) {
runner_do_sourceterms(r, t->ci, 1); runner_do_sourceterms(r, t->ci, 1);
break; break;
default: default:
error("Unknown task type."); error("Unknown/invalid task type (%d).", t->type);
} }
/* We're done with this task, see if we get a next one. */ /* We're done with this task, see if we get a next one. */
......
...@@ -183,16 +183,19 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) { ...@@ -183,16 +183,19 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) {
ci->progeny[k], NULL, 0), ci->progeny[k], NULL, 0),
s); s);
/* Make a task for each pair of progeny. */ /* Make a task for each pair of progeny unless it's ext. gravity. */
for (int j = 0; j < 8; j++) if (t->subtype != task_subtype_external_grav) {
if (ci->progeny[j] != NULL)
for (int k = j + 1; k < 8; k++) for (int j = 0; j < 8; j++)
if (ci->progeny[k] != NULL) if (ci->progeny[j] != NULL)
scheduler_splittask( for (int k = j + 1; k < 8; k++)
scheduler_addtask(s, task_type_pair, t->subtype, if (ci->progeny[k] != NULL)
pts[j][k], 0, ci->progeny[j], scheduler_splittask(
ci->progeny[k], 0), scheduler_addtask(s, task_type_pair, t->subtype,
s); pts[j][k], 0, ci->progeny[j],
ci->progeny[k], 0),
s);
}
} }
} }
......
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