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

Reduce the rebuild flag accross all nodes.

parent 4a6150af
......@@ -912,10 +912,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
struct engine *e = s->space->e;
#endif
//message("unskip! c=%p c->kick1=%p c->drift=%p", c, c->kick1, c->drift);
//task_print(c->drift);
int ret = 0;
int rebuild = 0;
/* Un-skip the density tasks involved with this cell. */
for (struct link *l = c->density; l != NULL; l = l->next) {
......@@ -942,7 +939,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
(max(ci->h_max, cj->h_max) + ci->dx_max + cj->dx_max > cj->dmin ||
ci->dx_max > space_maxreldx * ci->h_max ||
cj->dx_max > space_maxreldx * cj->h_max))
ret = 1;
rebuild = 1;
#ifdef WITH_MPI
/* Activate the send/recv flags. */
......@@ -1039,9 +1036,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
if (c->cooling != NULL) scheduler_activate(s, c->cooling);
if (c->sourceterms != NULL) scheduler_activate(s, c->sourceterms);
//task_print(c->drift);
return ret;
return rebuild;
}
/**
......
......@@ -2612,8 +2612,6 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs) {
engine_rebuild(e);
// engine_prepare(e);
engine_marktasks(e);
/* No time integration. We just want the density and ghosts */
......@@ -2726,8 +2724,6 @@ void engine_step(struct engine *e) {
/* Prepare the tasks to be launched. */
engine_prepare(e);
if (e->step == 1) e->forcerebuild = 1;
/* Print the number of active tasks ? */
if (e->verbose) engine_print_task_counts(e);
......@@ -2742,6 +2738,17 @@ void engine_step(struct engine *e) {
engine_launch(e, e->nr_threads);
TIMER_TOC(timer_runners);
/* Collect the values of rebuild from all nodes. */
#ifdef WITH_MPI
int buff = 0;
if (MPI_Allreduce(&e->forcerebuild, &buff, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD) !=
MPI_SUCCESS)
error("Failed to aggregate the rebuild flag across nodes.");
e->forcerebuild = buff;
#endif
/* Do we want a snapshot? */
if (e->ti_end_min >= e->ti_nextSnapshot && e->ti_nextSnapshot > 0)
e->dump_snapshot = 1;
......@@ -2762,7 +2769,6 @@ void engine_step(struct engine *e) {
message("snap=%d, rebuild=%d repart=%d", e->dump_snapshot, e->forcerebuild,
e->forcerepart);
/* Write a snapshot ? */
if (e->dump_snapshot) {
......
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