diff --git a/examples/UniformDMBox/uniformBox.yml b/examples/UniformDMBox/uniformBox.yml index 51b78db743f76a7b131b98e07a93179fdf22209a..1abb256671f1cc8c87daa711bd63f7ea6abdbbab 100644 --- a/examples/UniformDMBox/uniformBox.yml +++ b/examples/UniformDMBox/uniformBox.yml @@ -21,7 +21,7 @@ Scheduler: Snapshots: basename: uniformDMBox # Common part of the name of output files time_first: 0. # Time of the first output (in internal units) - delta_time: 0.01 # Time difference between consecutive outputs (in internal units) + delta_time: 10. # Time difference between consecutive outputs (in internal units) # Parameters for the self-gravity scheme Gravity: @@ -31,7 +31,7 @@ Gravity: # Parameters governing the conserved quantities statistics Statistics: - delta_time: 1e-2 # Time between statistics output + delta_time: 5. # Time between statistics output # Parameters related to the initial conditions InitialConditions: diff --git a/src/cell.c b/src/cell.c index 308b552cfaa67137aa76f9da3fa34879cbe60c27..3b0570f2abe9283032f32356812f4936a4f0b828 100644 --- a/src/cell.c +++ b/src/cell.c @@ -1928,6 +1928,9 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { const int nodeID = e->nodeID; int rebuild = 0; + if(c->loc[0] == 0. && c->loc[1] == 0. && c->loc[2] == 0.) + message("Found me! active=%d gcount=%d split=%d", cell_is_active(c, e), c->gcount, c->split); + /* Un-skip the density tasks involved with this cell. */ for (struct link *l = c->density; l != NULL; l = l->next) { struct task *t = l->t; @@ -1936,6 +1939,9 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { const int ci_active = cell_is_active(ci, e); const int cj_active = (cj != NULL) ? cell_is_active(cj, e) : 0; + if(c->loc[0] == 0. && c->loc[1] == 0. && c->loc[2] == 0.) + message("oO"); + /* Only activate tasks that involve a local active cell. */ if ((ci_active && ci->nodeID == nodeID) || (cj_active && cj->nodeID == nodeID)) { @@ -2071,6 +2077,9 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { (cj_active && cj->nodeID == engine_rank)) { scheduler_activate(s, t); + /* if(c->loc[0] == 0. && c->loc[1] == 0. && c->loc[2] == 0.) */ + /* message("grav task found!"); */ + /* Set the drifting flags */ if (t->type == task_type_self && t->subtype == task_subtype_external_grav) { @@ -2079,61 +2088,64 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { cell_activate_subcell_grav_tasks(t->ci, NULL, s); } else if (t->type == task_type_pair) { cell_activate_subcell_grav_tasks(t->ci, t->cj, s); + } + } -#ifdef WITH_MPI - /* Activate the send/recv tasks. */ - if (ci->nodeID != engine_rank) { - - /* /\* If the local cell is active, receive data from the foreign cell. *\/ */ - /* if (cj_active) { */ - scheduler_activate(s, ci->recv_grav); - /* } */ - - /* /\* If the foreign cell is active, we want its ti_end values. *\/ */ - /* if (ci_active) */scheduler_activate(s, ci->recv_ti); - - /* /\* Is the foreign cell active and will need stuff from us? *\/ */ - /* if (ci_active) { */ - - scheduler_activate_send(s, cj->send_grav, ci->nodeID); - - /* /\* Drift the cell which will be sent at the level at which it is */ - /* sent, i.e. drift the cell specified in the send task (l->t) */ - /* itself. *\/ */ - cell_activate_drift_gpart(cj, s); - /* } */ - - /* /\* If the local cell is active, send its ti_end values. *\/ */ - /* if (cj_active) */scheduler_activate_send(s, cj->send_ti, ci->nodeID); - - } else if (cj->nodeID != engine_rank) { - - /* /\* If the local cell is active, receive data from the foreign cell. *\/ */ - /* if (ci_active) { */ - scheduler_activate(s, cj->recv_grav); - /* } */ - - /* /\* If the foreign cell is active, we want its ti_end values. *\/ */ - /* if (cj_active) */ - scheduler_activate(s, cj->recv_ti); - - /* /\* Is the foreign cell active and will need stuff from us? *\/ */ - /* if (cj_active) { */ - - scheduler_activate_send(s, ci->send_grav, cj->nodeID); - - /* /\* Drift the cell which will be sent at the level at which it is */ - /* sent, i.e. drift the cell specified in the send task (l->t) */ - /* itself. *\/ */ - cell_activate_drift_gpart(ci, s); - /* } */ + if(t->type == task_type_pair) { - /* /\* If the local cell is active, send its ti_end values. *\/ */ - /* if (ci_active) */ - scheduler_activate_send(s, ci->send_ti, cj->nodeID); - } -#endif +#ifdef WITH_MPI + /* Activate the send/recv tasks. */ + if (ci->nodeID != engine_rank) { + + /* If the local cell is active, receive data from the foreign cell. */ + if (cj_active) { + scheduler_activate(s, ci->recv_grav); + } + + /* If the foreign cell is active, we want its ti_end values. */ + if (ci_active)scheduler_activate(s, ci->recv_ti); + + /* Is the foreign cell active and will need stuff from us? */ + if (ci_active) { + + scheduler_activate_send(s, cj->send_grav, ci->nodeID); + + /* Drift the cell which will be sent at the level at which it is + sent, i.e. drift the cell specified in the send task (l->t) + itself. */ + cell_activate_drift_gpart(cj, s); + } + + /* If the local cell is active, send its ti_end values. */ + if (cj_active)scheduler_activate_send(s, cj->send_ti, ci->nodeID); + + } else if (cj->nodeID != engine_rank) { + + /* If the local cell is active, receive data from the foreign cell. */ + if (ci_active) { + scheduler_activate(s, cj->recv_grav); + } + + /* If the foreign cell is active, we want its ti_end values. */ + if (cj_active) + scheduler_activate(s, cj->recv_ti); + + /* Is the foreign cell active and will need stuff from us? */ + if (cj_active) { + + scheduler_activate_send(s, ci->send_grav, cj->nodeID); + + /* Drift the cell which will be sent at the level at which it is + sent, i.e. drift the cell specified in the send task (l->t) + itself. */ + cell_activate_drift_gpart(ci, s); + } + + /* If the local cell is active, send its ti_end values. */ + if (ci_active) + scheduler_activate_send(s, ci->send_ti, cj->nodeID); } +#endif } } @@ -2153,8 +2165,8 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { if (c->kick1 != NULL) scheduler_activate(s, c->kick1); if (c->kick2 != NULL) scheduler_activate(s, c->kick2); if (c->timestep != NULL) scheduler_activate(s, c->timestep); - if (c->grav_ghost[0] != NULL) scheduler_activate(s, c->grav_ghost[0]); - if (c->grav_ghost[1] != NULL) scheduler_activate(s, c->grav_ghost[1]); + //if (c->grav_ghost[0] != NULL) scheduler_activate(s, c->grav_ghost[0]); + //if (c->grav_ghost[1] != NULL) scheduler_activate(s, c->grav_ghost[1]); if (c->grav_down != NULL) scheduler_activate(s, c->grav_down); if (c->grav_long_range != NULL) scheduler_activate(s, c->grav_long_range); if (c->cooling != NULL) scheduler_activate(s, c->cooling); diff --git a/src/engine.c b/src/engine.c index 89ddd2d7ca2b363231bcd14805a1cf922834fb88..1c4f53c86ae6a7e7fc25df75b9da1edde64fb768 100644 --- a/src/engine.c +++ b/src/engine.c @@ -3262,8 +3262,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements, } /* Periodic gravity stuff (Note this is not linked to a cell) ? */ - else if (t->type == task_type_grav_top_level || - t->type == task_type_grav_ghost) { + else if (t->type == task_type_grav_top_level ){ //|| + // t->type == task_type_grav_ghost) { scheduler_activate(s, t); } @@ -3566,11 +3566,13 @@ void engine_prepare(struct engine *e) { message("Rebuild done"); + /* Unskip active tasks and check for rebuild */ + engine_unskip(e); + //engine_marktasks(e); + space_print_cells(e->s); - /* Unskip active tasks and check for rebuild */ - //engine_unskip(e); - engine_marktasks(e); + // engine_print_task_counts(e); /* Re-rank the tasks every now and then. */ if (e->tasks_age % engine_tasksreweight == 1) { @@ -4216,6 +4218,7 @@ void engine_step(struct engine *e) { engine_launch(e); TIMER_TOC(timer_runners); + //error("done"); #ifdef SWIFT_GRAVITY_FORCE_CHECKS /* Check the accuracy of the gravity calculation */ if (e->policy & engine_policy_self_gravity) @@ -4307,6 +4310,8 @@ void engine_unskip(struct engine *e) { /* Activate all the regular tasks */ threadpool_map(&e->threadpool, runner_do_unskip_mapper, e->s->local_cells_top, e->s->nr_local_cells, sizeof(int), 1, e); + //threadpool_map(&e->threadpool, runner_do_unskip_mapper, e->s->cells_top, + // e->s->nr_cells, sizeof(int), 1, e); /* And the top level gravity FFT one */ if (e->s->periodic && (e->policy & engine_policy_self_gravity)) diff --git a/src/runner.c b/src/runner.c index c6689874baf54de8e5c449282b5a8ddc04bee11d..ba626c771397ac6794770d2cfa0cf4668fa68589 100644 --- a/src/runner.c +++ b/src/runner.c @@ -840,6 +840,9 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { */ static void runner_do_unskip(struct cell *c, struct engine *e) { + if(c->loc[0] == 0. && c->loc[1] == 0. && c->loc[2] == 0.) + message("Found me! active=%d gcount=%d split=%d", cell_is_active(c, e), c->gcount, c->split); + /* Ignore empty cells. */ if (c->count == 0 && c->gcount == 0) return; @@ -874,7 +877,7 @@ void runner_do_unskip_mapper(void *map_data, int num_elements, struct engine *e = (struct engine *)extra_data; struct space *s = e->s; int *local_cells = (int *)map_data; - + for (int ind = 0; ind < num_elements; ind++) { struct cell *c = &s->cells_top[local_cells[ind]]; if (c != NULL) runner_do_unskip(c, e); diff --git a/src/runner_doiact_fft.c b/src/runner_doiact_fft.c index 945bbb9d892ebe0768cc5cf7b466dcd0192aefed..ab5a35d92d968bb6e926046ed6b49ca2a248ac2c 100644 --- a/src/runner_doiact_fft.c +++ b/src/runner_doiact_fft.c @@ -163,6 +163,8 @@ void runner_do_grav_fft(struct runner* r, int timer) { #ifdef HAVE_FFTW + message("doing FFT"); + const struct engine* e = r->e; const struct space* s = e->s; const integertime_t ti_current = e->ti_current; diff --git a/src/space.c b/src/space.c index 8b1c1be1dd2107d20624f74d062ba8bd5501f109..bac20276d9b46123aa0da5b57ffd5e9b0f56ec7d 100644 --- a/src/space.c +++ b/src/space.c @@ -3187,7 +3187,7 @@ void space_print_cells(const struct space *s) { const int cid = cell_getid(s->cdim, i, j, k); const struct cell *c = &s->cells_top[cid]; - fprintf(file, "|(%d-%lld-%d-%d-%d)", c->nodeID, c->ti_end_min, c->gcount, (c->recv_grav!=NULL), (c->send_grav != NULL)); + fprintf(file, "|(%d-%lld-%d-%d%d-%d)", c->nodeID, c->ti_end_min, c->gcount, (c->recv_grav!=NULL), (c->recv_grav != NULL ? c->recv_grav->skip==0 : 0), (c->send_grav != NULL)); #endif } fprintf(file, "|\n");