Skip to content
Snippets Groups Projects
Commit ec6a47c9 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Reduce the rebuild flag accross all nodes.

parent 4a6150af
No related branches found
No related tags found
1 merge request!314Timestep order
...@@ -912,10 +912,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { ...@@ -912,10 +912,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
struct engine *e = s->space->e; struct engine *e = s->space->e;
#endif #endif
//message("unskip! c=%p c->kick1=%p c->drift=%p", c, c->kick1, c->drift); int rebuild = 0;
//task_print(c->drift);
int ret = 0;
/* Un-skip the density tasks involved with this cell. */ /* Un-skip the density tasks involved with this cell. */
for (struct link *l = c->density; l != NULL; l = l->next) { 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) { ...@@ -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 || (max(ci->h_max, cj->h_max) + ci->dx_max + cj->dx_max > cj->dmin ||
ci->dx_max > space_maxreldx * ci->h_max || ci->dx_max > space_maxreldx * ci->h_max ||
cj->dx_max > space_maxreldx * cj->h_max)) cj->dx_max > space_maxreldx * cj->h_max))
ret = 1; rebuild = 1;
#ifdef WITH_MPI #ifdef WITH_MPI
/* Activate the send/recv flags. */ /* Activate the send/recv flags. */
...@@ -1039,9 +1036,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { ...@@ -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->cooling != NULL) scheduler_activate(s, c->cooling);
if (c->sourceterms != NULL) scheduler_activate(s, c->sourceterms); if (c->sourceterms != NULL) scheduler_activate(s, c->sourceterms);
//task_print(c->drift); return rebuild;
return ret;
} }
/** /**
... ...
......
...@@ -2612,8 +2612,6 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs) { ...@@ -2612,8 +2612,6 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs) {
engine_rebuild(e); engine_rebuild(e);
// engine_prepare(e);
engine_marktasks(e); engine_marktasks(e);
/* No time integration. We just want the density and ghosts */ /* No time integration. We just want the density and ghosts */
...@@ -2726,8 +2724,6 @@ void engine_step(struct engine *e) { ...@@ -2726,8 +2724,6 @@ void engine_step(struct engine *e) {
/* Prepare the tasks to be launched. */ /* Prepare the tasks to be launched. */
engine_prepare(e); engine_prepare(e);
if (e->step == 1) e->forcerebuild = 1;
/* Print the number of active tasks ? */ /* Print the number of active tasks ? */
if (e->verbose) engine_print_task_counts(e); if (e->verbose) engine_print_task_counts(e);
...@@ -2742,6 +2738,17 @@ void engine_step(struct engine *e) { ...@@ -2742,6 +2738,17 @@ void engine_step(struct engine *e) {
engine_launch(e, e->nr_threads); engine_launch(e, e->nr_threads);
TIMER_TOC(timer_runners); 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) if (e->ti_end_min >= e->ti_nextSnapshot && e->ti_nextSnapshot > 0)
e->dump_snapshot = 1; e->dump_snapshot = 1;
...@@ -2762,7 +2769,6 @@ void engine_step(struct engine *e) { ...@@ -2762,7 +2769,6 @@ void engine_step(struct engine *e) {
message("snap=%d, rebuild=%d repart=%d", e->dump_snapshot, e->forcerebuild, message("snap=%d, rebuild=%d repart=%d", e->dump_snapshot, e->forcerebuild,
e->forcerepart); e->forcerepart);
/* Write a snapshot ? */ /* Write a snapshot ? */
if (e->dump_snapshot) { if (e->dump_snapshot) {
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment