diff --git a/src/runner.c b/src/runner.c index e4d2a0a82ed472161fbaa60e8eebbe177715478e..1682916c534f429c21cf4500ec33b5e9b884d0f9 100644 --- a/src/runner.c +++ b/src/runner.c @@ -60,7 +60,7 @@ /* Orientation of the cell pairs */ const double runner_shift[13][3] = { {5.773502691896258e-01, 5.773502691896258e-01, 5.773502691896258e-01}, - {7.071067811865475e-01, 7.071067811865475e-01, 0.0}, + {7.01067811865475e-01, 7.071067811865475e-01, 0.0}, {5.773502691896258e-01, 5.773502691896258e-01, -5.773502691896258e-01}, {7.071067811865475e-01, 0.0, 7.071067811865475e-01}, {1.0, 0.0, 0.0}, @@ -1063,7 +1063,7 @@ void *runner_main(void *data) { else if (t->subtype == task_subtype_force) runner_doself2_force(r, ci); else if (t->subtype == task_subtype_grav) - runner_doself_grav(r, ci); + runner_doself_grav(r, ci, 1); else error("Unknown task subtype."); break; @@ -1073,7 +1073,7 @@ void *runner_main(void *data) { else if (t->subtype == task_subtype_force) runner_dopair2_force(r, ci, cj); else if (t->subtype == task_subtype_grav) - runner_dopair_grav(r, ci, cj); + runner_dopair_grav(r, ci, cj, 1); else error("Unknown task subtype."); break; diff --git a/src/runner_doiact_grav.h b/src/runner_doiact_grav.h index 59910c135521202b03ab31599679683e8c0a1caa..ae6607ecd6f34ac9d09f19634e9dd49c2248eaa4 100644 --- a/src/runner_doiact_grav.h +++ b/src/runner_doiact_grav.h @@ -117,7 +117,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pm( runner_iact_grav_pm(rlr_inv, r2, dx, gp, &multi); } - TIMER_TOC(TIMER_DOPAIR); // MATTHIEU + TIMER_TOC(timer_dopair_grav_pm); } /** @@ -215,7 +215,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp( } } - TIMER_TOC(TIMER_DOPAIR); // MATTHIEU + TIMER_TOC(timer_dopair_grav_pp); } /** @@ -298,7 +298,7 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp( } } - TIMER_TOC(TIMER_DOSELF); // MATTHIEU + TIMER_TOC(timer_doself_grav_pp); } /** @@ -308,11 +308,12 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp( * @param r The #runner. * @param ci The first #cell. * @param cj The other #cell. + * @param gettimer Are we timing this ? * * @todo Use a local cache for the particles. */ static void runner_dopair_grav(struct runner *r, struct cell *ci, - struct cell *cj) { + struct cell *cj, int gettimer) { #ifdef SWIFT_DEBUG_CHECKS @@ -366,6 +367,8 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci, } #endif + TIMER_TIC; + /* Are both cells split ? */ if (ci->split && cj->split) { @@ -378,7 +381,7 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci, if (cell_are_neighbours(ci->progeny[j], cj->progeny[k])) { /* Recurse */ - runner_dopair_grav(r, ci->progeny[j], cj->progeny[k]); + runner_dopair_grav(r, ci->progeny[j], cj->progeny[k], 0); } else { @@ -395,9 +398,20 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci, /* Compute the interactions at this level directly. */ runner_dopair_grav_pp(r, ci, cj); } + + if (gettimer) TIMER_TOC(timer_dosub_pair_grav); } -static void runner_doself_grav(struct runner *r, struct cell *c) { +/** + * @brief Computes the interaction of all the particles in a cell + * + * @param r The #runner. + * @param c The first #cell. + * @param gettimer Are we timing this ? + * + * @todo Use a local cache for the particles. + */ +static void runner_doself_grav(struct runner *r, struct cell *c, int gettimer) { #ifdef SWIFT_DEBUG_CHECKS @@ -405,6 +419,8 @@ static void runner_doself_grav(struct runner *r, struct cell *c) { if (c->gcount == 0) error("Empty cell !"); #endif + TIMER_TIC; + /* If the cell is split, interact each progeny with itself, and with each of its siblings. */ if (c->split) { @@ -412,12 +428,12 @@ static void runner_doself_grav(struct runner *r, struct cell *c) { for (int j = 0; j < 8; j++) { if (c->progeny[j] != NULL) { - runner_doself_grav(r, c->progeny[j]); + runner_doself_grav(r, c->progeny[j], 0); for (int k = j + 1; k < 8; k++) { if (c->progeny[k] != NULL) { - runner_dopair_grav(r, c->progeny[j], c->progeny[k]); + runner_dopair_grav(r, c->progeny[j], c->progeny[k], 0); } } } @@ -429,6 +445,8 @@ static void runner_doself_grav(struct runner *r, struct cell *c) { runner_doself_grav_pp(r, c); } + + if (gettimer) TIMER_TOC(timer_dosub_self_grav); } static void runner_dosub_grav(struct runner *r, struct cell *ci, @@ -437,7 +455,7 @@ static void runner_dosub_grav(struct runner *r, struct cell *ci, /* Is this a single cell? */ if (cj == NULL) { - runner_doself_grav(r, ci); + runner_doself_grav(r, ci, 1); } else { @@ -446,7 +464,7 @@ static void runner_dosub_grav(struct runner *r, struct cell *ci, error("Non-neighbouring cells in pair task !"); #endif - runner_dopair_grav(r, ci, cj); + runner_dopair_grav(r, ci, cj, 1); } } diff --git a/src/timers.h b/src/timers.h index c48961b39737f23eb936d7283f76651d33892991..aa8455397daf1e88b709a8332e3ae63694991e94 100644 --- a/src/timers.h +++ b/src/timers.h @@ -37,10 +37,11 @@ enum { timer_dosort, timer_doself_density, timer_doself_force, - timer_doself_grav, + timer_doself_grav_pp, timer_dopair_density, timer_dopair_force, - timer_dopair_grav, + timer_dopair_grav_pm, + timer_dopair_grav_pp, timer_dograv_external, timer_dosub_self_density, timer_dosub_self_force,