diff --git a/src/cell.c b/src/cell.c index f8722eccc55f662ef20d7762292b9798c5e0a157..95e323307ab602dd1eb4c8e8c78f662295409ee1 100644 --- a/src/cell.c +++ b/src/cell.c @@ -3574,12 +3574,23 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { const int cj_nodeID = nodeID; #endif - if ((ci_active && cj_nodeID == nodeID) || - (cj_active && ci_nodeID == nodeID)) { + /* We only want to activate the task if the cell is active and is + going to update some gas on the *local* node */ + if ((ci_nodeID == nodeID && cj_nodeID == nodeID) && + (ci_active || cj_active)) { + + scheduler_activate(s, t); + + } else if ((ci_nodeID == nodeID && cj_nodeID != nodeID) && (cj_active)) { + scheduler_activate(s, t); - /* Nothing more to do here, all drifts and sorts activated above */ + } else if ((ci_nodeID != nodeID && cj_nodeID == nodeID) && (ci_active)) { + + scheduler_activate(s, t); } + + /* Nothing more to do here, all drifts and sorts activated above */ } /* Unskip all the other task types. */ diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index 9b34b3ea95a9ae8bc848a90113647b3e68b121b1..277c9560318104d7b6d28696d751ee89db26b467 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -309,11 +309,25 @@ void engine_marktasks_mapper(void *map_data, int num_elements, } /* Stars feedback */ - else if ((t_subtype == task_subtype_stars_feedback) && - ((ci_active_stars && ci_nodeID == nodeID) || - (cj_active_stars && cj_nodeID == nodeID))) { + else if (t_subtype == task_subtype_stars_feedback) { - scheduler_activate(s, t); + /* We only want to activate the task if the cell is active and is + going to update some gas on the *local* node */ + if ((ci_nodeID == nodeID && cj_nodeID == nodeID) && + (ci_active_stars || cj_active_stars)) { + + scheduler_activate(s, t); + + } else if ((ci_nodeID == nodeID && cj_nodeID != nodeID) && + (cj_active_stars)) { + + scheduler_activate(s, t); + + } else if ((ci_nodeID != nodeID && cj_nodeID == nodeID) && + (ci_active_stars)) { + + scheduler_activate(s, t); + } } /* Gravity */