diff --git a/examples/main.c b/examples/main.c index 09311efb4c5cb9acc4a64648499863ca3ad70a34..0bb4d03d8e0feb9f5b61adf643741a8974bd9320 100644 --- a/examples/main.c +++ b/examples/main.c @@ -333,7 +333,7 @@ int main(int argc, char *argv[]) { MPI_Bcast(params, sizeof(struct swift_params), MPI_BYTE, 0, MPI_COMM_WORLD); #endif -/* Prepare the domain decomposition scheme */ + /* Prepare the domain decomposition scheme */ enum repartition_type reparttype = REPART_NONE; #ifdef WITH_MPI struct partition initial_partition; @@ -507,8 +507,8 @@ int main(int argc, char *argv[]) { if (myrank == 0) clocks_gettime(&tic); struct engine e; engine_init(&e, &s, params, nr_nodes, myrank, nr_threads, with_aff, - engine_policies, talking, reparttype, &us, &prog_const, &hydro_properties, - &potential, &cooling_func, &sourceterms); + engine_policies, talking, reparttype, &us, &prog_const, + &hydro_properties, &potential, &cooling_func, &sourceterms); if (myrank == 0) { clocks_gettime(&toc); message("engine_init took %.3f %s.", clocks_diff(&tic, &toc), diff --git a/src/cell.c b/src/cell.c index 2289fe043749d97d1eb06b6999fad839640b495c..b32ad7c38c892a74d5eddcaa43fbef0a0ef32d58 100644 --- a/src/cell.c +++ b/src/cell.c @@ -936,7 +936,7 @@ void cell_clean_links(struct cell *c, void *data) { /** * @brief Checks that a cell is at the current point in time * - * Calls error() if the cell is not at the current time. + * Calls error() if the cell is not at the current time. * * @param c Cell to act upon * @param data The current time on the integer time-line @@ -948,21 +948,26 @@ void cell_check_drift_point(struct cell *c, void *data) { const integertime_t ti_drift = *(integertime_t *)data; /* Only check local cells */ - if(c->nodeID != engine_rank) return; + if (c->nodeID != engine_rank) return; if (c->ti_old != ti_drift) error("Cell in an incorrect time-zone! c->ti_old=%lld ti_drift=%lld", c->ti_old, ti_drift); - for(int i=0; i<c->count; ++i) - if(c->parts[i].ti_drift != ti_drift) + for (int i = 0; i < c->count; ++i) + if (c->parts[i].ti_drift != ti_drift) error("part in an incorrect time-zone! p->ti_drift=%lld ti_drift=%lld", - c->parts[i].ti_drift, ti_drift); + c->parts[i].ti_drift, ti_drift); - for(int i=0; i<c->gcount; ++i) - if(c->gparts[i].ti_drift != ti_drift) + for (int i = 0; i < c->gcount; ++i) + if (c->gparts[i].ti_drift != ti_drift) error("g-part in an incorrect time-zone! gp->ti_drift=%lld ti_drift=%lld", - c->gparts[i].ti_drift, ti_drift); + c->gparts[i].ti_drift, ti_drift); + + for (int i = 0; i < c->scount; ++i) + if (c->sparts[i].ti_drift != ti_drift) + error("s-part in an incorrect time-zone! sp->ti_drift=%lld ti_drift=%lld", + c->sparts[i].ti_drift, ti_drift); #else error("Calling debugging code without debugging flag activated."); #endif diff --git a/src/engine.c b/src/engine.c index 5336279ae01e076743398f85c16aff9e94b0f53e..b84430e1eb1162342ba6ba5919102ae0ed57e49d 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2506,8 +2506,6 @@ int engine_marktasks(struct engine *e) { const ticks tic = getticks(); int rebuild_space = 0; - message("marktasks"); - /* Run through the tasks and mark as skip or not. */ size_t extra_data[3] = {(size_t)e, rebuild_space, (size_t)&e->sched}; threadpool_map(&e->threadpool, engine_marktasks_mapper, s->tasks, s->nr_tasks, @@ -2575,12 +2573,6 @@ void engine_rebuild(struct engine *e) { /* Clear the forcerebuild flag, whatever it was. */ e->forcerebuild = 0; - message("rebuild"); fflush(stdout); - -#ifdef WITH_MPI - MPI_Barrier(MPI_COMM_WORLD); -#endif - /* Re-build the space. */ space_rebuild(e->s, e->verbose); @@ -2599,8 +2591,8 @@ void engine_rebuild(struct engine *e) { if (engine_marktasks(e)) error("engine_marktasks failed after space_rebuild."); - /* Print the status of the system */ - // if (e->verbose) engine_print_task_counts(e); +/* Print the status of the system */ +// if (e->verbose) engine_print_task_counts(e); #ifdef SWIFT_DEBUG_CHECKS /* Check that all cells have been drifted to the current time. @@ -2624,14 +2616,14 @@ void engine_prepare(struct engine *e) { TIMER_TIC; #ifdef SWIFT_DEBUG_CHECKS - if(e->forcerepart || e->forcerebuild) { + if (e->forcerepart || e->forcerebuild) { /* Check that all cells have been drifted to the current time. * That can include cells that have not * previously been active on this rank. */ space_check_drift_point(e->s, e->ti_old); #endif } - + /* Do we need repartitioning ? */ if (e->forcerepart) engine_repartition(e); @@ -3030,9 +3022,6 @@ void engine_step(struct engine *e) { e->tic_step = getticks(); - message("START snap=%d, rebuild=%d repart=%d", e->dump_snapshot, e->forcerebuild, - e->forcerepart); - /* Move forward in time */ e->ti_old = e->ti_current; e->ti_current = e->ti_end_min; @@ -3044,7 +3033,7 @@ void engine_step(struct engine *e) { if (e->nodeID == 0) { /* Print some information to the screen */ - printf(" %6d %lld %14e %14e %10zu %10zu %10zu %21.3f\n", e->step, e->ti_current, e->time, + printf(" %6d %14e %14e %10zu %10zu %10zu %21.3f\n", e->step, e->time, e->timeStep, e->updates, e->g_updates, e->s_updates, e->wallclock_time); fflush(stdout); @@ -3058,7 +3047,7 @@ void engine_step(struct engine *e) { /* Prepare the tasks to be launched, rebuild or repartition if needed. */ engine_prepare(e); - /* Repartition the space amongst the nodes? */ +/* Repartition the space amongst the nodes? */ #ifdef WITH_MPI if (e->step % 100 == 2) e->forcerepart = 1; #endif @@ -3086,9 +3075,6 @@ void engine_step(struct engine *e) { e->forcerebuild = buff; #endif - message("MIDDLE snap=%d, rebuild=%d repart=%d ti_current=%lld", e->dump_snapshot, e->forcerebuild, - e->forcerepart, e->ti_current); - /* Do we want a snapshot? */ if (e->ti_end_min >= e->ti_nextSnapshot && e->ti_nextSnapshot > 0) e->dump_snapshot = 1; @@ -3098,9 +3084,6 @@ void engine_step(struct engine *e) { if (e->dump_snapshot || e->forcerebuild || e->forcerepart) engine_drift_all(e); - message("END snap=%d, rebuild=%d repart=%d", e->dump_snapshot, e->forcerebuild, - e->forcerepart); - /* Write a snapshot ? */ if (e->dump_snapshot) { @@ -3136,8 +3119,6 @@ int engine_is_done(struct engine *e) { */ void engine_unskip(struct engine *e) { - message("unskip"); - const ticks tic = getticks(); threadpool_map(&e->threadpool, runner_do_unskip_mapper, e->s->cells_top, e->s->nr_cells, sizeof(struct cell), 1, e); @@ -3154,8 +3135,6 @@ void engine_unskip(struct engine *e) { */ void engine_drift_all(struct engine *e) { - message("drift all"); - const ticks tic = getticks(); threadpool_map(&e->threadpool, runner_do_drift_mapper, e->s->cells_top, e->s->nr_cells, sizeof(struct cell), 1, e); @@ -3383,8 +3362,6 @@ void engine_dump_snapshot(struct engine *e) { if (e->verbose) message("writing snapshot at t=%e.", e->time); - message("dump"); - /* Dump... */ #if defined(WITH_MPI) #if defined(HAVE_PARALLEL_HDF5) @@ -3477,6 +3454,7 @@ void engine_unpin() { * @param with_aff use processor affinity, if supported. * @param policy The queuing policy to use. * @param verbose Is this #engine talkative ? + * @param reparttype What type of repartition algorithm are we using ? * @param internal_units The system of units used internally. * @param physical_constants The #phys_const used for this run. * @param hydro The #hydro_props used for this run. @@ -3487,7 +3465,7 @@ void engine_unpin() { void engine_init(struct engine *e, struct space *s, const struct swift_params *params, int nr_nodes, int nodeID, int nr_threads, int with_aff, int policy, int verbose, - enum repartition_type reparttype, + enum repartition_type reparttype, const struct UnitSystem *internal_units, const struct phys_const *physical_constants, const struct hydro_props *hydro, diff --git a/src/engine.h b/src/engine.h index 9a9e4bf3ef6da01228757782efa4153fd796d892..50100c687f3a979583d3b3152cf0d7785d0b26d5 100644 --- a/src/engine.h +++ b/src/engine.h @@ -231,7 +231,7 @@ void engine_dump_snapshot(struct engine *e); void engine_init(struct engine *e, struct space *s, const struct swift_params *params, int nr_nodes, int nodeID, int nr_threads, int with_aff, int policy, int verbose, - enum repartition_type reparttype, + enum repartition_type reparttype, const struct UnitSystem *internal_units, const struct phys_const *physical_constants, const struct hydro_props *hydro, diff --git a/src/gravity/Default/gravity.h b/src/gravity/Default/gravity.h index 7648490b0df98ef565014ef1ad84518df7755b54..3f97070fbb80c8920a929e6df8d93def6ac6041a 100644 --- a/src/gravity/Default/gravity.h +++ b/src/gravity/Default/gravity.h @@ -91,8 +91,8 @@ __attribute__((always_inline)) INLINE static void gravity_kick_extra( * * @param gp The particle. */ -__attribute__((always_inline)) INLINE static void gravity_reset_predicted_values( - struct gpart* gp) {} +__attribute__((always_inline)) INLINE static void +gravity_reset_predicted_values(struct gpart* gp) {} /** * @brief Initialises the g-particles for the first time diff --git a/src/runner.c b/src/runner.c index 87420e9096b920481d1dbf1ddbece824e602572f..bffb25d934f79f20316f69f8fe69befa8f9f9023 100644 --- a/src/runner.c +++ b/src/runner.c @@ -1016,9 +1016,8 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) { kick_part(p, xp, ti_begin + ti_step / 2, ti_begin + ti_step, timeBase); #ifdef SWIFT_DEBUG_CHECKS - /* Check that kick and the drift are synchronized */ - if(p->ti_drift != p->ti_kick) - error("Error integrating part in time."); + /* Check that kick and the drift are synchronized */ + if (p->ti_drift != p->ti_kick) error("Error integrating part in time."); #endif /* Prepare the values to be drifted */ @@ -1048,9 +1047,9 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) { kick_gpart(gp, ti_begin + ti_step / 2, ti_begin + ti_step, timeBase); #ifdef SWIFT_DEBUG_CHECKS - /* Check that kick and the drift are synchronized */ - if(gp->ti_drift != gp->ti_kick) - error("Error integrating g-part in time."); + /* Check that kick and the drift are synchronized */ + if (gp->ti_drift != gp->ti_kick) + error("Error integrating g-part in time."); #endif /* Prepare the values to be drifted */ @@ -1080,9 +1079,9 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) { kick_spart(sp, ti_begin + ti_step / 2, ti_begin + ti_step, timeBase); #ifdef SWIFT_DEBUG_CHECKS - /* Check that kick and the drift are synchronized */ - if(sp->ti_drift != sp->ti_kick) - error("Error integrating s-part in time."); + /* Check that kick and the drift are synchronized */ + if (sp->ti_drift != sp->ti_kick) + error("Error integrating s-part in time."); #endif /* Prepare the values to be drifted */ diff --git a/src/space.c b/src/space.c index fa3771d8433927a6c1887d8ea07f9664b489f42e..1eab1107384656ecd1218fd2761073a993918fd6 100644 --- a/src/space.c +++ b/src/space.c @@ -251,7 +251,6 @@ void space_regrid(struct space *s, int verbose) { const size_t nr_parts = s->nr_parts; const ticks tic = getticks(); - //const integertime_t ti_current = (s->e != NULL) ? s->e->ti_current : 0; const integertime_t ti_old = (s->e != NULL) ? s->e->ti_old : 0; /* Run through the cells and get the current h_max. */ @@ -488,7 +487,6 @@ void space_rebuild(struct space *s, int verbose) { size_t nr_gparts = s->nr_gparts; size_t nr_sparts = s->nr_sparts; struct cell *restrict cells_top = s->cells_top; - //const integertime_t ti_current = (s->e != NULL) ? s->e->ti_current : 0; const integertime_t ti_old = (s->e != NULL) ? s->e->ti_old : 0; /* Run through the particles and get their cell index. Allocates