Commit bd44fc03 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Make sure all hierarchical task timers are updated even when recursing in daughter cells

parent ae123a6e
......@@ -132,8 +132,7 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) {
if (c->split) {
for (int k = 0; k < 8; k++)
if (c->progeny[k] != NULL) runner_do_sourceterms(r, c->progeny[k], 0);
return;
}
} else {
if (count > 0) {
......@@ -144,6 +143,7 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) {
sourceterms_apply(r, sourceterms, c);
}
}
}
if (timer) TIMER_TOC(timer_dosource);
}
......@@ -173,8 +173,7 @@ void runner_do_grav_external(struct runner *r, struct cell *c, int timer) {
if (c->split) {
for (int k = 0; k < 8; k++)
if (c->progeny[k] != NULL) runner_do_grav_external(r, c->progeny[k], 0);
return;
}
} else {
#ifdef TASK_VERBOSE
OUT;
......@@ -192,6 +191,7 @@ void runner_do_grav_external(struct runner *r, struct cell *c, int timer) {
external_gravity_acceleration(time, potential, constants, gp);
}
}
}
if (timer) TIMER_TOC(timer_dograv_external);
}
......@@ -221,8 +221,7 @@ void runner_do_cooling(struct runner *r, struct cell *c, int timer) {
if (c->split) {
for (int k = 0; k < 8; k++)
if (c->progeny[k] != NULL) runner_do_cooling(r, c->progeny[k], 0);
return;
}
} else {
#ifdef TASK_VERBOSE
OUT;
......@@ -243,6 +242,7 @@ void runner_do_cooling(struct runner *r, struct cell *c, int timer) {
cooling_cool_part(constants, us, cooling_func, p, xp, dt);
}
}
}
if (timer) TIMER_TOC(timer_do_cooling);
}
......@@ -503,7 +503,6 @@ void runner_do_init(struct runner *r, struct cell *c, int timer) {
if (c->split) {
for (int k = 0; k < 8; k++)
if (c->progeny[k] != NULL) runner_do_init(r, c->progeny[k], 0);
return;
} else {
/* Loop over the parts in this cell. */
......@@ -542,8 +541,9 @@ void runner_do_init(struct runner *r, struct cell *c, int timer) {
*
* @param r The runner thread.
* @param c The cell.
* @param timer Are we timing this ?
*/
void runner_do_extra_ghost(struct runner *r, struct cell *c) {
void runner_do_extra_ghost(struct runner *r, struct cell *c, int timer) {
#ifdef EXTRA_HYDRO_LOOP
......@@ -551,14 +551,15 @@ void runner_do_extra_ghost(struct runner *r, struct cell *c) {
const int count = c->count;
const int ti_current = r->e->ti_current;
TIMER_TIC;
/* Anything to do here? */
if (c->ti_end_min > ti_current) return;
/* Recurse? */
if (c->split) {
for (int k = 0; k < 8; k++)
if (c->progeny[k] != NULL) runner_do_extra_ghost(r, c->progeny[k]);
return;
if (c->progeny[k] != NULL) runner_do_extra_ghost(r, c->progeny[k], 0);
} else {
/* Loop over the parts in this cell. */
......@@ -575,6 +576,8 @@ void runner_do_extra_ghost(struct runner *r, struct cell *c) {
}
}
if (timer) TIMER_TOC(timer_do_extra_ghost);
#else
error("SWIFT was not compiled with the extra hydro loop activated.");
#endif
......@@ -586,8 +589,9 @@ void runner_do_extra_ghost(struct runner *r, struct cell *c) {
*
* @param r The runner thread.
* @param c The cell.
* @param timer Are we timing this ?
*/
void runner_do_ghost(struct runner *r, struct cell *c) {
void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
struct part *restrict parts = c->parts;
struct xpart *restrict xparts = c->xparts;
......@@ -610,9 +614,8 @@ void runner_do_ghost(struct runner *r, struct cell *c) {
/* Recurse? */
if (c->split) {
for (int k = 0; k < 8; k++)
if (c->progeny[k] != NULL) runner_do_ghost(r, c->progeny[k]);
return;
}
if (c->progeny[k] != NULL) runner_do_ghost(r, c->progeny[k], 0);
} else {
/* Init the IDs that have to be updated. */
int *pid = NULL;
......@@ -655,7 +658,8 @@ void runner_do_ghost(struct runner *r, struct cell *c) {
}
/* Did we get the right number density? */
if (p->density.wcount > max_wcount || p->density.wcount < min_wcount) {
if (p->density.wcount > max_wcount ||
p->density.wcount < min_wcount) {
/* Ok, correct then */
p->h += h_corr;
......@@ -718,8 +722,8 @@ void runner_do_ghost(struct runner *r, struct cell *c) {
/* Otherwise, sub-self interaction? */
else if (l->t->type == task_type_sub_self)
runner_dosub_subset_density(r, finger, parts, pid, count, NULL, -1,
1);
runner_dosub_subset_density(r, finger, parts, pid, count, NULL,
-1, 1);
/* Otherwise, sub-pair interaction? */
else if (l->t->type == task_type_sub_pair) {
......@@ -742,8 +746,9 @@ void runner_do_ghost(struct runner *r, struct cell *c) {
/* Be clean */
free(pid);
}
TIMER_TOC(timer_do_ghost);
if (timer) TIMER_TOC(timer_do_ghost);
}
/**
......@@ -1224,11 +1229,11 @@ void *runner_main(void *data) {
runner_do_init(r, ci, 1);
break;
case task_type_ghost:
runner_do_ghost(r, ci);
runner_do_ghost(r, ci, 1);
break;
#ifdef EXTRA_HYDRO_LOOP
case task_type_extra_ghost:
runner_do_extra_ghost(r, ci);
runner_do_extra_ghost(r, ci, 1);
break;
#endif
case task_type_kick:
......
......@@ -48,11 +48,13 @@ struct runner {
};
/* Function prototypes. */
void runner_do_ghost(struct runner *r, struct cell *c);
void runner_do_ghost(struct runner *r, struct cell *c, int timer);
void runner_do_extra_ghost(struct runner *r, struct cell *c, int timer);
void runner_do_sort(struct runner *r, struct cell *c, int flag, int clock);
void runner_do_kick(struct runner *r, struct cell *c, int timer);
void runner_do_init(struct runner *r, struct cell *c, int timer);
void runner_do_cooling(struct runner *r, struct cell *c, int timer);
void runner_do_grav_external(struct runner *r, struct cell *c, int timer);
void *runner_main(void *data);
void runner_do_drift_mapper(void *map_data, int num_elements, void *extra_data);
......
......@@ -56,6 +56,7 @@ enum {
timer_dosub_pair_grav,
timer_dopair_subset,
timer_do_ghost,
timer_do_extra_ghost,
timer_dorecv_cell,
timer_gettask,
timer_qget,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment