From c61f48f04e67fb5d33a5fb659d304a924eab2edf Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Sun, 17 Nov 2019 15:59:27 +0100 Subject: [PATCH] Do not create the stars_resort task when we are running without feedback. --- src/cell.c | 10 ++++++---- src/cell.h | 3 ++- src/engine_maketasks.c | 4 ++-- src/engine_marktasks.c | 4 +--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/cell.c b/src/cell.c index 2d450d289f..992bc5e65b 100644 --- a/src/cell.c +++ b/src/cell.c @@ -2463,8 +2463,10 @@ void cell_activate_star_resort_tasks(struct cell *c, struct scheduler *s) { * * @param c The (top-level) #cell. * @param s The #scheduler. + * @param with_feedback Are we running with feedback? */ -void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s) { +void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s, + const int with_feedback) { #ifdef SWIFT_DEBUG_CHECKS if (c->depth != 0) error("Function should be called at the top-level only"); @@ -2477,7 +2479,7 @@ void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s) { scheduler_activate(s, c->hydro.star_formation); /* Activate the star resort tasks at whatever level they are */ - if (task_order_star_formation_before_feedback) { + if (task_order_star_formation_before_feedback && with_feedback) { cell_activate_star_resort_tasks(c, s); } } @@ -3379,12 +3381,12 @@ 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_feedback = e->policy & engine_policy_feedback; const int with_timestep_limiter = (e->policy & engine_policy_timestep_limiter); #ifdef WITH_MPI const int with_star_formation = e->policy & engine_policy_star_formation; - const int with_feedback = e->policy & engine_policy_feedback; #endif int rebuild = 0; @@ -3620,7 +3622,7 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { #endif if (c->top->hydro.star_formation != NULL) { - cell_activate_star_formation_tasks(c->top, s); + cell_activate_star_formation_tasks(c->top, s, with_feedback); } } diff --git a/src/cell.h b/src/cell.h index c9764d748c..13621f0cd2 100644 --- a/src/cell.h +++ b/src/cell.h @@ -888,7 +888,8 @@ void cell_drift_all_multipoles(struct cell *c, const struct engine *e); void cell_check_timesteps(struct cell *c); void cell_store_pre_drift_values(struct cell *c); void cell_set_star_resort_flag(struct cell *c); -void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s); +void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s, + const int with_feedback); void cell_activate_subcell_hydro_tasks(struct cell *ci, struct cell *cj, struct scheduler *s); void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj, diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index fd1cd787dc..b783a248a2 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -1048,7 +1048,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c, (star_resort_cell == NULL) && (c->depth == engine_star_resort_task_depth || c->hydro.super == c)) { - if (with_star_formation && c->hydro.count > 0) { + if (with_feedback && with_star_formation && c->hydro.count > 0) { /* Record this is the level where we re-sort */ star_resort_cell = c; @@ -1152,7 +1152,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c, #endif scheduler_addunlock(s, c->stars.stars_out, c->super->timestep); - if (with_star_formation && c->hydro.count > 0) { + if (with_feedback && with_star_formation && c->hydro.count > 0) { task_order_addunlock_star_formation_feedback(s, c, star_resort_cell); } } diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index 25d27c1b3d..0229c04320 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -73,9 +73,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, const int with_timestep_limiter = e->policy & engine_policy_timestep_limiter; const int with_timestep_sync = e->policy & engine_policy_timestep_sync; const int with_star_formation = e->policy & engine_policy_star_formation; -#ifdef WITH_MPI const int with_feedback = e->policy & engine_policy_feedback; -#endif for (int ind = 0; ind < num_elements; ind++) { @@ -960,7 +958,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, /* Subgrid tasks: star formation */ else if (t_type == task_type_star_formation) { if (cell_is_active_hydro(t->ci, e)) { - cell_activate_star_formation_tasks(t->ci, s); + cell_activate_star_formation_tasks(t->ci, s, with_feedback); cell_activate_super_spart_drifts(t->ci, s); } } -- GitLab