From 9b7722011a27d7b682ad69e6f449a41dcba49702 Mon Sep 17 00:00:00 2001 From: Alexei Borissov <dc-bori1@cosma-b.pri.cosma7.alces.network> Date: Wed, 12 Dec 2018 14:05:56 +0000 Subject: [PATCH 01/13] Added star feedback tasks --- src/cell.h | 3 ++ src/engine_maketasks.c | 88 ++++++++++++++++++++++++++++++++-- src/runner.c | 8 ++++ src/stars/Default/stars_iact.h | 5 +- src/task.c | 2 +- src/task.h | 1 + 6 files changed, 101 insertions(+), 6 deletions(-) diff --git a/src/cell.h b/src/cell.h index 97ca22e584..66dbdd37d1 100644 --- a/src/cell.h +++ b/src/cell.h @@ -504,6 +504,9 @@ struct cell { /*! Linked list of the tasks computing this cell's star density. */ struct link *density; + + // ALEXEI: DOES THIS NEED TO BE HERE? + struct link *feedback; /*! Number of #spart updated in this cell. */ int updated; diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index 68841aa599..4a6344d102 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -1022,6 +1022,8 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements, engine_addlink(e, &ci->grav.grav, t); } else if (t->subtype == task_subtype_stars_density) { engine_addlink(e, &ci->stars.density, t); + } else if (t->subtype == task_subtype_stars_feedback) { + engine_addlink(e, &ci->stars.feedback, t); } /* Link pair tasks to cells. */ @@ -1038,6 +1040,9 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements, } else if (t->subtype == task_subtype_stars_density) { engine_addlink(e, &ci->stars.density, t); engine_addlink(e, &cj->stars.density, t); + } else if (t->subtype == task_subtype_stars_feedback) { + engine_addlink(e, &ci->stars.feedback, t); + engine_addlink(e, &cj->stars.feedback, t); } #ifdef SWIFT_DEBUG_CHECKS else if (t_subtype == task_subtype_external_grav) { @@ -1057,6 +1062,8 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements, engine_addlink(e, &ci->grav.grav, t); } else if (t->subtype == task_subtype_stars_density) { engine_addlink(e, &ci->stars.density, t); + } else if (t->subtype == task_subtype_stars_feedback) { + engine_addlink(e, &ci->stars.feedback, t); } /* Link sub-pair tasks to cells. */ @@ -1073,6 +1080,9 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements, } else if (t->subtype == task_subtype_stars_density) { engine_addlink(e, &ci->stars.density, t); engine_addlink(e, &cj->stars.density, t); + } else if (t->subtype == task_subtype_stars_feedback) { + engine_addlink(e, &ci->stars.feedback, t); + engine_addlink(e, &cj->stars.feedback, t); } #ifdef SWIFT_DEBUG_CHECKS else if (t_subtype == task_subtype_external_grav) { @@ -1601,9 +1611,16 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, /* Now, build all the dependencies for the stars */ engine_make_stars_loops_dependencies(sched, t, t->ci); - if (t->ci == t->ci->super) - scheduler_addunlock(sched, t->ci->super->stars.ghost_out, - t->ci->super->end_force); + } + if (t->type == task_type_self && t->subtype == task_subtype_stars_feedback) { + + /* Make the self-feedback tasks depend on the stars ghost task. */ + scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); + + /* Make end_force depend on feedback */ + if (t->ci == t->ci->super) { + scheduler_addunlock(sched, t, t->ci->super->end_force); + } } /* Otherwise, pair interaction? */ @@ -1640,6 +1657,16 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, } } + else if (t->type == task_type_pair && + t->subtype == task_subtype_stars_feedback) { + /* Make feedback task depend on ghost */ + scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); + + /* Make end_force depend on feedback */ + if (t->ci == t->ci->super) { + scheduler_addunlock(sched, t, t->ci->super->end_force); + } + } /* Otherwise, sub-self interaction? */ else if (t->type == task_type_sub_self && @@ -1658,6 +1685,22 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, } else error("oo"); } + else if (t->type == task_type_sub_self && + t->subtype == task_subtype_stars_feedback) { + + /* Make all feedback tasks depend on the drift and sorts. */ + //scheduler_addunlock(sched, t->ci->super->hydro.drift, t); + //scheduler_addunlock(sched, t->ci->super->hydro.sorts, t); + //scheduler_addunlock(sched, t->ci->super->grav.drift, t); + //scheduler_addunlock(sched, t->ci->super->stars.sorts, t); + + /* Now, build all the dependencies for the stars for the cells */ + /* that are local and are not descendant of the same super-cells */ + //if (t->ci->nodeID == nodeID) { + // engine_make_stars_loops_dependencies(sched, t, t->ci); + //} else + // error("oo"); + } /* Otherwise, sub-pair interaction? */ else if (t->type == task_type_sub_pair && @@ -1692,6 +1735,38 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, engine_make_stars_loops_dependencies(sched, t, t->cj); } } + else if (t->type == task_type_sub_pair && + t->subtype == task_subtype_stars_feedback) { + + /* Make all feedback tasks depend on the drift. */ + //if (t->cj->nodeID == engine_rank) + // scheduler_addunlock(sched, t->cj->super->hydro.drift, t); + //scheduler_addunlock(sched, t->cj->super->hydro.sorts, t); + + //if (t->cj->nodeID == engine_rank) + // scheduler_addunlock(sched, t->cj->super->grav.drift, t); + //scheduler_addunlock(sched, t->ci->super->stars.sorts, t); + + //if (t->ci->super != t->cj->super) { + // if (t->ci->nodeID == engine_rank) + // scheduler_addunlock(sched, t->ci->super->hydro.drift, t); + // scheduler_addunlock(sched, t->ci->super->hydro.sorts, t); + + // if (t->ci->nodeID == engine_rank) + // scheduler_addunlock(sched, t->ci->super->grav.drift, t); + // scheduler_addunlock(sched, t->cj->super->stars.sorts, t); + //} + + /* Now, build all the dependencies for the stars for the cells */ + /* that are local and are not descendant of the same super-cells */ + //if (t->ci->nodeID == nodeID) { + // engine_make_stars_loops_dependencies(sched, t, t->ci); + //} + //if (t->cj->nodeID == nodeID) { + // if (t->ci->super != t->cj->super) + // engine_make_stars_loops_dependencies(sched, t, t->cj); + //} + } } } @@ -1736,9 +1811,12 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements, if (ci->stars.count == 0 && ci->hydro.count == 0) continue; /* If the cells is local build a self-interaction */ - if (ci->nodeID == nodeID) + if (ci->nodeID == nodeID) { scheduler_addtask(sched, task_type_self, task_subtype_stars_density, 0, 0, ci, NULL); + scheduler_addtask(sched, task_type_self, task_subtype_stars_feedback, 0, 0, + ci, NULL); + } /* Now loop over all the neighbours of this cell */ for (int ii = -1; ii < 2; ii++) { @@ -1767,6 +1845,8 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements, const int sid = sortlistID[(kk + 1) + 3 * ((jj + 1) + 3 * (ii + 1))]; scheduler_addtask(sched, task_type_pair, task_subtype_stars_density, sid, 0, ci, cj); + scheduler_addtask(sched, task_type_pair, task_subtype_stars_feedback, + sid, 0, ci, cj); } } } diff --git a/src/runner.c b/src/runner.c index f14f8d8bc2..6f88d417f1 100644 --- a/src/runner.c +++ b/src/runner.c @@ -2765,6 +2765,8 @@ void *runner_main(void *data) { runner_do_grav_external(r, ci, 1); else if (t->subtype == task_subtype_stars_density) runner_doself_stars_density(r, ci, 1); + else if (t->subtype == task_subtype_stars_feedback) + runner_doself_stars_feedback(r, ci, 1); else error("Unknown/invalid task subtype (%d).", t->subtype); break; @@ -2782,6 +2784,8 @@ void *runner_main(void *data) { runner_dopair_recursive_grav(r, ci, cj, 1); else if (t->subtype == task_subtype_stars_density) runner_dopair_stars_density(r, ci, cj, 1); + else if (t->subtype == task_subtype_stars_feedback) + runner_dopair_stars_feedback(r, ci, cj, 1); else error("Unknown/invalid task subtype (%d).", t->subtype); break; @@ -2797,6 +2801,8 @@ void *runner_main(void *data) { runner_dosub_self2_force(r, ci, 1); else if (t->subtype == task_subtype_stars_density) runner_dosub_self_stars_density(r, ci, 1); + else if (t->subtype == task_subtype_stars_feedback) + runner_dosub_self_stars_feedback(r, ci, 1); else error("Unknown/invalid task subtype (%d).", t->subtype); break; @@ -2812,6 +2818,8 @@ void *runner_main(void *data) { runner_dosub_pair2_force(r, ci, cj, t->flags, 1); else if (t->subtype == task_subtype_stars_density) runner_dosub_pair_stars_density(r, ci, cj, t->flags, 1); + else if (t->subtype == task_subtype_stars_feedback) + runner_dosub_pair_stars_feedback(r, ci, cj, t->flags, 1); else error("Unknown/invalid task subtype (%d).", t->subtype); break; diff --git a/src/stars/Default/stars_iact.h b/src/stars/Default/stars_iact.h index 9e27f86028..c7a6a466d5 100644 --- a/src/stars/Default/stars_iact.h +++ b/src/stars/Default/stars_iact.h @@ -37,6 +37,7 @@ runner_iact_nonsym_stars_density(float r2, const float *dx, float hi, float hj, si->ids_ngbs_density[si->num_ngb_density] = pj->id; ++si->num_ngb_density; #endif + message("here"); } /** @@ -54,4 +55,6 @@ runner_iact_nonsym_stars_density(float r2, const float *dx, float hi, float hj, __attribute__((always_inline)) INLINE static void runner_iact_nonsym_stars_feedback(float r2, const float *dx, float hi, float hj, struct spart *restrict si, - struct part *restrict pj, float a, float H) {} + struct part *restrict pj, float a, float H) { + message("here"); +} diff --git a/src/task.c b/src/task.c index 3918dad3b7..e87b297ece 100644 --- a/src/task.c +++ b/src/task.c @@ -86,7 +86,7 @@ const char *taskID_names[task_type_count] = {"none", const char *subtaskID_names[task_subtype_count] = { "none", "density", "gradient", "force", "grav", "external_grav", "tend", "xv", "rho", "gpart", - "multipole", "spart", "stars_density"}; + "multipole", "spart", "stars_density", "stars_feedback" }; #ifdef WITH_MPI /* MPI communicators for the subtypes. */ diff --git a/src/task.h b/src/task.h index 994b2b14c0..d9ee70d5e5 100644 --- a/src/task.h +++ b/src/task.h @@ -93,6 +93,7 @@ enum task_subtypes { task_subtype_multipole, task_subtype_spart, task_subtype_stars_density, + task_subtype_stars_feedback, task_subtype_count } __attribute__((packed)); -- GitLab From 2b01cd1d440a743aab1e04a311130b3169b6c90d Mon Sep 17 00:00:00 2001 From: Alexei Borissov <dc-bori1@cosma-b.pri.cosma7.alces.network> Date: Wed, 12 Dec 2018 16:34:18 +0000 Subject: [PATCH 02/13] Trying to add subself and subpair tasks --- src/cell.c | 25 +++++++++++++++++-- src/cell.h | 2 +- src/engine_maketasks.c | 54 +++++++++++------------------------------- src/engine_marktasks.c | 33 ++++++++++++++++++++++++++ src/runner.c | 42 ++++++++++++++++++++++++++++++++ src/space.c | 1 + src/task.c | 16 +++++++++++++ 7 files changed, 130 insertions(+), 43 deletions(-) diff --git a/src/cell.c b/src/cell.c index 3fe5e21e7c..c7a58a96f1 100644 --- a/src/cell.c +++ b/src/cell.c @@ -3052,7 +3052,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { struct engine *e = s->space->e; const int nodeID = e->nodeID; int rebuild = 0; - + /* Un-skip the density tasks involved with this cell. */ for (struct link *l = c->stars.density; l != NULL; l = l->next) { struct task *t = l->t; @@ -3116,7 +3116,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { cell_activate_subcell_stars_tasks(t->ci, t->cj, s); } } - + /* Only interested in pair interactions as of here. */ if (t->type == task_type_pair || t->type == task_type_sub_pair) { @@ -3205,6 +3205,27 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { #endif } } + + /* Un-skip the feedback tasks involved with this cell. */ + for (struct link *l = c->stars.feedback; l != NULL; l = l->next) { + struct task *t = l->t; + struct cell *ci = t->ci; + struct cell *cj = t->cj; + const int ci_active = cell_is_active_stars(ci, e); + const int cj_active = (cj != NULL) ? cell_is_active_stars(cj, e) : 0; + + /* Only activate tasks that involve a local active cell. */ + if ((ci_active && ci->nodeID == nodeID) || + (cj_active && cj->nodeID == nodeID)) { + scheduler_activate(s, t); + } + if (t->type == task_type_pair || t->type == task_type_sub_pair) { + + /* Check whether there was too much particle motion, i.e. the + cell neighbour conditions were violated. */ + if (cell_need_rebuild_for_pair(ci, cj)) rebuild = 1; + } + } /* Unskip all the other task types. */ if (c->nodeID == nodeID && cell_is_active_stars(c, e)) { diff --git a/src/cell.h b/src/cell.h index 66dbdd37d1..53c5be312e 100644 --- a/src/cell.h +++ b/src/cell.h @@ -505,7 +505,7 @@ struct cell { /*! Linked list of the tasks computing this cell's star density. */ struct link *density; - // ALEXEI: DOES THIS NEED TO BE HERE? + /*! Linked list of the tasks computing this cell's star feedback. */ struct link *feedback; /*! Number of #spart updated in this cell. */ diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index 4a6344d102..3211e961d6 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -1688,18 +1688,13 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, else if (t->type == task_type_sub_self && t->subtype == task_subtype_stars_feedback) { - /* Make all feedback tasks depend on the drift and sorts. */ - //scheduler_addunlock(sched, t->ci->super->hydro.drift, t); - //scheduler_addunlock(sched, t->ci->super->hydro.sorts, t); - //scheduler_addunlock(sched, t->ci->super->grav.drift, t); - //scheduler_addunlock(sched, t->ci->super->stars.sorts, t); - - /* Now, build all the dependencies for the stars for the cells */ - /* that are local and are not descendant of the same super-cells */ - //if (t->ci->nodeID == nodeID) { - // engine_make_stars_loops_dependencies(sched, t, t->ci); - //} else - // error("oo"); + /* Make feedback task depend on ghost */ + scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); + + /* Make end_force depend on feedback */ + if (t->ci == t->ci->super) { + scheduler_addunlock(sched, t, t->ci->super->end_force); + } } /* Otherwise, sub-pair interaction? */ @@ -1738,34 +1733,13 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, else if (t->type == task_type_sub_pair && t->subtype == task_subtype_stars_feedback) { - /* Make all feedback tasks depend on the drift. */ - //if (t->cj->nodeID == engine_rank) - // scheduler_addunlock(sched, t->cj->super->hydro.drift, t); - //scheduler_addunlock(sched, t->cj->super->hydro.sorts, t); - - //if (t->cj->nodeID == engine_rank) - // scheduler_addunlock(sched, t->cj->super->grav.drift, t); - //scheduler_addunlock(sched, t->ci->super->stars.sorts, t); - - //if (t->ci->super != t->cj->super) { - // if (t->ci->nodeID == engine_rank) - // scheduler_addunlock(sched, t->ci->super->hydro.drift, t); - // scheduler_addunlock(sched, t->ci->super->hydro.sorts, t); - - // if (t->ci->nodeID == engine_rank) - // scheduler_addunlock(sched, t->ci->super->grav.drift, t); - // scheduler_addunlock(sched, t->cj->super->stars.sorts, t); - //} - - /* Now, build all the dependencies for the stars for the cells */ - /* that are local and are not descendant of the same super-cells */ - //if (t->ci->nodeID == nodeID) { - // engine_make_stars_loops_dependencies(sched, t, t->ci); - //} - //if (t->cj->nodeID == nodeID) { - // if (t->ci->super != t->cj->super) - // engine_make_stars_loops_dependencies(sched, t, t->cj); - //} + /* Make feedback task depend on ghost */ + scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); + + /* Make end_force depend on feedback */ + if (t->ci == t->ci->super) { + scheduler_addunlock(sched, t, t->ci->super->end_force); + } } } } diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index ad36c532da..fc26b9982d 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -141,6 +141,23 @@ void engine_marktasks_mapper(void *map_data, int num_elements, } } + /* Activate the star feedback */ + else if (t_type == task_type_self && + t_subtype == task_subtype_stars_feedback) { + if (cell_is_active_stars(ci, e)) { + scheduler_activate(s, t); + } + } + + /* Store current values of dx_max and h_max. */ + else if (t_type == task_type_sub_self && + t_subtype == task_subtype_stars_feedback) { + if (cell_is_active_stars(ci, e)) { + scheduler_activate(s, t); + cell_activate_subcell_stars_tasks(ci, NULL, s); + } + } + /* Activate the gravity drift */ else if (t_type == task_type_self && t_subtype == task_subtype_grav) { if (cell_is_active_gravity(ci, e)) { @@ -279,6 +296,13 @@ void engine_marktasks_mapper(void *map_data, int num_elements, } } + if (t_subtype == task_subtype_stars_feedback && + ((ci_active_stars && ci->nodeID == engine_rank) || + (cj_active_stars && cj->nodeID == engine_rank))) { + + scheduler_activate(s, t); + } + /* Gravity */ if ((t_subtype == task_subtype_grav) && ((ci_active_gravity && ci_nodeID == nodeID) || @@ -403,6 +427,15 @@ void engine_marktasks_mapper(void *map_data, int num_elements, // LOIC: Need implementing MPI case } + + /* Only interested in stars_feedback tasks as of here. */ + if (t->subtype == task_subtype_stars_feedback) { + + /* Too much particle movement? */ + if (cell_need_rebuild_for_pair(ci, cj)) *rebuild_space = 1; + + // LOIC: Need implementing MPI case + } /* Only interested in gravity tasks as of here. */ if (t_subtype == task_subtype_grav) { diff --git a/src/runner.c b/src/runner.c index 6f88d417f1..d985130395 100644 --- a/src/runner.c +++ b/src/runner.c @@ -332,6 +332,48 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { scount, l->t->ci, -1, 1); } } + /* Run through this cell's feedback interactions. */ + for (struct link *l = finger->stars.feedback; l != NULL; l = l->next) { + +#ifdef SWIFT_DEBUG_CHECKS + if (l->t->ti_run < r->e->ti_current) + error("Density task should have been run."); +#endif + + /* Self-interaction? */ + if (l->t->type == task_type_self) + runner_doself_subset_branch_stars_feedback(r, finger, sparts, sid, + scount); + + /* Otherwise, pair interaction? */ + else if (l->t->type == task_type_pair) { + + /* Left or right? */ + if (l->t->ci == finger) + runner_dopair_subset_branch_stars_feedback( + r, finger, sparts, sid, scount, l->t->cj); + else + runner_dopair_subset_branch_stars_feedback( + r, finger, sparts, sid, scount, l->t->ci); + } + + /* Otherwise, sub-self interaction? */ + else if (l->t->type == task_type_sub_self) + runner_dosub_subset_stars_feedback(r, finger, sparts, sid, scount, + NULL, -1, 1); + + /* Otherwise, sub-pair interaction? */ + else if (l->t->type == task_type_sub_pair) { + + /* Left or right? */ + if (l->t->ci == finger) + runner_dosub_subset_stars_feedback(r, finger, sparts, sid, + scount, l->t->cj, -1, 1); + else + runner_dosub_subset_stars_feedback(r, finger, sparts, sid, + scount, l->t->ci, -1, 1); + } + } } } } diff --git a/src/space.c b/src/space.c index 82f369a501..67c08c892a 100644 --- a/src/space.c +++ b/src/space.c @@ -200,6 +200,7 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements, c->stars.ghost_out = NULL; c->stars.ghost = NULL; c->stars.density = NULL; + c->stars.feedback = NULL; c->kick1 = NULL; c->kick2 = NULL; c->timestep = NULL; diff --git a/src/task.c b/src/task.c index e87b297ece..dc0c692e74 100644 --- a/src/task.c +++ b/src/task.c @@ -166,6 +166,7 @@ __attribute__((always_inline)) INLINE static enum task_actions task_acts_on( break; case task_subtype_stars_density: + case task_subtype_stars_feedback: return task_action_all; break; @@ -356,6 +357,8 @@ void task_unlock(struct task *t) { cell_munlocktree(ci); } else if (subtype == task_subtype_stars_density) { cell_sunlocktree(ci); + } else if (subtype == task_subtype_stars_feedback) { + cell_sunlocktree(ci); } else { cell_unlocktree(ci); } @@ -371,6 +374,9 @@ void task_unlock(struct task *t) { } else if (subtype == task_subtype_stars_density) { cell_sunlocktree(ci); cell_sunlocktree(cj); + } else if (subtype == task_subtype_stars_feedback) { + cell_sunlocktree(ci); + cell_sunlocktree(cj); } else { cell_unlocktree(ci); cell_unlocktree(cj); @@ -477,6 +483,9 @@ int task_lock(struct task *t) { } else if (subtype == task_subtype_stars_density) { if (ci->stars.hold) return 0; if (cell_slocktree(ci) != 0) return 0; + } else if (subtype == task_subtype_stars_feedback) { + if (ci->stars.hold) return 0; + if (cell_slocktree(ci) != 0) return 0; } else { if (ci->hydro.hold) return 0; if (cell_locktree(ci) != 0) return 0; @@ -509,6 +518,13 @@ int task_lock(struct task *t) { cell_sunlocktree(ci); return 0; } + } else if (subtype == task_subtype_stars_feedback) { + if (ci->stars.hold || cj->stars.hold) return 0; + if (cell_slocktree(ci) != 0) return 0; + if (cell_slocktree(cj) != 0) { + cell_sunlocktree(ci); + return 0; + } } else { /* Lock the parts in both cells */ if (ci->hydro.hold || cj->hydro.hold) return 0; -- GitLab From a16d066a78e99c8a44ee34bec1496bc8e8018cc1 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Wed, 12 Dec 2018 17:35:58 +0000 Subject: [PATCH 03/13] Correctly accumulate the stars.h_max when construciting the tree. Correctly check for rebuild for stars when marking the tasks. TEmporarily set the smoohting lengths of the stars to a fixed constant. --- src/cell.c | 6 +++--- src/cell.h | 20 +++++++++++++++++++- src/engine_maketasks.c | 28 +++++++++++++--------------- src/engine_marktasks.c | 15 +++++---------- src/runner.c | 16 +++++++++------- src/runner_doiact_stars.h | 2 ++ src/scheduler.c | 2 ++ src/space.c | 5 ++++- src/task.c | 7 ++++--- 9 files changed, 61 insertions(+), 40 deletions(-) diff --git a/src/cell.c b/src/cell.c index c7a58a96f1..69dd7b104f 100644 --- a/src/cell.c +++ b/src/cell.c @@ -3052,7 +3052,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { struct engine *e = s->space->e; const int nodeID = e->nodeID; int rebuild = 0; - + /* Un-skip the density tasks involved with this cell. */ for (struct link *l = c->stars.density; l != NULL; l = l->next) { struct task *t = l->t; @@ -3116,7 +3116,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { cell_activate_subcell_stars_tasks(t->ci, t->cj, s); } } - + /* Only interested in pair interactions as of here. */ if (t->type == task_type_pair || t->type == task_type_sub_pair) { @@ -3205,7 +3205,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { #endif } } - + /* Un-skip the feedback tasks involved with this cell. */ for (struct link *l = c->stars.feedback; l != NULL; l = l->next) { struct task *t = l->t; diff --git a/src/cell.h b/src/cell.h index 53c5be312e..ae73c944bc 100644 --- a/src/cell.h +++ b/src/cell.h @@ -504,7 +504,7 @@ struct cell { /*! Linked list of the tasks computing this cell's star density. */ struct link *density; - + /*! Linked list of the tasks computing this cell's star feedback. */ struct link *feedback; @@ -954,6 +954,24 @@ __attribute__((always_inline)) INLINE static int cell_need_rebuild_for_pair( cj->dmin); } +/** + * @brief Have particles in a pair of cells moved too much and require a rebuild + * ? + * + * @param ci The first #cell. + * @param cj The second #cell. + */ +__attribute__((always_inline)) INLINE static int +cell_need_rebuild_for_stars_pair(const struct cell *ci, const struct cell *cj) { + + /* Is the cut-off radius plus the max distance the parts in both cells have */ + /* moved larger than the cell size ? */ + /* Note ci->dmin == cj->dmin */ + return (kernel_gamma * max(ci->stars.h_max, cj->stars.h_max) + + ci->stars.dx_max_part + cj->stars.dx_max_part > + cj->dmin); +} + /** * @brief Add a unique tag to a cell, mostly for MPI communications. * diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index 3211e961d6..17dfbcaf2c 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -1612,7 +1612,8 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, /* Now, build all the dependencies for the stars */ engine_make_stars_loops_dependencies(sched, t, t->ci); } - if (t->type == task_type_self && t->subtype == task_subtype_stars_feedback) { + if (t->type == task_type_self && + t->subtype == task_subtype_stars_feedback) { /* Make the self-feedback tasks depend on the stars ghost task. */ scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); @@ -1656,12 +1657,11 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, engine_make_stars_loops_dependencies(sched, t, t->cj); } - } - else if (t->type == task_type_pair && - t->subtype == task_subtype_stars_feedback) { + } else if (t->type == task_type_pair && + t->subtype == task_subtype_stars_feedback) { /* Make feedback task depend on ghost */ scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); - + /* Make end_force depend on feedback */ if (t->ci == t->ci->super) { scheduler_addunlock(sched, t, t->ci->super->end_force); @@ -1684,13 +1684,12 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, engine_make_stars_loops_dependencies(sched, t, t->ci); } else error("oo"); - } - else if (t->type == task_type_sub_self && - t->subtype == task_subtype_stars_feedback) { + } else if (t->type == task_type_sub_self && + t->subtype == task_subtype_stars_feedback) { /* Make feedback task depend on ghost */ scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); - + /* Make end_force depend on feedback */ if (t->ci == t->ci->super) { scheduler_addunlock(sched, t, t->ci->super->end_force); @@ -1729,13 +1728,12 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, if (t->ci->super != t->cj->super) engine_make_stars_loops_dependencies(sched, t, t->cj); } - } - else if (t->type == task_type_sub_pair && - t->subtype == task_subtype_stars_feedback) { + } else if (t->type == task_type_sub_pair && + t->subtype == task_subtype_stars_feedback) { /* Make feedback task depend on ghost */ scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); - + /* Make end_force depend on feedback */ if (t->ci == t->ci->super) { scheduler_addunlock(sched, t, t->ci->super->end_force); @@ -1788,8 +1786,8 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements, if (ci->nodeID == nodeID) { scheduler_addtask(sched, task_type_self, task_subtype_stars_density, 0, 0, ci, NULL); - scheduler_addtask(sched, task_type_self, task_subtype_stars_feedback, 0, 0, - ci, NULL); + scheduler_addtask(sched, task_type_self, task_subtype_stars_feedback, 0, + 0, ci, NULL); } /* Now loop over all the neighbours of this cell */ diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index fc26b9982d..9c5c6c438f 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -126,6 +126,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, else if (t_type == task_type_self && t_subtype == task_subtype_stars_density) { if (cell_is_active_stars(ci, e)) { + message("hello"); scheduler_activate(s, t); cell_activate_drift_part(ci, s); cell_activate_drift_spart(ci, s); @@ -423,16 +424,10 @@ void engine_marktasks_mapper(void *map_data, int num_elements, if (t->subtype == task_subtype_stars_density) { /* Too much particle movement? */ - if (cell_need_rebuild_for_pair(ci, cj)) *rebuild_space = 1; - - // LOIC: Need implementing MPI case - } - - /* Only interested in stars_feedback tasks as of here. */ - if (t->subtype == task_subtype_stars_feedback) { - - /* Too much particle movement? */ - if (cell_need_rebuild_for_pair(ci, cj)) *rebuild_space = 1; + if (cell_need_rebuild_for_stars_pair(ci, cj)) { + message("OOOO"); + *rebuild_space = 1; + } // LOIC: Need implementing MPI case } diff --git a/src/runner.c b/src/runner.c index d985130395..e91557b5a5 100644 --- a/src/runner.c +++ b/src/runner.c @@ -333,7 +333,8 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { } } /* Run through this cell's feedback interactions. */ - for (struct link *l = finger->stars.feedback; l != NULL; l = l->next) { + for (struct link *l = finger->stars.feedback; l != NULL; + l = l->next) { #ifdef SWIFT_DEBUG_CHECKS if (l->t->ti_run < r->e->ti_current) @@ -343,7 +344,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { /* Self-interaction? */ if (l->t->type == task_type_self) runner_doself_subset_branch_stars_feedback(r, finger, sparts, sid, - scount); + scount); /* Otherwise, pair interaction? */ else if (l->t->type == task_type_pair) { @@ -360,7 +361,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { /* Otherwise, sub-self interaction? */ else if (l->t->type == task_type_sub_self) runner_dosub_subset_stars_feedback(r, finger, sparts, sid, scount, - NULL, -1, 1); + NULL, -1, 1); /* Otherwise, sub-pair interaction? */ else if (l->t->type == task_type_sub_pair) { @@ -368,10 +369,10 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { /* Left or right? */ if (l->t->ci == finger) runner_dosub_subset_stars_feedback(r, finger, sparts, sid, - scount, l->t->cj, -1, 1); + scount, l->t->cj, -1, 1); else runner_dosub_subset_stars_feedback(r, finger, sparts, sid, - scount, l->t->ci, -1, 1); + scount, l->t->ci, -1, 1); } } } @@ -2805,9 +2806,10 @@ void *runner_main(void *data) { runner_doself_recursive_grav(r, ci, 1); else if (t->subtype == task_subtype_external_grav) runner_do_grav_external(r, ci, 1); - else if (t->subtype == task_subtype_stars_density) + else if (t->subtype == task_subtype_stars_density) { + message("hello"); runner_doself_stars_density(r, ci, 1); - else if (t->subtype == task_subtype_stars_feedback) + } else if (t->subtype == task_subtype_stars_feedback) runner_doself_stars_feedback(r, ci, 1); else error("Unknown/invalid task subtype (%d).", t->subtype); diff --git a/src/runner_doiact_stars.h b/src/runner_doiact_stars.h index e816d80399..4af75f8b7b 100644 --- a/src/runner_doiact_stars.h +++ b/src/runner_doiact_stars.h @@ -101,6 +101,8 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) { (float)(si->x[1] - c->loc[1]), (float)(si->x[2] - c->loc[2])}; + message("hi=%e, c->width=%e", hi, c->width[0]); + /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count; pjd++) { diff --git a/src/scheduler.c b/src/scheduler.c index 2ae8f67854..75f2fad3bb 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1532,6 +1532,8 @@ void scheduler_splittasks_mapper(void *map_data, int num_elements, /* For future use */ } else if (t->subtype == task_subtype_stars_density) { scheduler_splittask_stars(t, s); + } else if (t->subtype == task_subtype_stars_feedback) { + } else { #ifdef SWIFT_DEBUG_CHECKS error("Unexpected task sub-type"); diff --git a/src/space.c b/src/space.c index 67c08c892a..7de8110cc4 100644 --- a/src/space.c +++ b/src/space.c @@ -2179,7 +2179,7 @@ void space_split_recursive(struct space *s, struct cell *c, /* Update the cell-wide properties */ h_max = max(h_max, cp->hydro.h_max); - stars_h_max = max(h_max, cp->stars.h_max); + stars_h_max = max(stars_h_max, cp->stars.h_max); ti_hydro_end_min = min(ti_hydro_end_min, cp->hydro.ti_end_min); ti_hydro_end_max = max(ti_hydro_end_max, cp->hydro.ti_end_max); ti_hydro_beg_max = max(ti_hydro_beg_max, cp->hydro.ti_beg_max); @@ -2916,6 +2916,9 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count, sp[k].v[1] *= a_factor_vel; sp[k].v[2] *= a_factor_vel; + // MATTHIEU: TO DO: Read smoothing lengths from ICs!!!! + sp[k].h = s->dim[0] / 10. / kernel_gamma; + #ifdef HYDRO_DIMENSION_2D sp[k].x[2] = 0.f; sp[k].v[2] = 0.f; diff --git a/src/task.c b/src/task.c index dc0c692e74..71d199cb31 100644 --- a/src/task.c +++ b/src/task.c @@ -84,9 +84,10 @@ const char *taskID_names[task_type_count] = {"none", /* Sub-task type names. */ const char *subtaskID_names[task_subtype_count] = { - "none", "density", "gradient", "force", "grav", - "external_grav", "tend", "xv", "rho", "gpart", - "multipole", "spart", "stars_density", "stars_feedback" }; + "none", "density", "gradient", "force", + "grav", "external_grav", "tend", "xv", + "rho", "gpart", "multipole", "spart", + "stars_density", "stars_feedback"}; #ifdef WITH_MPI /* MPI communicators for the subtypes. */ -- GitLab From 79e2e025d1218bc958b469464b0e4fb3cbf770c9 Mon Sep 17 00:00:00 2001 From: Alexei Borissov <dc-bori1@cosma-b.pri.cosma7.alces.network> Date: Thu, 13 Dec 2018 12:18:35 +0000 Subject: [PATCH 04/13] Added extra star loop to add feedback tasks, create dependencies --- src/engine_maketasks.c | 282 +++++++++++++++++++++++++-------- src/engine_marktasks.c | 4 +- src/runner.c | 2 +- src/runner_doiact_stars.h | 2 +- src/scheduler.c | 2 - src/space.c | 2 +- src/stars/Default/stars_iact.h | 2 - 7 files changed, 225 insertions(+), 71 deletions(-) diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index 17dfbcaf2c..65a5ab02c6 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -1322,9 +1322,11 @@ static inline void engine_make_hydro_loops_dependencies(struct scheduler *sched, */ static inline void engine_make_stars_loops_dependencies(struct scheduler *sched, struct task *density, + struct task *feedback, struct cell *c) { /* density loop --> ghost */ scheduler_addunlock(sched, density, c->super->stars.ghost_in); + scheduler_addunlock(sched, c->super->stars.ghost_out, feedback); } /** @@ -1579,6 +1581,148 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements, } } +/** + * @brief Duplicates the first hydro loop and construct all the + * dependencies for the hydro part + * + * This is done by looping over all the previously constructed tasks + * and adding another task involving the same cells but this time + * corresponding to the second hydro loop over neighbours. + * With all the relevant tasks for a given cell available, we construct + * all the dependencies for that cell. + */ +void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, + void *extra_data) { + + struct engine *e = (struct engine *)extra_data; + struct scheduler *sched = &e->sched; + const int nodeID = e->nodeID; + + for (int ind = 0; ind < num_elements; ind++) { + struct task *t = &((struct task *)map_data)[ind]; + + /* Sort tasks depend on the drift of the cell. */ + if (t->type == task_type_sort && t->ci->nodeID == engine_rank) { + scheduler_addunlock(sched, t->ci->hydro.super->hydro.drift, t); + } + + /* Self-interaction? */ + else if (t->type == task_type_self && t->subtype == task_subtype_stars_density) { + + /* Make the self-density tasks depend on the drift only. */ + scheduler_addunlock(sched, t->ci->hydro.super->hydro.drift, t); + + /* Start by constructing the task for the second hydro loop */ + struct task *t2 = scheduler_addtask( + sched, task_type_self, task_subtype_stars_feedback, 0, 0, t->ci, NULL); + + /* Add the link between the new loop and the cell */ + engine_addlink(e, &t->ci->stars.feedback, t2); + + /* Now, build all the dependencies for the hydro */ + engine_make_stars_loops_dependencies(sched, t, t2, t->ci); + scheduler_addunlock(sched, t2, t->ci->super->end_force); + } + + /* Otherwise, pair interaction? */ + else if (t->type == task_type_pair && t->subtype == task_subtype_stars_density) { + + /* Make all density tasks depend on the drift and the sorts. */ + if (t->ci->nodeID == engine_rank) + scheduler_addunlock(sched, t->ci->hydro.super->hydro.drift, t); + scheduler_addunlock(sched, t->ci->hydro.super->hydro.sorts, t); + if (t->ci->hydro.super != t->cj->hydro.super) { + if (t->cj->nodeID == engine_rank) + scheduler_addunlock(sched, t->cj->hydro.super->hydro.drift, t); + scheduler_addunlock(sched, t->cj->hydro.super->hydro.sorts, t); + } + + /* Start by constructing the task for the second hydro loop */ + struct task *t2 = scheduler_addtask( + sched, task_type_pair, task_subtype_stars_feedback, 0, 0, t->ci, t->cj); + + /* Add the link between the new loop and both cells */ + engine_addlink(e, &t->ci->stars.feedback, t2); + engine_addlink(e, &t->cj->stars.feedback, t2); + + /* Now, build all the dependencies for the hydro for the cells */ + /* that are local and are not descendant of the same super_hydro-cells */ + if (t->ci->nodeID == nodeID) { + engine_make_stars_loops_dependencies(sched, t, t2, t->ci); + scheduler_addunlock(sched, t2, t->ci->super->end_force); + } + if (t->cj->nodeID == nodeID) { + if (t->ci->hydro.super != t->cj->hydro.super) + engine_make_stars_loops_dependencies(sched, t, t2, t->cj); + if (t->ci->super != t->cj->super) + scheduler_addunlock(sched, t2, t->cj->super->end_force); + } + + } + + /* Otherwise, sub-self interaction? */ + else if (t->type == task_type_sub_self && + t->subtype == task_subtype_stars_density) { + + /* Make all density tasks depend on the drift and sorts. */ + scheduler_addunlock(sched, t->ci->hydro.super->hydro.drift, t); + scheduler_addunlock(sched, t->ci->hydro.super->hydro.sorts, t); + + /* Start by constructing the task for the second hydro loop */ + struct task *t2 = + scheduler_addtask(sched, task_type_sub_self, task_subtype_stars_feedback, + t->flags, 0, t->ci, t->cj); + + /* Add the link between the new loop and the cell */ + engine_addlink(e, &t->ci->stars.feedback, t2); + + /* Now, build all the dependencies for the hydro for the cells */ + /* that are local and are not descendant of the same super_hydro-cells */ + if (t->ci->nodeID == nodeID) { + engine_make_stars_loops_dependencies(sched, t, t2, t->ci); + scheduler_addunlock(sched, t2, t->ci->super->end_force); + } + } + + /* Otherwise, sub-pair interaction? */ + else if (t->type == task_type_sub_pair && + t->subtype == task_subtype_stars_density) { + + /* Make all density tasks depend on the drift. */ + if (t->ci->nodeID == engine_rank) + scheduler_addunlock(sched, t->ci->hydro.super->hydro.drift, t); + scheduler_addunlock(sched, t->ci->hydro.super->hydro.sorts, t); + if (t->ci->hydro.super != t->cj->hydro.super) { + if (t->cj->nodeID == engine_rank) + scheduler_addunlock(sched, t->cj->hydro.super->hydro.drift, t); + scheduler_addunlock(sched, t->cj->hydro.super->hydro.sorts, t); + } + + /* Start by constructing the task for the second hydro loop */ + struct task *t2 = + scheduler_addtask(sched, task_type_sub_pair, task_subtype_stars_feedback, + t->flags, 0, t->ci, t->cj); + + /* Add the link between the new loop and both cells */ + engine_addlink(e, &t->ci->stars.feedback, t2); + engine_addlink(e, &t->cj->stars.feedback, t2); + + /* Now, build all the dependencies for the hydro for the cells */ + /* that are local and are not descendant of the same super_hydro-cells */ + if (t->ci->nodeID == nodeID) { + engine_make_stars_loops_dependencies(sched, t, t2, t->ci); + scheduler_addunlock(sched, t2, t->ci->super->end_force); + } + if (t->cj->nodeID == nodeID) { + if (t->ci->hydro.super != t->cj->hydro.super) + engine_make_stars_loops_dependencies(sched, t, t2, t->cj); + if (t->ci->super != t->cj->super) + scheduler_addunlock(sched, t2, t->cj->super->end_force); + } + } + } +} + /** * @brief Creates all the task dependencies for the stars * @@ -1591,7 +1735,7 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, struct engine *e = (struct engine *)extra_data; struct scheduler *sched = &e->sched; - const int nodeID = e->nodeID; + //const int nodeID = e->nodeID; for (int ind = 0; ind < num_elements; ind++) { struct task *t = &((struct task *)map_data)[ind]; @@ -1610,19 +1754,19 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, scheduler_addunlock(sched, t->ci->super->grav.drift, t); /* Now, build all the dependencies for the stars */ - engine_make_stars_loops_dependencies(sched, t, t->ci); + //engine_make_stars_loops_dependencies(sched, t, t->ci); } - if (t->type == task_type_self && - t->subtype == task_subtype_stars_feedback) { + //if (t->type == task_type_self && + // t->subtype == task_subtype_stars_feedback) { - /* Make the self-feedback tasks depend on the stars ghost task. */ - scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); + // /* Make the self-feedback tasks depend on the stars ghost task. */ + // scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); - /* Make end_force depend on feedback */ - if (t->ci == t->ci->super) { - scheduler_addunlock(sched, t, t->ci->super->end_force); - } - } + // /* Make end_force depend on feedback */ + // if (t->ci == t->ci->super) { + // scheduler_addunlock(sched, t, t->ci->super->end_force); + // } + //} /* Otherwise, pair interaction? */ else if (t->type == task_type_pair && @@ -1649,24 +1793,25 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, /* Now, build all the dependencies for the stars for the cells */ /* that are local and are not descendant of the same super-cells */ - if (t->ci->nodeID == nodeID) { - engine_make_stars_loops_dependencies(sched, t, t->ci); - } - if (t->cj->nodeID == nodeID) { - if (t->ci->super != t->cj->super) - engine_make_stars_loops_dependencies(sched, t, t->cj); - } + //if (t->ci->nodeID == nodeID) { + // engine_make_stars_loops_dependencies(sched, t, t->ci); + //} + //if (t->cj->nodeID == nodeID) { + // if (t->ci->super != t->cj->super) + // engine_make_stars_loops_dependencies(sched, t, t->cj); + //} - } else if (t->type == task_type_pair && - t->subtype == task_subtype_stars_feedback) { - /* Make feedback task depend on ghost */ - scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); - - /* Make end_force depend on feedback */ - if (t->ci == t->ci->super) { - scheduler_addunlock(sched, t, t->ci->super->end_force); - } } + //else if (t->type == task_type_pair && + // t->subtype == task_subtype_stars_feedback) { + // /* Make feedback task depend on ghost */ + // scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); + + // /* Make end_force depend on feedback */ + // if (t->ci == t->ci->super) { + // scheduler_addunlock(sched, t, t->ci->super->end_force); + // } + //} /* Otherwise, sub-self interaction? */ else if (t->type == task_type_sub_self && @@ -1680,20 +1825,20 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, /* Now, build all the dependencies for the stars for the cells */ /* that are local and are not descendant of the same super-cells */ - if (t->ci->nodeID == nodeID) { - engine_make_stars_loops_dependencies(sched, t, t->ci); - } else - error("oo"); - } else if (t->type == task_type_sub_self && - t->subtype == task_subtype_stars_feedback) { - - /* Make feedback task depend on ghost */ - scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); - - /* Make end_force depend on feedback */ - if (t->ci == t->ci->super) { - scheduler_addunlock(sched, t, t->ci->super->end_force); - } + //if (t->ci->nodeID == nodeID) { + // engine_make_stars_loops_dependencies(sched, t, t->ci); + //} else + // error("oo"); + //} else if (t->type == task_type_sub_self && + // t->subtype == task_subtype_stars_feedback) { + + // /* Make feedback task depend on ghost */ + // scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); + + // /* Make end_force depend on feedback */ + // if (t->ci == t->ci->super) { + // scheduler_addunlock(sched, t, t->ci->super->end_force); + // } } /* Otherwise, sub-pair interaction? */ @@ -1721,23 +1866,23 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, /* Now, build all the dependencies for the stars for the cells */ /* that are local and are not descendant of the same super-cells */ - if (t->ci->nodeID == nodeID) { - engine_make_stars_loops_dependencies(sched, t, t->ci); - } - if (t->cj->nodeID == nodeID) { - if (t->ci->super != t->cj->super) - engine_make_stars_loops_dependencies(sched, t, t->cj); - } - } else if (t->type == task_type_sub_pair && - t->subtype == task_subtype_stars_feedback) { - - /* Make feedback task depend on ghost */ - scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); - - /* Make end_force depend on feedback */ - if (t->ci == t->ci->super) { - scheduler_addunlock(sched, t, t->ci->super->end_force); - } + //if (t->ci->nodeID == nodeID) { + // engine_make_stars_loops_dependencies(sched, t, t->ci); + //} + //if (t->cj->nodeID == nodeID) { + // if (t->ci->super != t->cj->super) + // engine_make_stars_loops_dependencies(sched, t, t->cj); + //} + //} else if (t->type == task_type_sub_pair && + // t->subtype == task_subtype_stars_feedback) { + + // /* Make feedback task depend on ghost */ + // scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); + + // /* Make end_force depend on feedback */ + // if (t->ci == t->ci->super) { + // scheduler_addunlock(sched, t, t->ci->super->end_force); + // } } } } @@ -1786,8 +1931,8 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements, if (ci->nodeID == nodeID) { scheduler_addtask(sched, task_type_self, task_subtype_stars_density, 0, 0, ci, NULL); - scheduler_addtask(sched, task_type_self, task_subtype_stars_feedback, 0, - 0, ci, NULL); + //scheduler_addtask(sched, task_type_self, task_subtype_stars_feedback, 0, + // 0, ci, NULL); } /* Now loop over all the neighbours of this cell */ @@ -1817,8 +1962,8 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements, const int sid = sortlistID[(kk + 1) + 3 * ((jj + 1) + 3 * (ii + 1))]; scheduler_addtask(sched, task_type_pair, task_subtype_stars_density, sid, 0, ci, cj); - scheduler_addtask(sched, task_type_pair, task_subtype_stars_feedback, - sid, 0, ci, cj); + //scheduler_addtask(sched, task_type_pair, task_subtype_stars_feedback, + // sid, 0, ci, cj); } } } @@ -2163,6 +2308,19 @@ void engine_maketasks(struct engine *e) { tic2 = getticks(); + /* Run through the tasks and make stars feedback tasks for each stars density task. + Each stars feedback task depends on the stars ghosts and unlocks the kick task + of its super-cell. */ + if (e->policy & engine_policy_hydro) + threadpool_map(&e->threadpool, engine_make_extra_starsloop_tasks_mapper, + sched->tasks, sched->nr_tasks, sizeof(struct task), 0, e); + + if (e->verbose) + message("Making extra starsloop tasks took %.3f %s.", + clocks_from_ticks(getticks() - tic2), clocks_getunit()); + + tic2 = getticks(); + /* Add the dependencies for the gravity stuff */ if (e->policy & (engine_policy_self_gravity | engine_policy_external_gravity)) engine_link_gravity_tasks(e); diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index 9c5c6c438f..381d6de60f 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -126,7 +126,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, else if (t_type == task_type_self && t_subtype == task_subtype_stars_density) { if (cell_is_active_stars(ci, e)) { - message("hello"); + //message("hello"); scheduler_activate(s, t); cell_activate_drift_part(ci, s); cell_activate_drift_spart(ci, s); @@ -425,7 +425,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, /* Too much particle movement? */ if (cell_need_rebuild_for_stars_pair(ci, cj)) { - message("OOOO"); + //message("OOOO"); *rebuild_space = 1; } diff --git a/src/runner.c b/src/runner.c index e91557b5a5..2cf6f871b4 100644 --- a/src/runner.c +++ b/src/runner.c @@ -2807,7 +2807,7 @@ void *runner_main(void *data) { else if (t->subtype == task_subtype_external_grav) runner_do_grav_external(r, ci, 1); else if (t->subtype == task_subtype_stars_density) { - message("hello"); + //message("hello"); runner_doself_stars_density(r, ci, 1); } else if (t->subtype == task_subtype_stars_feedback) runner_doself_stars_feedback(r, ci, 1); diff --git a/src/runner_doiact_stars.h b/src/runner_doiact_stars.h index 4af75f8b7b..e202d8ab95 100644 --- a/src/runner_doiact_stars.h +++ b/src/runner_doiact_stars.h @@ -101,7 +101,7 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) { (float)(si->x[1] - c->loc[1]), (float)(si->x[2] - c->loc[2])}; - message("hi=%e, c->width=%e", hi, c->width[0]); + //message("hi=%e, c->width=%e", hi, c->width[0]); /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count; pjd++) { diff --git a/src/scheduler.c b/src/scheduler.c index 75f2fad3bb..2ae8f67854 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1532,8 +1532,6 @@ void scheduler_splittasks_mapper(void *map_data, int num_elements, /* For future use */ } else if (t->subtype == task_subtype_stars_density) { scheduler_splittask_stars(t, s); - } else if (t->subtype == task_subtype_stars_feedback) { - } else { #ifdef SWIFT_DEBUG_CHECKS error("Unexpected task sub-type"); diff --git a/src/space.c b/src/space.c index 7de8110cc4..a7a1cbe4c0 100644 --- a/src/space.c +++ b/src/space.c @@ -2917,7 +2917,7 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count, sp[k].v[2] *= a_factor_vel; // MATTHIEU: TO DO: Read smoothing lengths from ICs!!!! - sp[k].h = s->dim[0] / 10. / kernel_gamma; + //sp[k].h = s->dim[0] / 10. / kernel_gamma; #ifdef HYDRO_DIMENSION_2D sp[k].x[2] = 0.f; diff --git a/src/stars/Default/stars_iact.h b/src/stars/Default/stars_iact.h index c7a6a466d5..4174abd752 100644 --- a/src/stars/Default/stars_iact.h +++ b/src/stars/Default/stars_iact.h @@ -37,7 +37,6 @@ runner_iact_nonsym_stars_density(float r2, const float *dx, float hi, float hj, si->ids_ngbs_density[si->num_ngb_density] = pj->id; ++si->num_ngb_density; #endif - message("here"); } /** @@ -56,5 +55,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_stars_feedback(float r2, const float *dx, float hi, float hj, struct spart *restrict si, struct part *restrict pj, float a, float H) { - message("here"); } -- GitLab From 695c2192e3c3503912ad76102e78377ca1ea913b Mon Sep 17 00:00:00 2001 From: Alexei Borissov <dc-bori1@cosma-b.pri.cosma7.alces.network> Date: Thu, 13 Dec 2018 15:10:49 +0000 Subject: [PATCH 05/13] Cleaned up adding dependencies, added comments. --- src/engine_maketasks.c | 268 ++++++++------------------------------ src/engine_marktasks.c | 2 - src/runner.c | 1 - src/runner_doiact_stars.h | 2 - 4 files changed, 54 insertions(+), 219 deletions(-) diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index 65a5ab02c6..219a27b646 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -1324,7 +1324,7 @@ static inline void engine_make_stars_loops_dependencies(struct scheduler *sched, struct task *density, struct task *feedback, struct cell *c) { - /* density loop --> ghost */ + /* density loop --> ghost --> feedback loop*/ scheduler_addunlock(sched, density, c->super->stars.ghost_in); scheduler_addunlock(sched, c->super->stars.ghost_out, feedback); } @@ -1582,12 +1582,12 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements, } /** - * @brief Duplicates the first hydro loop and construct all the - * dependencies for the hydro part + * @brief Duplicates the first stars loop and construct all the + * dependencies for the stars part * * This is done by looping over all the previously constructed tasks * and adding another task involving the same cells but this time - * corresponding to the second hydro loop over neighbours. + * corresponding to the second stars loop over neighbours. * With all the relevant tasks for a given cell available, we construct * all the dependencies for that cell. */ @@ -1601,43 +1601,54 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, for (int ind = 0; ind < num_elements; ind++) { struct task *t = &((struct task *)map_data)[ind]; - /* Sort tasks depend on the drift of the cell. */ - if (t->type == task_type_sort && t->ci->nodeID == engine_rank) { + /* Sort tasks depend on the drift and gravity drift of the cell. */ + if (t->type == task_type_stars_sort && t->ci->nodeID == engine_rank) { scheduler_addunlock(sched, t->ci->hydro.super->hydro.drift, t); + scheduler_addunlock(sched, t->ci->super->grav.drift, t); } /* Self-interaction? */ else if (t->type == task_type_self && t->subtype == task_subtype_stars_density) { - /* Make the self-density tasks depend on the drift only. */ + /* Make the self-density tasks depend on the drift and gravity drift. */ scheduler_addunlock(sched, t->ci->hydro.super->hydro.drift, t); + scheduler_addunlock(sched, t->ci->super->grav.drift, t); - /* Start by constructing the task for the second hydro loop */ + /* Start by constructing the task for the second stars loop */ struct task *t2 = scheduler_addtask( sched, task_type_self, task_subtype_stars_feedback, 0, 0, t->ci, NULL); /* Add the link between the new loop and the cell */ engine_addlink(e, &t->ci->stars.feedback, t2); - /* Now, build all the dependencies for the hydro */ + /* Now, build all the dependencies for the stars */ engine_make_stars_loops_dependencies(sched, t, t2, t->ci); + + /* end_force depends on feedback tasks */ scheduler_addunlock(sched, t2, t->ci->super->end_force); } /* Otherwise, pair interaction? */ else if (t->type == task_type_pair && t->subtype == task_subtype_stars_density) { - /* Make all density tasks depend on the drift and the sorts. */ + /* Make all stars density tasks depend on the hydro drift and sorts, gravity drift and star sorts. */ if (t->ci->nodeID == engine_rank) - scheduler_addunlock(sched, t->ci->hydro.super->hydro.drift, t); - scheduler_addunlock(sched, t->ci->hydro.super->hydro.sorts, t); - if (t->ci->hydro.super != t->cj->hydro.super) { + scheduler_addunlock(sched, t->ci->super->hydro.drift, t); + scheduler_addunlock(sched, t->ci->super->hydro.sorts, t); + if (t->cj->nodeID == engine_rank) + scheduler_addunlock(sched, t->cj->super->grav.drift, t); + scheduler_addunlock(sched, t->ci->super->stars.sorts, t); + + if (t->ci->super != t->cj->super) { if (t->cj->nodeID == engine_rank) - scheduler_addunlock(sched, t->cj->hydro.super->hydro.drift, t); - scheduler_addunlock(sched, t->cj->hydro.super->hydro.sorts, t); + scheduler_addunlock(sched, t->cj->super->hydro.drift, t); + scheduler_addunlock(sched, t->cj->super->hydro.sorts, t); + if (t->ci->nodeID == engine_rank) + scheduler_addunlock(sched, t->ci->super->grav.drift, t); + scheduler_addunlock(sched, t->cj->super->stars.sorts, t); } - /* Start by constructing the task for the second hydro loop */ + /* Start by constructing the task for the second stars loop */ struct task *t2 = scheduler_addtask( sched, task_type_pair, task_subtype_stars_feedback, 0, 0, t->ci, t->cj); @@ -1645,30 +1656,30 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, engine_addlink(e, &t->ci->stars.feedback, t2); engine_addlink(e, &t->cj->stars.feedback, t2); - /* Now, build all the dependencies for the hydro for the cells */ - /* that are local and are not descendant of the same super_hydro-cells */ + /* Now, build all the dependencies for the stars for the cells */ if (t->ci->nodeID == nodeID) { engine_make_stars_loops_dependencies(sched, t, t2, t->ci); scheduler_addunlock(sched, t2, t->ci->super->end_force); } if (t->cj->nodeID == nodeID) { - if (t->ci->hydro.super != t->cj->hydro.super) + if (t->ci->super != t->cj->super) engine_make_stars_loops_dependencies(sched, t, t2, t->cj); if (t->ci->super != t->cj->super) scheduler_addunlock(sched, t2, t->cj->super->end_force); } - } /* Otherwise, sub-self interaction? */ else if (t->type == task_type_sub_self && t->subtype == task_subtype_stars_density) { - /* Make all density tasks depend on the drift and sorts. */ - scheduler_addunlock(sched, t->ci->hydro.super->hydro.drift, t); - scheduler_addunlock(sched, t->ci->hydro.super->hydro.sorts, t); + /* Make all stars density tasks depend on the hydro drift and sorts, gravity drift and star sorts. */ + scheduler_addunlock(sched, t->ci->super->hydro.drift, t); + scheduler_addunlock(sched, t->ci->super->hydro.sorts, t); + scheduler_addunlock(sched, t->ci->super->grav.drift, t); + scheduler_addunlock(sched, t->ci->super->stars.sorts, t); - /* Start by constructing the task for the second hydro loop */ + /* Start by constructing the task for the second stars loop */ struct task *t2 = scheduler_addtask(sched, task_type_sub_self, task_subtype_stars_feedback, t->flags, 0, t->ci, t->cj); @@ -1676,8 +1687,7 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, /* Add the link between the new loop and the cell */ engine_addlink(e, &t->ci->stars.feedback, t2); - /* Now, build all the dependencies for the hydro for the cells */ - /* that are local and are not descendant of the same super_hydro-cells */ + /* Now, build all the dependencies for the stars for the cells */ if (t->ci->nodeID == nodeID) { engine_make_stars_loops_dependencies(sched, t, t2, t->ci); scheduler_addunlock(sched, t2, t->ci->super->end_force); @@ -1688,95 +1698,10 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, else if (t->type == task_type_sub_pair && t->subtype == task_subtype_stars_density) { - /* Make all density tasks depend on the drift. */ - if (t->ci->nodeID == engine_rank) - scheduler_addunlock(sched, t->ci->hydro.super->hydro.drift, t); - scheduler_addunlock(sched, t->ci->hydro.super->hydro.sorts, t); - if (t->ci->hydro.super != t->cj->hydro.super) { - if (t->cj->nodeID == engine_rank) - scheduler_addunlock(sched, t->cj->hydro.super->hydro.drift, t); - scheduler_addunlock(sched, t->cj->hydro.super->hydro.sorts, t); - } - - /* Start by constructing the task for the second hydro loop */ - struct task *t2 = - scheduler_addtask(sched, task_type_sub_pair, task_subtype_stars_feedback, - t->flags, 0, t->ci, t->cj); - - /* Add the link between the new loop and both cells */ - engine_addlink(e, &t->ci->stars.feedback, t2); - engine_addlink(e, &t->cj->stars.feedback, t2); - - /* Now, build all the dependencies for the hydro for the cells */ - /* that are local and are not descendant of the same super_hydro-cells */ - if (t->ci->nodeID == nodeID) { - engine_make_stars_loops_dependencies(sched, t, t2, t->ci); - scheduler_addunlock(sched, t2, t->ci->super->end_force); - } - if (t->cj->nodeID == nodeID) { - if (t->ci->hydro.super != t->cj->hydro.super) - engine_make_stars_loops_dependencies(sched, t, t2, t->cj); - if (t->ci->super != t->cj->super) - scheduler_addunlock(sched, t2, t->cj->super->end_force); - } - } - } -} - -/** - * @brief Creates all the task dependencies for the stars - * - * @param map_data The tasks - * @param num_elements number of tasks - * @param extra_data The #engine - */ -void engine_link_stars_tasks_mapper(void *map_data, int num_elements, - void *extra_data) { - - struct engine *e = (struct engine *)extra_data; - struct scheduler *sched = &e->sched; - //const int nodeID = e->nodeID; - - for (int ind = 0; ind < num_elements; ind++) { - struct task *t = &((struct task *)map_data)[ind]; - - /* Sort tasks depend on the drift of the cell. */ - if (t->type == task_type_stars_sort && t->ci->nodeID == engine_rank) { - scheduler_addunlock(sched, t->ci->super->grav.drift, t); - } - - /* Self-interaction? */ - if (t->type == task_type_self && t->subtype == task_subtype_stars_density) { - - /* Make the self-density tasks depend on the drifts. */ - scheduler_addunlock(sched, t->ci->super->hydro.drift, t); - - scheduler_addunlock(sched, t->ci->super->grav.drift, t); - - /* Now, build all the dependencies for the stars */ - //engine_make_stars_loops_dependencies(sched, t, t->ci); - } - //if (t->type == task_type_self && - // t->subtype == task_subtype_stars_feedback) { - - // /* Make the self-feedback tasks depend on the stars ghost task. */ - // scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); - - // /* Make end_force depend on feedback */ - // if (t->ci == t->ci->super) { - // scheduler_addunlock(sched, t, t->ci->super->end_force); - // } - //} - - /* Otherwise, pair interaction? */ - else if (t->type == task_type_pair && - t->subtype == task_subtype_stars_density) { - - /* Make all density tasks depend on the drift and the sorts. */ + /* Make all stars density tasks depend on the hydro drift and sorts, gravity drift and star sorts. */ if (t->cj->nodeID == engine_rank) scheduler_addunlock(sched, t->cj->super->hydro.drift, t); scheduler_addunlock(sched, t->cj->super->hydro.sorts, t); - if (t->cj->nodeID == engine_rank) scheduler_addunlock(sched, t->cj->super->grav.drift, t); scheduler_addunlock(sched, t->ci->super->stars.sorts, t); @@ -1785,104 +1710,31 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements, if (t->ci->nodeID == engine_rank) scheduler_addunlock(sched, t->ci->super->hydro.drift, t); scheduler_addunlock(sched, t->ci->super->hydro.sorts, t); - if (t->ci->nodeID == engine_rank) scheduler_addunlock(sched, t->ci->super->grav.drift, t); scheduler_addunlock(sched, t->cj->super->stars.sorts, t); } - /* Now, build all the dependencies for the stars for the cells */ - /* that are local and are not descendant of the same super-cells */ - //if (t->ci->nodeID == nodeID) { - // engine_make_stars_loops_dependencies(sched, t, t->ci); - //} - //if (t->cj->nodeID == nodeID) { - // if (t->ci->super != t->cj->super) - // engine_make_stars_loops_dependencies(sched, t, t->cj); - //} - - } - //else if (t->type == task_type_pair && - // t->subtype == task_subtype_stars_feedback) { - // /* Make feedback task depend on ghost */ - // scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); - - // /* Make end_force depend on feedback */ - // if (t->ci == t->ci->super) { - // scheduler_addunlock(sched, t, t->ci->super->end_force); - // } - //} - - /* Otherwise, sub-self interaction? */ - else if (t->type == task_type_sub_self && - t->subtype == task_subtype_stars_density) { + /* Start by constructing the task for the second stars loop */ + struct task *t2 = + scheduler_addtask(sched, task_type_sub_pair, task_subtype_stars_feedback, + t->flags, 0, t->ci, t->cj); - /* Make all density tasks depend on the drift and sorts. */ - scheduler_addunlock(sched, t->ci->super->hydro.drift, t); - scheduler_addunlock(sched, t->ci->super->hydro.sorts, t); - scheduler_addunlock(sched, t->ci->super->grav.drift, t); - scheduler_addunlock(sched, t->ci->super->stars.sorts, t); + /* Add the link between the new loop and both cells */ + engine_addlink(e, &t->ci->stars.feedback, t2); + engine_addlink(e, &t->cj->stars.feedback, t2); /* Now, build all the dependencies for the stars for the cells */ - /* that are local and are not descendant of the same super-cells */ - //if (t->ci->nodeID == nodeID) { - // engine_make_stars_loops_dependencies(sched, t, t->ci); - //} else - // error("oo"); - //} else if (t->type == task_type_sub_self && - // t->subtype == task_subtype_stars_feedback) { - - // /* Make feedback task depend on ghost */ - // scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); - - // /* Make end_force depend on feedback */ - // if (t->ci == t->ci->super) { - // scheduler_addunlock(sched, t, t->ci->super->end_force); - // } - } - - /* Otherwise, sub-pair interaction? */ - else if (t->type == task_type_sub_pair && - t->subtype == task_subtype_stars_density) { - - /* Make all density tasks depend on the drift. */ - if (t->cj->nodeID == engine_rank) - scheduler_addunlock(sched, t->cj->super->hydro.drift, t); - scheduler_addunlock(sched, t->cj->super->hydro.sorts, t); - - if (t->cj->nodeID == engine_rank) - scheduler_addunlock(sched, t->cj->super->grav.drift, t); - scheduler_addunlock(sched, t->ci->super->stars.sorts, t); - - if (t->ci->super != t->cj->super) { - if (t->ci->nodeID == engine_rank) - scheduler_addunlock(sched, t->ci->super->hydro.drift, t); - scheduler_addunlock(sched, t->ci->super->hydro.sorts, t); - - if (t->ci->nodeID == engine_rank) - scheduler_addunlock(sched, t->ci->super->grav.drift, t); - scheduler_addunlock(sched, t->cj->super->stars.sorts, t); + if (t->ci->nodeID == nodeID) { + engine_make_stars_loops_dependencies(sched, t, t2, t->ci); + scheduler_addunlock(sched, t2, t->ci->super->end_force); + } + if (t->cj->nodeID == nodeID) { + if (t->ci->super != t->cj->super) + engine_make_stars_loops_dependencies(sched, t, t2, t->cj); + if (t->ci->super != t->cj->super) + scheduler_addunlock(sched, t2, t->cj->super->end_force); } - - /* Now, build all the dependencies for the stars for the cells */ - /* that are local and are not descendant of the same super-cells */ - //if (t->ci->nodeID == nodeID) { - // engine_make_stars_loops_dependencies(sched, t, t->ci); - //} - //if (t->cj->nodeID == nodeID) { - // if (t->ci->super != t->cj->super) - // engine_make_stars_loops_dependencies(sched, t, t->cj); - //} - //} else if (t->type == task_type_sub_pair && - // t->subtype == task_subtype_stars_feedback) { - - // /* Make feedback task depend on ghost */ - // scheduler_addunlock(sched, t->ci->super->stars.ghost_out, t); - - // /* Make end_force depend on feedback */ - // if (t->ci == t->ci->super) { - // scheduler_addunlock(sched, t, t->ci->super->end_force); - // } } } } @@ -1931,8 +1783,6 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements, if (ci->nodeID == nodeID) { scheduler_addtask(sched, task_type_self, task_subtype_stars_density, 0, 0, ci, NULL); - //scheduler_addtask(sched, task_type_self, task_subtype_stars_feedback, 0, - // 0, ci, NULL); } /* Now loop over all the neighbours of this cell */ @@ -1962,8 +1812,6 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements, const int sid = sortlistID[(kk + 1) + 3 * ((jj + 1) + 3 * (ii + 1))]; scheduler_addtask(sched, task_type_pair, task_subtype_stars_density, sid, 0, ci, cj); - //scheduler_addtask(sched, task_type_pair, task_subtype_stars_feedback, - // sid, 0, ci, cj); } } } @@ -2311,7 +2159,7 @@ void engine_maketasks(struct engine *e) { /* Run through the tasks and make stars feedback tasks for each stars density task. Each stars feedback task depends on the stars ghosts and unlocks the kick task of its super-cell. */ - if (e->policy & engine_policy_hydro) + if (e->policy & engine_policy_stars) threadpool_map(&e->threadpool, engine_make_extra_starsloop_tasks_mapper, sched->tasks, sched->nr_tasks, sizeof(struct task), 0, e); @@ -2331,14 +2179,6 @@ void engine_maketasks(struct engine *e) { tic2 = getticks(); - if (e->policy & engine_policy_stars) - threadpool_map(&e->threadpool, engine_link_stars_tasks_mapper, sched->tasks, - sched->nr_tasks, sizeof(struct task), 0, e); - - if (e->verbose) - message("Linking stars tasks took %.3f %s.", - clocks_from_ticks(getticks() - tic2), clocks_getunit()); - #ifdef WITH_MPI if (e->policy & engine_policy_feedback) error("Cannot run stellar feedback with MPI (yet)."); diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index 381d6de60f..9b07f26b15 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -126,7 +126,6 @@ void engine_marktasks_mapper(void *map_data, int num_elements, else if (t_type == task_type_self && t_subtype == task_subtype_stars_density) { if (cell_is_active_stars(ci, e)) { - //message("hello"); scheduler_activate(s, t); cell_activate_drift_part(ci, s); cell_activate_drift_spart(ci, s); @@ -425,7 +424,6 @@ void engine_marktasks_mapper(void *map_data, int num_elements, /* Too much particle movement? */ if (cell_need_rebuild_for_stars_pair(ci, cj)) { - //message("OOOO"); *rebuild_space = 1; } diff --git a/src/runner.c b/src/runner.c index 2cf6f871b4..3030b65127 100644 --- a/src/runner.c +++ b/src/runner.c @@ -2807,7 +2807,6 @@ void *runner_main(void *data) { else if (t->subtype == task_subtype_external_grav) runner_do_grav_external(r, ci, 1); else if (t->subtype == task_subtype_stars_density) { - //message("hello"); runner_doself_stars_density(r, ci, 1); } else if (t->subtype == task_subtype_stars_feedback) runner_doself_stars_feedback(r, ci, 1); diff --git a/src/runner_doiact_stars.h b/src/runner_doiact_stars.h index e202d8ab95..e816d80399 100644 --- a/src/runner_doiact_stars.h +++ b/src/runner_doiact_stars.h @@ -101,8 +101,6 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) { (float)(si->x[1] - c->loc[1]), (float)(si->x[2] - c->loc[2])}; - //message("hi=%e, c->width=%e", hi, c->width[0]); - /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count; pjd++) { -- GitLab From 66289b045dca953f5ab13fe20c59786ea27f97d3 Mon Sep 17 00:00:00 2001 From: Alexei Borissov <dc-bori1@cosma-b.pri.cosma7.alces.network> Date: Fri, 14 Dec 2018 12:13:12 +0000 Subject: [PATCH 06/13] Formatting --- src/engine_maketasks.c | 43 ++++++++++++++++++++-------------- src/space.c | 2 +- src/stars/Default/stars_iact.h | 3 +-- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index 219a27b646..b874c1e30b 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -1608,15 +1608,17 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, } /* Self-interaction? */ - else if (t->type == task_type_self && t->subtype == task_subtype_stars_density) { + else if (t->type == task_type_self && + t->subtype == task_subtype_stars_density) { /* Make the self-density tasks depend on the drift and gravity drift. */ scheduler_addunlock(sched, t->ci->hydro.super->hydro.drift, t); scheduler_addunlock(sched, t->ci->super->grav.drift, t); /* Start by constructing the task for the second stars loop */ - struct task *t2 = scheduler_addtask( - sched, task_type_self, task_subtype_stars_feedback, 0, 0, t->ci, NULL); + struct task *t2 = + scheduler_addtask(sched, task_type_self, task_subtype_stars_feedback, + 0, 0, t->ci, NULL); /* Add the link between the new loop and the cell */ engine_addlink(e, &t->ci->stars.feedback, t2); @@ -1629,9 +1631,11 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, } /* Otherwise, pair interaction? */ - else if (t->type == task_type_pair && t->subtype == task_subtype_stars_density) { + else if (t->type == task_type_pair && + t->subtype == task_subtype_stars_density) { - /* Make all stars density tasks depend on the hydro drift and sorts, gravity drift and star sorts. */ + /* Make all stars density tasks depend on the hydro drift and sorts, + * gravity drift and star sorts. */ if (t->ci->nodeID == engine_rank) scheduler_addunlock(sched, t->ci->super->hydro.drift, t); scheduler_addunlock(sched, t->ci->super->hydro.sorts, t); @@ -1649,8 +1653,9 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, } /* Start by constructing the task for the second stars loop */ - struct task *t2 = scheduler_addtask( - sched, task_type_pair, task_subtype_stars_feedback, 0, 0, t->ci, t->cj); + struct task *t2 = + scheduler_addtask(sched, task_type_pair, task_subtype_stars_feedback, + 0, 0, t->ci, t->cj); /* Add the link between the new loop and both cells */ engine_addlink(e, &t->ci->stars.feedback, t2); @@ -1673,16 +1678,17 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, else if (t->type == task_type_sub_self && t->subtype == task_subtype_stars_density) { - /* Make all stars density tasks depend on the hydro drift and sorts, gravity drift and star sorts. */ + /* Make all stars density tasks depend on the hydro drift and sorts, + * gravity drift and star sorts. */ scheduler_addunlock(sched, t->ci->super->hydro.drift, t); scheduler_addunlock(sched, t->ci->super->hydro.sorts, t); scheduler_addunlock(sched, t->ci->super->grav.drift, t); scheduler_addunlock(sched, t->ci->super->stars.sorts, t); /* Start by constructing the task for the second stars loop */ - struct task *t2 = - scheduler_addtask(sched, task_type_sub_self, task_subtype_stars_feedback, - t->flags, 0, t->ci, t->cj); + struct task *t2 = scheduler_addtask(sched, task_type_sub_self, + task_subtype_stars_feedback, t->flags, + 0, t->ci, t->cj); /* Add the link between the new loop and the cell */ engine_addlink(e, &t->ci->stars.feedback, t2); @@ -1698,7 +1704,8 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, else if (t->type == task_type_sub_pair && t->subtype == task_subtype_stars_density) { - /* Make all stars density tasks depend on the hydro drift and sorts, gravity drift and star sorts. */ + /* Make all stars density tasks depend on the hydro drift and sorts, + * gravity drift and star sorts. */ if (t->cj->nodeID == engine_rank) scheduler_addunlock(sched, t->cj->super->hydro.drift, t); scheduler_addunlock(sched, t->cj->super->hydro.sorts, t); @@ -1716,9 +1723,9 @@ void engine_make_extra_starsloop_tasks_mapper(void *map_data, int num_elements, } /* Start by constructing the task for the second stars loop */ - struct task *t2 = - scheduler_addtask(sched, task_type_sub_pair, task_subtype_stars_feedback, - t->flags, 0, t->ci, t->cj); + struct task *t2 = scheduler_addtask(sched, task_type_sub_pair, + task_subtype_stars_feedback, t->flags, + 0, t->ci, t->cj); /* Add the link between the new loop and both cells */ engine_addlink(e, &t->ci->stars.feedback, t2); @@ -2156,9 +2163,9 @@ void engine_maketasks(struct engine *e) { tic2 = getticks(); - /* Run through the tasks and make stars feedback tasks for each stars density task. - Each stars feedback task depends on the stars ghosts and unlocks the kick task - of its super-cell. */ + /* Run through the tasks and make stars feedback tasks for each stars density + task. Each stars feedback task depends on the stars ghosts and unlocks the + kick task of its super-cell. */ if (e->policy & engine_policy_stars) threadpool_map(&e->threadpool, engine_make_extra_starsloop_tasks_mapper, sched->tasks, sched->nr_tasks, sizeof(struct task), 0, e); diff --git a/src/space.c b/src/space.c index 3603ee2ce8..6f3f517298 100644 --- a/src/space.c +++ b/src/space.c @@ -2927,7 +2927,7 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count, sp[k].v[2] *= a_factor_vel; // MATTHIEU: TO DO: Read smoothing lengths from ICs!!!! - //sp[k].h = s->dim[0] / 10. / kernel_gamma; + // sp[k].h = s->dim[0] / 10. / kernel_gamma; #ifdef HYDRO_DIMENSION_2D sp[k].x[2] = 0.f; diff --git a/src/stars/Default/stars_iact.h b/src/stars/Default/stars_iact.h index 4174abd752..9e27f86028 100644 --- a/src/stars/Default/stars_iact.h +++ b/src/stars/Default/stars_iact.h @@ -54,5 +54,4 @@ runner_iact_nonsym_stars_density(float r2, const float *dx, float hi, float hj, __attribute__((always_inline)) INLINE static void runner_iact_nonsym_stars_feedback(float r2, const float *dx, float hi, float hj, struct spart *restrict si, - struct part *restrict pj, float a, float H) { -} + struct part *restrict pj, float a, float H) {} -- GitLab From 4bde355df99d455d1f0c652fe43e79642f807472 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Fri, 14 Dec 2018 14:13:30 +0100 Subject: [PATCH 07/13] Rename cell_need_rebuild_for_pair() to cell_need_rebuild_for_hydro_pair(). --- src/cell.c | 6 +++--- src/cell.h | 10 ++++++---- src/engine_marktasks.c | 6 ++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/cell.c b/src/cell.c index 69dd7b104f..5ba7e75a57 100644 --- a/src/cell.c +++ b/src/cell.c @@ -2768,7 +2768,7 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { /* Check whether there was too much particle motion, i.e. the cell neighbour conditions were violated. */ - if (cell_need_rebuild_for_pair(ci, cj)) rebuild = 1; + if (cell_need_rebuild_for_hydro_pair(ci, cj)) rebuild = 1; #ifdef WITH_MPI /* Activate the send/recv tasks. */ @@ -3122,7 +3122,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { /* Check whether there was too much particle motion, i.e. the cell neighbour conditions were violated. */ - if (cell_need_rebuild_for_pair(ci, cj)) rebuild = 1; + if (cell_need_rebuild_for_hydro_pair(ci, cj)) rebuild = 1; #ifdef WITH_MPI error("MPI with stars not implemented"); @@ -3223,7 +3223,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { /* Check whether there was too much particle motion, i.e. the cell neighbour conditions were violated. */ - if (cell_need_rebuild_for_pair(ci, cj)) rebuild = 1; + if (cell_need_rebuild_for_stars_pair(ci, cj)) rebuild = 1; } } diff --git a/src/cell.h b/src/cell.h index ae73c944bc..3ddd63732e 100644 --- a/src/cell.h +++ b/src/cell.h @@ -937,14 +937,15 @@ cell_can_split_self_gravity_task(const struct cell *c) { } /** - * @brief Have particles in a pair of cells moved too much and require a rebuild + * @brief Have gas particles in a pair of cells moved too much and require a + * rebuild * ? * * @param ci The first #cell. * @param cj The second #cell. */ -__attribute__((always_inline)) INLINE static int cell_need_rebuild_for_pair( - const struct cell *ci, const struct cell *cj) { +__attribute__((always_inline)) INLINE static int +cell_need_rebuild_for_hydro_pair(const struct cell *ci, const struct cell *cj) { /* Is the cut-off radius plus the max distance the parts in both cells have */ /* moved larger than the cell size ? */ @@ -955,7 +956,8 @@ __attribute__((always_inline)) INLINE static int cell_need_rebuild_for_pair( } /** - * @brief Have particles in a pair of cells moved too much and require a rebuild + * @brief Have star particles in a pair of cells moved too much and require a + * rebuild * ? * * @param ci The first #cell. diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index 9b07f26b15..96886c827c 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -327,7 +327,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, if (t_subtype == task_subtype_density) { /* Too much particle movement? */ - if (cell_need_rebuild_for_pair(ci, cj)) *rebuild_space = 1; + if (cell_need_rebuild_for_hydro_pair(ci, cj)) *rebuild_space = 1; #ifdef WITH_MPI /* Activate the send/recv tasks. */ @@ -423,9 +423,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, if (t->subtype == task_subtype_stars_density) { /* Too much particle movement? */ - if (cell_need_rebuild_for_stars_pair(ci, cj)) { - *rebuild_space = 1; - } + if (cell_need_rebuild_for_stars_pair(ci, cj)) *rebuild_space = 1; // LOIC: Need implementing MPI case } -- GitLab From 7b1429bc8866bdd2498178bd48a489e317d9c43f Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Fri, 14 Dec 2018 14:21:34 +0100 Subject: [PATCH 08/13] No need to 'redo' the star feedback tasks when the smoothing length was incorrect in the star ghost task. --- src/runner.c | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/src/runner.c b/src/runner.c index 3030b65127..27765e0a20 100644 --- a/src/runner.c +++ b/src/runner.c @@ -332,49 +332,6 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { scount, l->t->ci, -1, 1); } } - /* Run through this cell's feedback interactions. */ - for (struct link *l = finger->stars.feedback; l != NULL; - l = l->next) { - -#ifdef SWIFT_DEBUG_CHECKS - if (l->t->ti_run < r->e->ti_current) - error("Density task should have been run."); -#endif - - /* Self-interaction? */ - if (l->t->type == task_type_self) - runner_doself_subset_branch_stars_feedback(r, finger, sparts, sid, - scount); - - /* Otherwise, pair interaction? */ - else if (l->t->type == task_type_pair) { - - /* Left or right? */ - if (l->t->ci == finger) - runner_dopair_subset_branch_stars_feedback( - r, finger, sparts, sid, scount, l->t->cj); - else - runner_dopair_subset_branch_stars_feedback( - r, finger, sparts, sid, scount, l->t->ci); - } - - /* Otherwise, sub-self interaction? */ - else if (l->t->type == task_type_sub_self) - runner_dosub_subset_stars_feedback(r, finger, sparts, sid, scount, - NULL, -1, 1); - - /* Otherwise, sub-pair interaction? */ - else if (l->t->type == task_type_sub_pair) { - - /* Left or right? */ - if (l->t->ci == finger) - runner_dosub_subset_stars_feedback(r, finger, sparts, sid, - scount, l->t->cj, -1, 1); - else - runner_dosub_subset_stars_feedback(r, finger, sparts, sid, - scount, l->t->ci, -1, 1); - } - } } } } -- GitLab From feef96b269b2c40e2d5edb2a31f3d102fc639924 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Fri, 14 Dec 2018 14:24:39 +0100 Subject: [PATCH 09/13] Style changes. Do not overwrite the star smoothing lengths read in at start up. --- src/runner.c | 4 ++-- src/space.c | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/runner.c b/src/runner.c index 27765e0a20..6f88d417f1 100644 --- a/src/runner.c +++ b/src/runner.c @@ -2763,9 +2763,9 @@ void *runner_main(void *data) { runner_doself_recursive_grav(r, ci, 1); else if (t->subtype == task_subtype_external_grav) runner_do_grav_external(r, ci, 1); - else if (t->subtype == task_subtype_stars_density) { + else if (t->subtype == task_subtype_stars_density) runner_doself_stars_density(r, ci, 1); - } else if (t->subtype == task_subtype_stars_feedback) + else if (t->subtype == task_subtype_stars_feedback) runner_doself_stars_feedback(r, ci, 1); else error("Unknown/invalid task subtype (%d).", t->subtype); diff --git a/src/space.c b/src/space.c index 6f3f517298..a449d4b1ca 100644 --- a/src/space.c +++ b/src/space.c @@ -2926,9 +2926,6 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count, sp[k].v[1] *= a_factor_vel; sp[k].v[2] *= a_factor_vel; - // MATTHIEU: TO DO: Read smoothing lengths from ICs!!!! - // sp[k].h = s->dim[0] / 10. / kernel_gamma; - #ifdef HYDRO_DIMENSION_2D sp[k].x[2] = 0.f; sp[k].v[2] = 0.f; -- GitLab From 8bf529634852bb05f8ce89bf8daf56ba83e990cd Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Fri, 14 Dec 2018 15:59:01 +0100 Subject: [PATCH 10/13] Update the python analysis scripts with the new tasks and runtime measurements. --- tools/analyse_runtime.py | 1 + tools/task_plots/analyse_tasks.py | 1 + tools/task_plots/plot_tasks.py | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/tools/analyse_runtime.py b/tools/analyse_runtime.py index e1b09a9903..a4b08d5d0f 100755 --- a/tools/analyse_runtime.py +++ b/tools/analyse_runtime.py @@ -67,6 +67,7 @@ labels = [ "Counting and linking tasks", "Setting super-pointers", "Making extra hydroloop tasks", + "Making extra starsloop tasks", "Linking gravity tasks", "Creating send tasks", "Exchanging cell tags", diff --git a/tools/task_plots/analyse_tasks.py b/tools/task_plots/analyse_tasks.py index ca41970c68..614a246c9c 100755 --- a/tools/task_plots/analyse_tasks.py +++ b/tools/task_plots/analyse_tasks.py @@ -114,6 +114,7 @@ SUBTYPES = [ "multipole", "spart", "stars_density", + "stars_feedback", "count", ] diff --git a/tools/task_plots/plot_tasks.py b/tools/task_plots/plot_tasks.py index 1fe7bcbd11..826b0dd046 100755 --- a/tools/task_plots/plot_tasks.py +++ b/tools/task_plots/plot_tasks.py @@ -199,6 +199,7 @@ SUBTYPES = [ "multipole", "spart", "stars_density", + "stars_feedback", "count", ] @@ -226,6 +227,10 @@ FULLTYPES = [ "pair/stars_density", "sub_self/stars_density", "sub_pair/stars_density", + "self/stars_feedback", + "pair/stars_feedback", + "sub_self/stars_feedback", + "sub_pair/stars_feedback", ] # A number of colours for the various types. Recycled when there are -- GitLab From ae9a1d964c519d885114da547d606ca5e915d63f Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Fri, 14 Dec 2018 16:05:55 +0100 Subject: [PATCH 11/13] Lock both the parts and the sparts in the feedback tasks. --- src/task.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/task.c b/src/task.c index 71d199cb31..9fd465744c 100644 --- a/src/task.c +++ b/src/task.c @@ -360,6 +360,7 @@ void task_unlock(struct task *t) { cell_sunlocktree(ci); } else if (subtype == task_subtype_stars_feedback) { cell_sunlocktree(ci); + cell_unlocktree(ci); } else { cell_unlocktree(ci); } @@ -378,6 +379,8 @@ void task_unlock(struct task *t) { } else if (subtype == task_subtype_stars_feedback) { cell_sunlocktree(ci); cell_sunlocktree(cj); + cell_unlocktree(ci); + cell_unlocktree(cj); } else { cell_unlocktree(ci); cell_unlocktree(cj); @@ -486,8 +489,13 @@ int task_lock(struct task *t) { if (cell_slocktree(ci) != 0) return 0; } else if (subtype == task_subtype_stars_feedback) { if (ci->stars.hold) return 0; + if (ci->hydro.hold) return 0; if (cell_slocktree(ci) != 0) return 0; - } else { + if (cell_locktree(ci) != 0) { + cell_sunlocktree(ci); + return 0; + } + } else { /* subtype == hydro */ if (ci->hydro.hold) return 0; if (cell_locktree(ci) != 0) return 0; } @@ -520,13 +528,26 @@ int task_lock(struct task *t) { return 0; } } else if (subtype == task_subtype_stars_feedback) { + /* Lock the stars and the gas particles in both cells */ if (ci->stars.hold || cj->stars.hold) return 0; + if (ci->hydro.hold || cj->hydro.hold) return 0; if (cell_slocktree(ci) != 0) return 0; if (cell_slocktree(cj) != 0) { cell_sunlocktree(ci); return 0; } - } else { + if (cell_locktree(ci) != 0) { + cell_sunlocktree(ci); + cell_sunlocktree(cj); + return 0; + } + if (cell_locktree(cj) != 0) { + cell_sunlocktree(ci); + cell_sunlocktree(cj); + cell_unlocktree(ci); + return 0; + } + } else { /* subtype == hydro */ /* Lock the parts in both cells */ if (ci->hydro.hold || cj->hydro.hold) return 0; if (cell_locktree(ci) != 0) return 0; -- GitLab From ab421d93313b352456db5ad0ee085e9a8cf65ffb Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Fri, 14 Dec 2018 16:24:31 +0100 Subject: [PATCH 12/13] Simplify the unskipping of feedback tasks. This now mimics what is done for the hydro force tasks. --- src/cell.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/cell.c b/src/cell.c index 5ba7e75a57..0a1556c074 100644 --- a/src/cell.c +++ b/src/cell.c @@ -3122,7 +3122,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { /* Check whether there was too much particle motion, i.e. the cell neighbour conditions were violated. */ - if (cell_need_rebuild_for_hydro_pair(ci, cj)) rebuild = 1; + if (cell_need_rebuild_for_stars_pair(ci, cj)) rebuild = 1; #ifdef WITH_MPI error("MPI with stars not implemented"); @@ -3206,30 +3206,13 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { } } - /* Un-skip the feedback tasks involved with this cell. */ - for (struct link *l = c->stars.feedback; l != NULL; l = l->next) { - struct task *t = l->t; - struct cell *ci = t->ci; - struct cell *cj = t->cj; - const int ci_active = cell_is_active_stars(ci, e); - const int cj_active = (cj != NULL) ? cell_is_active_stars(cj, e) : 0; - - /* Only activate tasks that involve a local active cell. */ - if ((ci_active && ci->nodeID == nodeID) || - (cj_active && cj->nodeID == nodeID)) { - scheduler_activate(s, t); - } - if (t->type == task_type_pair || t->type == task_type_sub_pair) { - - /* Check whether there was too much particle motion, i.e. the - cell neighbour conditions were violated. */ - if (cell_need_rebuild_for_stars_pair(ci, cj)) rebuild = 1; - } - } - /* Unskip all the other task types. */ if (c->nodeID == nodeID && cell_is_active_stars(c, e)) { + /* Un-skip the feedback tasks involved with this cell. */ + for (struct link *l = c->stars.feedback; l != NULL; l = l->next) + scheduler_activate(s, l->t); + if (c->stars.ghost_in != NULL) scheduler_activate(s, c->stars.ghost_in); if (c->stars.ghost_out != NULL) scheduler_activate(s, c->stars.ghost_out); if (c->stars.ghost != NULL) scheduler_activate(s, c->stars.ghost); -- GitLab From b45e967565d12110098ef0799cde71a34b4544eb Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Fri, 14 Dec 2018 16:29:10 +0100 Subject: [PATCH 13/13] Improved comments in engine_marktasks(). --- src/engine_marktasks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index 96886c827c..9c7a783c25 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -239,7 +239,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, } } - /* Stars */ + /* Stars density */ if (t_subtype == task_subtype_stars_density && ((ci_active_stars && ci->nodeID == engine_rank) || (cj_active_stars && cj->nodeID == engine_rank))) { @@ -296,6 +296,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, } } + /* Stars feedback */ if (t_subtype == task_subtype_stars_feedback && ((ci_active_stars && ci->nodeID == engine_rank) || (cj_active_stars && cj->nodeID == engine_rank))) { -- GitLab