diff --git a/examples/main.c b/examples/main.c index b0e7ed8450c0745c9638f7b928d67778952f5f24..2b7861b1dd50698b9bd0b6a1f5bf42f7fa4f9085 100644 --- a/examples/main.c +++ b/examples/main.c @@ -163,7 +163,8 @@ int main(int argc, char *argv[]) { int with_star_formation = 0; int with_feedback = 0; int with_black_holes = 0; - int with_limiter = 0; + int with_timestep_limiter = 0; + int with_timestep_sync = 0; int with_fp_exceptions = 0; int with_drift_all = 0; int with_mpole_reconstruction = 0; @@ -219,7 +220,9 @@ int main(int argc, char *argv[]) { NULL, 0, 0), OPT_BOOLEAN('x', "velociraptor", &with_structure_finding, "Run with structure finding.", NULL, 0, 0), - OPT_BOOLEAN(0, "limiter", &with_limiter, "Run with time-step limiter.", + OPT_BOOLEAN(0, "limiter", &with_timestep_limiter, + "Run with time-step limiter.", NULL, 0, 0), + OPT_BOOLEAN(0, "sync", &with_timestep_sync, "Run with time-step sync.", NULL, 0, 0), OPT_GROUP(" Control options:\n"), @@ -555,7 +558,8 @@ int main(int argc, char *argv[]) { #ifdef WITH_MPI if (with_mpole_reconstruction && nr_nodes > 1) error("Cannot reconstruct m-poles every step over MPI (yet)."); - if (with_limiter) error("Can't run with time-step limiter over MPI (yet)"); + if (with_timestep_limiter) + error("Can't run with time-step limiter over MPI (yet)"); #ifdef WITH_LOGGER error("Can't run with the particle logger over MPI (yet)"); #endif @@ -1105,7 +1109,9 @@ int main(int argc, char *argv[]) { engine_policies |= engine_policy_external_gravity; if (with_cosmology) engine_policies |= engine_policy_cosmology; if (with_temperature) engine_policies |= engine_policy_temperature; - if (with_limiter) engine_policies |= engine_policy_limiter; + if (with_timestep_limiter) + engine_policies |= engine_policy_timestep_limiter; + if (with_timestep_sync) engine_policies |= engine_policy_timestep_sync; if (with_cooling) engine_policies |= engine_policy_cooling; if (with_stars) engine_policies |= engine_policy_stars; if (with_star_formation) engine_policies |= engine_policy_star_formation; diff --git a/src/cell.c b/src/cell.c index b8c2e9132cdd520a2752f7d651286f796d09a011..551872489a2d5041b1597b0cf44d3893a12ef2e6 100644 --- a/src/cell.c +++ b/src/cell.c @@ -2915,7 +2915,7 @@ void cell_activate_stars_sorts(struct cell *c, int sid, struct scheduler *s) { void cell_activate_subcell_hydro_tasks(struct cell *ci, struct cell *cj, struct scheduler *s) { const struct engine *e = s->space->e; - const int with_limiter = (e->policy & engine_policy_limiter); + const int with_limiter = (e->policy & engine_policy_timestep_limiter); /* Store the current dx_max and h_max values. */ ci->hydro.dx_max_part_old = ci->hydro.dx_max_part; @@ -3011,7 +3011,7 @@ void cell_activate_subcell_stars_tasks(struct cell *ci, struct cell *cj, struct scheduler *s, const int with_star_formation) { const struct engine *e = s->space->e; - const int with_limiter = (e->policy & engine_policy_limiter); + const int with_limiter = (e->policy & engine_policy_timestep_limiter); /* Store the current dx_max and h_max values. */ ci->stars.dx_max_part_old = ci->stars.dx_max_part; @@ -3381,7 +3381,7 @@ void cell_activate_subcell_external_grav_tasks(struct cell *ci, int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { struct engine *e = s->space->e; const int nodeID = e->nodeID; - const int with_limiter = (e->policy & engine_policy_limiter); + const int with_limiter = (e->policy & engine_policy_timestep_limiter); #ifdef WITH_MPI const int with_star_formation = e->policy & engine_policy_star_formation; @@ -3787,7 +3787,7 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s, const int with_star_formation) { struct engine *e = s->space->e; - const int with_limiter = (e->policy & engine_policy_limiter); + const int with_limiter = (e->policy & engine_policy_timestep_limiter); const int nodeID = e->nodeID; int rebuild = 0; diff --git a/src/engine.c b/src/engine.c index ab7b4269da08870000e5156e9201d6166b70ece8..a145133289756fed0fed19c9357536b3277ba405 100644 --- a/src/engine.c +++ b/src/engine.c @@ -117,7 +117,8 @@ const char *engine_policy_names[] = {"none", "feedback", "black holes", "fof search", - "time-step limiter"}; + "time-step limiter", + "time-step sync"}; /** The rank of the engine as a global variable (for messages). */ int engine_rank; @@ -1353,7 +1354,7 @@ int engine_estimate_nr_tasks(const struct engine *e) { #endif #endif } - if (e->policy & engine_policy_limiter) { + if (e->policy & engine_policy_timestep_limiter) { n1 += 18; n2 += 1; } diff --git a/src/engine.h b/src/engine.h index 772f4c533010b12700b1d8cef38c3c014db9e142..65402b49ad91ba95c8b9b7602ed1c807975bfb63 100644 --- a/src/engine.h +++ b/src/engine.h @@ -79,9 +79,10 @@ enum engine_policy { engine_policy_feedback = (1 << 18), engine_policy_black_holes = (1 << 19), engine_policy_fof = (1 << 20), - engine_policy_limiter = (1 << 21) + engine_policy_timestep_limiter = (1 << 21), + engine_policy_timestep_sync = (1 << 22) }; -#define engine_maxpolicy 22 +#define engine_maxpolicy 23 extern const char *engine_policy_names[engine_maxpolicy + 1]; /** diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index e4ae4d569fe81657ff6a3ac9a1a1ca968057e040..7b4e0107b00f02bd3a0ded914938859843d655ee 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -792,7 +792,7 @@ void engine_make_hierarchical_tasks_common(struct engine *e, struct cell *c) { struct scheduler *s = &e->sched; const int with_star_formation = (e->policy & engine_policy_star_formation); - const int with_limiter = (e->policy & engine_policy_limiter); + const int with_limiter = (e->policy & engine_policy_timestep_limiter); /* Are we at the top-level? */ if (c->top == c && c->nodeID == e->nodeID) { @@ -1023,7 +1023,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c, const int with_cooling = (e->policy & engine_policy_cooling); const int with_star_formation = (e->policy & engine_policy_star_formation); const int with_black_holes = (e->policy & engine_policy_black_holes); - const int with_limiter = (e->policy & engine_policy_limiter); + const int with_limiter = (e->policy & engine_policy_timestep_limiter); /* Are we are the level where we create the stars' resort tasks? * If the tree is shallow, we need to do this at the super-level if the @@ -1809,7 +1809,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements, struct scheduler *sched = &e->sched; const int nodeID = e->nodeID; const int with_cooling = (e->policy & engine_policy_cooling); - const int with_limiter = (e->policy & engine_policy_limiter); + const int with_limiter = (e->policy & engine_policy_timestep_limiter); const int with_feedback = (e->policy & engine_policy_feedback); const int with_black_holes = (e->policy & engine_policy_black_holes); #ifdef EXTRA_HYDRO_LOOP diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index fb6b5cf6f9f1cf17e56c54242d2d55f08a2aaa04..307520ad50882dd250d68e59bb0ee60fbc251067 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -69,7 +69,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, struct scheduler *s = (struct scheduler *)(((size_t *)extra_data)[2]); struct engine *e = (struct engine *)((size_t *)extra_data)[0]; const int nodeID = e->nodeID; - const int with_limiter = e->policy & engine_policy_limiter; + const int with_limiter = e->policy & engine_policy_timestep_limiter; const int with_star_formation = e->policy & engine_policy_star_formation; #ifdef WITH_MPI const int with_feedback = e->policy & engine_policy_feedback; diff --git a/src/space.c b/src/space.c index 443e67968a1f1bfac054ee8f40a8d1e420447ef7..b38b3efff980d1ad7dae6682017f08ae18834904 100644 --- a/src/space.c +++ b/src/space.c @@ -5347,7 +5347,7 @@ void space_check_limiter_mapper(void *map_data, int nr_parts, /* Unpack the data */ struct part *restrict parts = (struct part *)map_data; const struct space *s = (struct space *)extra_data; - const int with_limiter = (s->e->policy & engine_policy_limiter); + const int with_limiter = (s->e->policy & engine_policy_timestep_limiter); /* Verify that all limited particles have been treated */ for (int k = 0; k < nr_parts; k++) { diff --git a/src/timeline.h b/src/timeline.h index b6136f1d550bcd7fc551cf3a3890250737e57aff..0f94321101c9f3e319348cfb46210a389df56fd3 100644 --- a/src/timeline.h +++ b/src/timeline.h @@ -53,7 +53,6 @@ typedef int8_t timebin_t; /* Maximal difference in time-bins between neighbouring particles */ #define time_bin_neighbour_max_delta_bin 2 - /** * @brief Returns the integer time interval corresponding to a time bin *