diff --git a/src/cell.c b/src/cell.c index 11ecce083f7b2c82f3997fce349ddd33ff9441ce..03a23ed562b387d113bc68c0033979ec8578403a 100644 --- a/src/cell.c +++ b/src/cell.c @@ -1930,9 +1930,6 @@ 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; @@ -1941,9 +1938,6 @@ 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)) { @@ -2079,9 +2073,6 @@ 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) { @@ -2093,59 +2084,57 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { } } - if(t->type == task_type_pair) { + if (t->type == task_type_pair) { #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); - + /* 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); + + /* 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 } @@ -2167,8 +2156,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 2d133193d891427dc284e25ad827898088d85cfe..c07e1094a4810720042436fe9268ed615946896b 100644 --- a/src/engine.c +++ b/src/engine.c @@ -446,8 +446,8 @@ void engine_redistribute(struct engine *e) { #ifdef WITH_MPI - message("\n REDISTRIBUTE!!! \n"); - + message("\n REDISTRIBUTE!!! \n"); + const int nr_nodes = e->nr_nodes; const int nodeID = e->nodeID; struct space *s = e->s; @@ -2887,7 +2887,7 @@ void engine_maketasks(struct engine *e) { error("We have particles but no hydro or gravity tasks were created."); /* Split the tasks. */ - //scheduler_splittasks(sched); + // scheduler_splittasks(sched); /* Free the old list of cell-task links. */ if (e->links != NULL) free(e->links); @@ -3262,7 +3262,7 @@ 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 ){ //|| + else if (t->type == task_type_grav_top_level) { //|| // t->type == task_type_grav_ghost) { scheduler_activate(s, t); } @@ -3323,7 +3323,7 @@ void engine_print_task_counts(struct engine *e) { int count_recv_ti = 0; int count_send_gpart = 0; int count_recv_gpart = 0; - + /* Count and print the number of each task type. */ int counts[task_type_count + 1]; for (int k = 0; k <= task_type_count; k++) counts[k] = 0; @@ -3333,14 +3333,18 @@ void engine_print_task_counts(struct engine *e) { else { counts[(int)tasks[k].type] += 1; - if(tasks[k].type == task_type_send && tasks[k].subtype == task_subtype_tend) - count_send_ti++; - if(tasks[k].type == task_type_recv && tasks[k].subtype == task_subtype_tend) - count_recv_ti++; - if(tasks[k].type == task_type_send && tasks[k].subtype == task_subtype_gpart) - count_send_gpart++; - if(tasks[k].type == task_type_recv && tasks[k].subtype == task_subtype_gpart) - count_recv_gpart++; + if (tasks[k].type == task_type_send && + tasks[k].subtype == task_subtype_tend) + count_send_ti++; + if (tasks[k].type == task_type_recv && + tasks[k].subtype == task_subtype_tend) + count_recv_ti++; + if (tasks[k].type == task_type_send && + tasks[k].subtype == task_subtype_gpart) + count_send_gpart++; + if (tasks[k].type == task_type_recv && + tasks[k].subtype == task_subtype_gpart) + count_recv_gpart++; } } message("Total = %d (per cell = %d)", nr_tasks, @@ -3356,12 +3360,12 @@ void engine_print_task_counts(struct engine *e) { printf(" %s=%i", taskID_names[k], counts[k]); printf(" skipped=%i ]\n", counts[task_type_count]); fflush(stdout); - //message("nr_parts = %zu.", e->s->nr_parts); - //message("nr_gparts = %zu.", e->s->nr_gparts); - //message("nr_sparts = %zu.", e->s->nr_sparts); - message("send_ti=%d, recv_ti=%d, send_gpart=%d, recv_gpart=%d", - count_send_ti, count_recv_ti, count_send_gpart, count_recv_gpart); - + // message("nr_parts = %zu.", e->s->nr_parts); + // message("nr_gparts = %zu.", e->s->nr_gparts); + // message("nr_sparts = %zu.", e->s->nr_sparts); + message("send_ti=%d, recv_ti=%d, send_gpart=%d, recv_gpart=%d", count_send_ti, + count_recv_ti, count_send_gpart, count_recv_gpart); + if (e->verbose) message("took %.3f %s.", clocks_from_ticks(getticks() - tic), clocks_getunit()); @@ -3568,12 +3572,12 @@ void engine_prepare(struct engine *e) { /* Unskip active tasks and check for rebuild */ engine_unskip(e); - //engine_marktasks(e); + // engine_marktasks(e); space_print_cells(e->s); // engine_print_task_counts(e); - + /* Re-rank the tasks every now and then. */ if (e->tasks_age % engine_tasksreweight == 1) { scheduler_reweight(&e->sched, e->verbose); @@ -4163,8 +4167,8 @@ void engine_step(struct engine *e) { e->timeStep = (e->ti_current - e->ti_old) * e->timeBase; e->step_props = engine_step_prop_none; - //space_print_cells(e->s); - //message("nr cells: %d %d", e->s->nr_cells, e->s->tot_cells); + // space_print_cells(e->s); + // message("nr cells: %d %d", e->s->nr_cells, e->s->tot_cells); message("ti_current=%lld ti_old=%lld", e->ti_current, e->ti_old); /* Prepare the tasks to be launched, rebuild or repartition if needed. */ @@ -4218,7 +4222,7 @@ void engine_step(struct engine *e) { engine_launch(e); TIMER_TOC(timer_runners); - //error("done"); +// error("done"); #ifdef SWIFT_GRAVITY_FORCE_CHECKS /* Check the accuracy of the gravity calculation */ if (e->policy & engine_policy_self_gravity) @@ -4310,7 +4314,7 @@ 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, + // 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 */ @@ -4345,7 +4349,7 @@ void engine_do_drift_all_mapper(void *map_data, int num_elements, /* Drift all the g-particles */ cell_drift_gpart(c, e, 1); } - + /* Drift the multipoles */ if (e->policy & engine_policy_self_gravity) { cell_drift_all_multipoles(c, e); diff --git a/src/gravity/Default/gravity.h b/src/gravity/Default/gravity.h index 031b4b2d303dd2bd5acbc778112672cc03a918e2..34e10e8896cdc3de4a288e194dca2d75bc30a854 100644 --- a/src/gravity/Default/gravity.h +++ b/src/gravity/Default/gravity.h @@ -80,12 +80,6 @@ gravity_compute_timestep_self(const struct gpart* const gp, /* Note that 0.66666667 = 2. (from Gadget) / 3. (Plummer softening) */ float dt = sqrtf(0.66666667f * grav_props->eta * epsilon * ac_inv); - if(gp->id_or_neg_offset == 1) { - dt /= 1000.; - message("lower dt %e", dt); - - } - return dt; } diff --git a/src/runner.c b/src/runner.c index ba626c771397ac6794770d2cfa0cf4668fa68589..c6689874baf54de8e5c449282b5a8ddc04bee11d 100644 --- a/src/runner.c +++ b/src/runner.c @@ -840,9 +840,6 @@ 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; @@ -877,7 +874,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/space.c b/src/space.c index bac20276d9b46123aa0da5b57ffd5e9b0f56ec7d..5753ccbf9f7f42e6ca150d185c244b88fa13e902 100644 --- a/src/space.c +++ b/src/space.c @@ -539,7 +539,7 @@ void space_rebuild(struct space *s, int verbose) { #endif message("\n REBUILD!!! \n"); - + /* Re-grid if necessary, or just re-set the cell data. */ space_regrid(s, verbose); @@ -3175,7 +3175,7 @@ void space_print_cells(const struct space *s) { FILE *file = fopen(filename, "w"); fprintf(file, "ti_current=%lld\n", s->e->ti_current); - + for (int k = 0; k < s->cdim[2]; ++k) { fprintf(file, "\n -- k=%d -- \n\n", k); @@ -3187,7 +3187,10 @@ 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-%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)); + 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");