diff --git a/examples/main.c b/examples/main.c index afe8265c623861be449903afdc683b5706cc3cac..631117148addd3ab7ad49ed2760855b793757870 100644 --- a/examples/main.c +++ b/examples/main.c @@ -616,7 +616,7 @@ int main(int argc, char *argv[]) { clocks_getunit()); /* File for the timers */ - if (with_verbose_timers) timers_open_file(); + if (with_verbose_timers) timers_open_file(myrank); /* Main simulation loop */ for (int j = 0; !engine_is_done(&e) && e.step - 1 != nsteps; j++) { diff --git a/src/runner.c b/src/runner.c index 854b002213fa7ab3692fe6442170c947bb54a4ee..778eb0c7c6a11770dbe60a858ec9bcbc2c78c2d0 100644 --- a/src/runner.c +++ b/src/runner.c @@ -1450,7 +1450,8 @@ void runner_do_end_force(struct runner *r, struct cell *c, int timer) { * @param clear_sorts Should we clear the sort flag and hence trigger a sort ? * @param timer Are we timing this ? */ -void runner_do_recv_part(struct runner *r, struct cell *c, int clear_sorts, int timer) { +void runner_do_recv_part(struct runner *r, struct cell *c, int clear_sorts, + int timer) { #ifdef WITH_MPI @@ -1467,8 +1468,7 @@ void runner_do_recv_part(struct runner *r, struct cell *c, int clear_sorts, int float h_max = 0.f; /* Clear this cell's sorted mask. */ - if(clear_sorts) - c->sorted = 0; + if (clear_sorts) c->sorted = 0; /* If this cell is a leaf, collect the particle data. */ if (!c->split) { @@ -1876,8 +1876,8 @@ void *runner_main(void *data) { free(t->buff); } else if (t->subtype == task_subtype_xv) { runner_do_recv_part(r, ci, 1, 1); - } else if (t->subtype == task_subtype_rho) { - runner_do_recv_part(r, ci, 0, 1); + } else if (t->subtype == task_subtype_rho) { + runner_do_recv_part(r, ci, 1, 1); } else if (t->subtype == task_subtype_gpart) { runner_do_recv_gpart(r, ci, 1); } else if (t->subtype == task_subtype_spart) { diff --git a/src/runner_doiact.h b/src/runner_doiact.h index 37684940e1d3e4dc038c4924ac8e062bfff680eb..36d287c32798f749eeab90db73289deb8b21f906 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -1187,7 +1187,7 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { error("particle shift diff exceeds dx_max_sort."); } #endif /* SWIFT_DEBUG_CHECKS */ - + /* Get some other useful values. */ const double hi_max = ci->h_max * kernel_gamma - rshift; const double hj_max = cj->h_max * kernel_gamma; diff --git a/src/timers.c b/src/timers.c index 153f782da4328321cd2c1a2e9bf3429fb101b400..aa42eee14fc0df3edd5a18340c092b8eea2ffac1 100644 --- a/src/timers.c +++ b/src/timers.c @@ -123,10 +123,14 @@ void timers_print(int step) { /** * @brief Opens the file to contain the timers info and print a header + * + * @param rank The MPI rank of the file. */ -void timers_open_file() { +void timers_open_file(int rank) { - timers_file = fopen("timers.txt", "w"); + char buff[100]; + sprintf(buff, "timers_%d.txt", rank); + timers_file = fopen(buff, "w"); fprintf(timers_file, "# timers: \n# step | "); for (int k = 0; k < timer_count; k++) diff --git a/src/timers.h b/src/timers.h index 23ae61b83fbe21e650cc592c0cf30445cb85b08f..08e983a947bc57d9dcc7a432df92c2a4b0a1f7d7 100644 --- a/src/timers.h +++ b/src/timers.h @@ -118,7 +118,7 @@ INLINE static ticks timers_toc(unsigned int t, ticks tic) { /* Function prototypes. */ void timers_reset_all(); void timers_reset(unsigned long long mask); -void timers_open_file(); +void timers_open_file(int rank); void timers_close_file(); void timers_print(int step);