Skip to content
Snippets Groups Projects
Commit 01f51f70 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Post-merge fixes

parent 24e3b63a
No related branches found
No related tags found
2 merge requests!212Gravity infrastructure,!172[WIP] Self gravity (Barnes-Hut version)
......@@ -1265,6 +1265,23 @@ void engine_count_and_link_tasks(struct engine *e) {
}
}
/**
* @brief Creates the dependency network for the gravity tasks of a given cell.
*
* @param sched The #scheduler.
* @param gravity The gravity task to link.
* @param c The cell.
*/
static inline void engine_make_gravity_dependencies(struct scheduler *sched,
struct task *gravity,
struct cell *c) {
/* init --> gravity --> kick */
/* grav_up --> gravity ( --> kick) */
scheduler_addunlock(sched, c->super->init, gravity);
scheduler_addunlock(sched, c->super->grav_up, gravity);
scheduler_addunlock(sched, gravity, c->super->kick);
}
/**
* @brief Creates all the task dependencies for the gravity
......@@ -1285,6 +1302,8 @@ void engine_link_gravity_tasks(struct engine *e) {
struct task *fft = scheduler_addtask(sched, task_type_grav_fft,
task_subtype_none, 0, 0, NULL, NULL, 0);
scheduler_addunlock(sched, gather, fft);
for (int k = 0; k < nr_tasks; k++) {
/* Get a pointer to the task. */
......@@ -1296,7 +1315,6 @@ void engine_link_gravity_tasks(struct engine *e) {
/* Multipole construction */
if (t->type == task_type_grav_up) {
scheduler_addunlock(sched, t, gather);
scheduler_addunlock(sched, t, fft);
}
/* Long-range interaction */
......@@ -1332,15 +1350,22 @@ void engine_link_gravity_tasks(struct engine *e) {
}
/* Otherwise, sub interaction? */
else if (t->type == task_type_sub && t->subtype == task_subtype_grav) {
/* Otherwise, sub-self interaction? */
else if (t->type == task_type_sub_self && t->subtype == task_subtype_grav) {
if (t->ci->nodeID == nodeID) {
engine_make_gravity_dependencies(sched, t, t->ci);
}
}
/* Otherwise, sub-pair interaction? */
else if (t->type == task_type_sub_pair && t->subtype == task_subtype_grav) {
if (t->ci->nodeID == nodeID) {
engine_make_gravity_dependencies(sched, t, t->ci);
}
if (t->cj != NULL && t->cj->nodeID == nodeID &&
t->ci->super != t->cj->super) {
if (t->cj->nodeID == nodeID && t->ci->super != t->cj->super) {
engine_make_gravity_dependencies(sched, t, t->cj);
}
......
......@@ -504,8 +504,7 @@ static void repart_edge_metis(int partweights, int bothweights, int nodeID,
}
/* 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)) {
/* In-cell pair? */
if (ci == cj) {
/* Add weight to vertex for ci. */
......
......@@ -1087,6 +1087,8 @@ void *runner_main(void *data) {
runner_dosub_self1_density(r, ci, 1);
else if (t->subtype == task_subtype_force)
runner_dosub_self2_force(r, ci, 1);
else if (t->subtype == task_subtype_grav)
runner_dosub_grav(r, ci, cj, 1);
else
error("Unknown task subtype.");
break;
......@@ -1095,6 +1097,8 @@ void *runner_main(void *data) {
runner_dosub_pair1_density(r, ci, cj, t->flags, 1);
else if (t->subtype == task_subtype_force)
runner_dosub_pair2_force(r, ci, cj, t->flags, 1);
else if (t->subtype == task_subtype_grav)
runner_dosub_grav(r, ci, cj, 1);
else
error("Unknown task subtype.");
break;
......
......@@ -142,7 +142,6 @@ void task_unlock(struct task *t) {
}
break;
case task_type_grav_mm:
cell_gunlocktree(ci);
break;
......@@ -218,6 +217,10 @@ int task_lock(struct task *t) {
}
break;
case task_type_grav_mm:
cell_glocktree(ci);
break;
default:
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment