diff --git a/src/runner_doiact_functions_stars.h b/src/runner_doiact_functions_stars.h index 63334e768517421799b30485cea884d92f95387c..75eb462d8f28d85bc72e74f2d664456d008aecec 100644 --- a/src/runner_doiact_functions_stars.h +++ b/src/runner_doiact_functions_stars.h @@ -624,7 +624,8 @@ void DO_SYM_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj, } void DOPAIR1_STARS_NAIVE(struct runner *r, struct cell *restrict ci, - struct cell *restrict cj, int timer) { + struct cell *restrict cj, int timer, const int offset, + const int increment) { TIMER_TIC; @@ -638,9 +639,9 @@ void DOPAIR1_STARS_NAIVE(struct runner *r, struct cell *restrict ci, const int do_cj_stars = ci->nodeID == r->e->nodeID; #endif if (do_ci_stars && ci->stars.count != 0 && cj->hydro.count != 0) - DO_NONSYM_PAIR1_STARS_NAIVE(r, ci, cj, 0, 1); + DO_NONSYM_PAIR1_STARS_NAIVE(r, ci, cj, offset, increment); if (do_cj_stars && cj->stars.count != 0 && ci->hydro.count != 0) - DO_NONSYM_PAIR1_STARS_NAIVE(r, cj, ci, 0, 1); + DO_NONSYM_PAIR1_STARS_NAIVE(r, cj, ci, offset, increment); TIMER_TOC(TIMER_DOPAIR_STARS); } @@ -1207,7 +1208,8 @@ void DOSELF1_BRANCH_STARS(struct runner *r, struct cell *c, const int offset, * @param cj #cell cj * */ -void DOPAIR1_BRANCH_STARS(struct runner *r, struct cell *ci, struct cell *cj) { +void DOPAIR1_BRANCH_STARS(struct runner *r, struct cell *ci, struct cell *cj, + const int offset, const int increment) { const struct engine *restrict e = r->e; @@ -1276,9 +1278,9 @@ void DOPAIR1_BRANCH_STARS(struct runner *r, struct cell *ci, struct cell *cj) { #endif /* SWIFT_DEBUG_CHECKS */ #ifdef SWIFT_USE_NAIVE_INTERACTIONS_STARS - DOPAIR1_STARS_NAIVE(r, ci, cj, 1); + DOPAIR1_STARS_NAIVE(r, ci, cj, 1, offset, increment); #else - DO_SYM_PAIR1_STARS(r, ci, cj, sid, shift, 0, 1); + DO_SYM_PAIR1_STARS(r, ci, cj, sid, shift, offset, increment); #endif } @@ -1294,7 +1296,7 @@ void DOPAIR1_BRANCH_STARS(struct runner *r, struct cell *ci, struct cell *cj) { * redundant computations to find the sid on-the-fly. */ void DOSUB_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj, - int gettimer) { + int gettimer, const int offset, const int increment) { TIMER_TIC; @@ -1320,7 +1322,8 @@ void DOSUB_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj, const int pid = csp->pairs[k].pid; const int pjd = csp->pairs[k].pjd; if (ci->progeny[pid] != NULL && cj->progeny[pjd] != NULL) - DOSUB_PAIR1_STARS(r, ci->progeny[pid], cj->progeny[pjd], 0); + DOSUB_PAIR1_STARS(r, ci->progeny[pid], cj->progeny[pjd], 0, offset, + increment); } } @@ -1382,7 +1385,7 @@ void DOSUB_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj, } } - if (do_ci || do_cj) DOPAIR1_BRANCH_STARS(r, ci, cj); + if (do_ci || do_cj) DOPAIR1_BRANCH_STARS(r, ci, cj, offset, increment); } TIMER_TOC(TIMER_DOSUB_PAIR_STARS); @@ -1419,21 +1422,8 @@ void DOSUB_SELF1_STARS(struct runner *r, struct cell *ci, int gettimer, DOSUB_SELF1_STARS(r, ci->progeny[k], 0, offset, increment); for (int j = k + 1; j < 8; j++) if (ci->progeny[j] != NULL) { - if (increment == 1) { - DOSUB_PAIR1_STARS(r, ci->progeny[k], ci->progeny[j], 0); - } else { - - struct cell *pci = ci->progeny[k]; - struct cell *pcj = ci->progeny[j]; - - double shift[3] = {0.0, 0.0, 0.0}; - const int sid = space_getsid(r->e->s, &pci, &pcj, shift); - - /* there is (currently) no clever way to split symmetric pair - tasks, so we cannot recurse any further and have to do a naive - non-symmetric interaction that can be properly split */ - DO_SYM_PAIR1_STARS(r, pci, pcj, sid, shift, offset, increment); - } + DOSUB_PAIR1_STARS(r, ci->progeny[k], ci->progeny[j], 0, offset, + increment); } } } diff --git a/src/runner_doiact_stars.h b/src/runner_doiact_stars.h index e9fa2f7062d36fb52b646aa38e9c792f28e5865a..d4ccfc6fecfb12b13cdf0a48ef27e5975ebc552b 100644 --- a/src/runner_doiact_stars.h +++ b/src/runner_doiact_stars.h @@ -88,12 +88,13 @@ void DOSELF1_BRANCH_STARS(struct runner *r, struct cell *c, const int offset, const int increment); -void DOPAIR1_BRANCH_STARS(struct runner *r, struct cell *ci, struct cell *cj); +void DOPAIR1_BRANCH_STARS(struct runner *r, struct cell *ci, struct cell *cj, + const int offset, const int increment); void DOSUB_SELF1_STARS(struct runner *r, struct cell *ci, int gettimer, const int offset, const int increment); void DOSUB_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj, - int gettimer); + int gettimer, const int offset, const int increment); void DOSELF1_SUBSET_BRANCH_STARS(struct runner *r, struct cell *restrict ci, struct spart *restrict sparts, diff --git a/src/runner_main.c b/src/runner_main.c index f866b71ca73004023ca4967d2a457ecafde873b5..c63e70bdaeebdfb36ca56d283f7ca0fffd573753 100644 --- a/src/runner_main.c +++ b/src/runner_main.c @@ -301,15 +301,15 @@ void *runner_main(void *data) { else if (t->subtype == task_subtype_grav) runner_dopair_recursive_grav(r, ci, cj, 1); else if (t->subtype == task_subtype_stars_density) - runner_dopair_branch_stars_density(r, ci, cj); + runner_dopair_branch_stars_density(r, ci, cj, 0, 1); #ifdef EXTRA_STAR_LOOPS else if (t->subtype == task_subtype_stars_prep1) - runner_dopair_branch_stars_prep1(r, ci, cj); + runner_dopair_branch_stars_prep1(r, ci, cj, 0, 1); else if (t->subtype == task_subtype_stars_prep2) - runner_dopair_branch_stars_prep2(r, ci, cj); + runner_dopair_branch_stars_prep2(r, ci, cj, 0, 1); #endif else if (t->subtype == task_subtype_stars_feedback) - runner_dopair_branch_stars_feedback(r, ci, cj); + runner_dopair_branch_stars_feedback(r, ci, cj, 0, 1); else if (t->subtype == task_subtype_bh_density) runner_dopair_branch_bh_density(r, ci, cj); else if (t->subtype == task_subtype_bh_swallow) @@ -398,15 +398,15 @@ void *runner_main(void *data) { else if (t->subtype == task_subtype_limiter) runner_dosub_pair1_limiter(r, ci, cj, 1); else if (t->subtype == task_subtype_stars_density) - runner_dosub_pair_stars_density(r, ci, cj, 1); + runner_dosub_pair_stars_density(r, ci, cj, 1, 0, 1); #ifdef EXTRA_STAR_LOOPS else if (t->subtype == task_subtype_stars_prep1) - runner_dosub_pair_stars_prep1(r, ci, cj, 1); + runner_dosub_pair_stars_prep1(r, ci, cj, 1, 0, 1); else if (t->subtype == task_subtype_stars_prep2) - runner_dosub_pair_stars_prep2(r, ci, cj, 1); + runner_dosub_pair_stars_prep2(r, ci, cj, 1, 0, 1); #endif else if (t->subtype == task_subtype_stars_feedback) - runner_dosub_pair_stars_feedback(r, ci, cj, 1); + runner_dosub_pair_stars_feedback(r, ci, cj, 1, 0, 1); else if (t->subtype == task_subtype_bh_density) runner_dosub_pair_bh_density(r, ci, cj, 1); else if (t->subtype == task_subtype_bh_swallow)