diff --git a/src/cell.c b/src/cell.c index aee4ddeafc65ef25da8ec81f4a0d449fbb6855e6..02be9bc3c896b7615a4dd2e811895e070934369a 100644 --- a/src/cell.c +++ b/src/cell.c @@ -3142,7 +3142,6 @@ int cell_unskip_gravity_tasks(struct cell *c, struct scheduler *s) { * @return 1 If the space needs rebuilding. 0 otherwise. */ 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; @@ -3175,7 +3174,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { /* Set the correct sorting flags and activate hydro drifts */ else if (t->type == task_type_pair) { /* Do ci */ - if (ci_active && cj->hydro.count != 0 && ci->stars.count != 0) { + if (ci_active) { /* stars for ci */ atomic_or(&ci->stars.requires_sorts, 1 << t->flags); ci->stars.dx_max_sort_old = ci->stars.dx_max_sort; @@ -3194,7 +3193,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { } /* Do cj */ - if (cj_active && ci->hydro.count != 0 && cj->stars.count != 0) { + if (cj_active) { /* hydro for ci */ atomic_or(&ci->hydro.requires_sorts, 1 << t->flags); ci->hydro.dx_max_sort_old = ci->hydro.dx_max_sort; @@ -3233,10 +3232,10 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { if (cj_active) { scheduler_activate(s, ci->mpi.hydro.recv_xv); - if (ci_active) { - scheduler_activate(s, ci->mpi.stars.recv); - } } + if (ci_active) { + scheduler_activate(s, ci->mpi.stars.recv); + } /* If the foreign cell is active, we want its ti_end values. */ if (ci_active) scheduler_activate(s, ci->mpi.recv_ti); @@ -3250,12 +3249,12 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { particles will be drifted, only those that are needed. */ cell_activate_drift_part(cj, s); - /* If the local cell is also active, more stuff will be needed. - */ - if (cj_active) { - scheduler_activate_send(s, cj->mpi.stars.send, ci_nodeID); - } } + /* If the local cell is active, more stuff will be needed. + */ + if (cj_active) { + scheduler_activate_send(s, cj->mpi.stars.send, ci_nodeID); + } /* If the local cell is active, send its ti_end values. */ if (cj_active) scheduler_activate_send(s, cj->mpi.send_ti, ci_nodeID); @@ -3265,10 +3264,10 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { /* If the local cell is active, receive data from the foreign cell. */ if (ci_active) { scheduler_activate(s, cj->mpi.hydro.recv_xv); - if (cj_active) { - scheduler_activate(s, cj->mpi.stars.recv); - } } + if (cj_active) { + scheduler_activate(s, cj->mpi.stars.recv); + } /* If the foreign cell is active, we want its ti_end values. */ if (cj_active) scheduler_activate(s, cj->mpi.recv_ti); @@ -3282,12 +3281,12 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { particles will be drifted, only those that are needed. */ cell_activate_drift_part(ci, s); - /* If the local cell is also active, more stuff will be needed. - */ - if (ci_active) { - scheduler_activate_send(s, ci->mpi.stars.send, cj_nodeID); - } } + /* If the local cell is active, more stuff will be needed. + */ + if (ci_active) { + scheduler_activate_send(s, ci->mpi.stars.send, cj_nodeID); + } /* If the local cell is active, send its ti_end values. */ if (ci_active) scheduler_activate_send(s, ci->mpi.send_ti, cj_nodeID); diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index 09e612bc4fae869256b3c821ab38689ab35eecc4..953eeec7b268ba55332f465608be3c36d7ff2fd9 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -73,9 +73,9 @@ void engine_activate_stars_mpi(struct engine *e, struct scheduler *s, if (cj_active_stars) { scheduler_activate(s, ci->mpi.hydro.recv_xv); - if (ci_active_stars) { - scheduler_activate(s, ci->mpi.stars.recv); - } + } + if (ci_active_stars) { + scheduler_activate(s, ci->mpi.stars.recv); } /* If the foreign cell is active, we want its ti_end values. */ @@ -92,10 +92,10 @@ void engine_activate_stars_mpi(struct engine *e, struct scheduler *s, itself. */ cell_activate_drift_part(l->t->ci, s); - /* If the local cell is also active, more stuff will be needed. */ - if (cj_active_stars) { - scheduler_activate_send(s, cj->mpi.stars.send, ci_nodeID); - } + } + /* If the local cell is active, more stuff will be needed. */ + if (cj_active_stars) { + scheduler_activate_send(s, cj->mpi.stars.send, ci_nodeID); } /* If the local cell is active, send its ti_end values. */ @@ -106,11 +106,10 @@ void engine_activate_stars_mpi(struct engine *e, struct scheduler *s, } else if (cj_nodeID != nodeID) { /* If the local cell is active, receive data from the foreign cell. */ if (ci_active_stars) { - scheduler_activate(s, cj->mpi.hydro.recv_xv); - if (cj_active_stars) { - scheduler_activate(s, cj->mpi.stars.recv); - } + } + if (cj_active_stars) { + scheduler_activate(s, cj->mpi.stars.recv); } /* If the foreign cell is active, we want its ti_end values. */ @@ -127,10 +126,10 @@ void engine_activate_stars_mpi(struct engine *e, struct scheduler *s, itself. */ cell_activate_drift_part(l->t->ci, s); - /* If the local cell is also active, more stuff will be needed. */ - if (ci_active_stars) { - scheduler_activate_send(s, ci->mpi.stars.send, cj_nodeID); - } + } + /* If the local cell is active, more stuff will be needed. */ + if (ci_active_stars) { + scheduler_activate_send(s, ci->mpi.stars.send, cj_nodeID); } /* If the local cell is active, send its ti_end values. */ @@ -350,18 +349,13 @@ void engine_marktasks_mapper(void *map_data, int num_elements, ((ci_active_stars && ci->nodeID == engine_rank) || (cj_active_stars && cj->nodeID == engine_rank))) { - // MATTHIEU: The logic here can be improved. - // If ci is active for stars but not cj, then we can only drift the - // stars in ci and parts in cj. (and vice-versa). The same logic can be - // applied in cell_unskip_stars(). - scheduler_activate(s, t); /* Set the correct sorting flags */ if (t_type == task_type_pair) { /* Do ci */ - if (ci_active_stars && ci->nodeID == engine_rank) { + if (ci_active_stars) { /* Store some values. */ atomic_or(&cj->hydro.requires_sorts, 1 << t->flags); atomic_or(&ci->stars.requires_sorts, 1 << t->flags); @@ -381,7 +375,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, } /* Do cj */ - if (ci_active_stars && ci->nodeID == engine_rank) { + if (cj_active_stars) { /* Store some values. */ atomic_or(&ci->hydro.requires_sorts, 1 << t->flags); atomic_or(&cj->stars.requires_sorts, 1 << t->flags); diff --git a/src/runner.c b/src/runner.c index f21505564874730041dc449bbafc326727b1aa97..74f7ba120c6040e241200eba7b1fd27004361a59 100644 --- a/src/runner.c +++ b/src/runner.c @@ -982,9 +982,6 @@ void runner_do_stars_sort(struct runner *r, struct cell *c, int flags, /* Copy the minimum into the new sort array. */ finger[ind].d = buff[inds[0]]; - if (c->progeny[inds[0]] == NULL || - c->progeny[inds[0]]->stars.count == 0) - error("should not do it"); finger[ind].i = fingers[inds[0]]->i + off[inds[0]]; /* Update the buffer. */