diff --git a/src/cell.c b/src/cell.c index 6dee61ecc95be3f4bb17946379640847e00ece11..53806e9a9d7a8211f566252cd7062afa6cc91346 100644 --- a/src/cell.c +++ b/src/cell.c @@ -2477,7 +2477,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_need_resort_stars) { + if (task_order_star_formation_before_feedback) { cell_activate_star_resort_tasks(c, s); } } @@ -3461,12 +3461,16 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { /* Propagating new star counts? */ if (with_star_formation && with_feedback) { if (ci_active && ci->hydro.count > 0) { - scheduler_activate_recv(s, ci->mpi.recv, task_subtype_sf_counts); + if (task_order_star_formation_before_feedback) { + scheduler_activate_recv(s, ci->mpi.recv, task_subtype_sf_counts); + } scheduler_activate_recv(s, ci->mpi.recv, task_subtype_tend_spart); } if (cj_active && cj->hydro.count > 0) { - scheduler_activate_send(s, cj->mpi.send, task_subtype_sf_counts, - ci_nodeID); + if (task_order_star_formation_before_feedback) { + scheduler_activate_send(s, cj->mpi.send, task_subtype_sf_counts, + ci_nodeID); + } scheduler_activate_send(s, cj->mpi.send, task_subtype_tend_spart, ci_nodeID); } @@ -3526,12 +3530,16 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { /* Propagating new star counts? */ if (with_star_formation && with_feedback) { if (cj_active && cj->hydro.count > 0) { - scheduler_activate_recv(s, cj->mpi.recv, task_subtype_sf_counts); + if (task_order_star_formation_before_feedback) { + scheduler_activate_recv(s, cj->mpi.recv, task_subtype_sf_counts); + } scheduler_activate_recv(s, cj->mpi.recv, task_subtype_tend_spart); } if (ci_active && ci->hydro.count > 0) { - scheduler_activate_send(s, ci->mpi.send, task_subtype_sf_counts, - cj_nodeID); + if (task_order_star_formation_before_feedback) { + scheduler_activate_send(s, ci->mpi.send, task_subtype_sf_counts, + cj_nodeID); + } scheduler_activate_send(s, ci->mpi.send, task_subtype_tend_spart, cj_nodeID); } diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index a210746489fbaebd282e9b405ce7dc217c3b65e7..e2f6b68e384c63b59cb4a45d4170c67fa759e24a 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -258,7 +258,8 @@ void engine_addtasks_send_stars(struct engine *e, struct cell *ci, /* Early abort (are we below the level where tasks are)? */ if (!cell_get_flag(ci, cell_flag_has_tasks)) return; - if (t_sf_counts == NULL && with_star_formation && ci->hydro.count > 0) { + if (task_order_star_formation_before_feedback && + t_sf_counts == NULL && with_star_formation && ci->hydro.count > 0) { #ifdef SWIFT_DEBUG_CHECKS if (ci->depth != 0) error( @@ -306,7 +307,8 @@ void engine_addtasks_send_stars(struct engine *e, struct cell *ci, engine_addlink(e, &ci->mpi.send, t_feedback); engine_addlink(e, &ci->mpi.send, t_ti); - if (with_star_formation && ci->hydro.count > 0) { + if (task_order_star_formation_before_feedback && + with_star_formation && ci->hydro.count > 0) { engine_addlink(e, &ci->mpi.send, t_sf_counts); } } @@ -552,7 +554,8 @@ void engine_addtasks_recv_stars(struct engine *e, struct cell *c, /* Early abort (are we below the level where tasks are)? */ if (!cell_get_flag(c, cell_flag_has_tasks)) return; - if (t_sf_counts == NULL && with_star_formation && c->hydro.count > 0) { + if (task_order_star_formation_before_feedback && + t_sf_counts == NULL && with_star_formation && c->hydro.count > 0) { #ifdef SWIFT_DEBUG_CHECKS if (c->depth != 0) error( @@ -579,7 +582,8 @@ void engine_addtasks_recv_stars(struct engine *e, struct cell *c, t_ti = scheduler_addtask(s, task_type_recv, task_subtype_tend_spart, c->mpi.tag, 0, c, NULL); - if (with_star_formation && c->hydro.count > 0) { + if (task_order_star_formation_before_feedback && + with_star_formation && c->hydro.count > 0) { /* Receive the stars only once the counts have been received */ scheduler_addunlock(s, t_sf_counts, t_feedback); @@ -589,7 +593,8 @@ void engine_addtasks_recv_stars(struct engine *e, struct cell *c, if (t_feedback != NULL) { engine_addlink(e, &c->mpi.recv, t_feedback); engine_addlink(e, &c->mpi.recv, t_ti); - if (with_star_formation && c->hydro.count > 0) { + if (task_order_star_formation_before_feedback && + with_star_formation && c->hydro.count > 0) { engine_addlink(e, &c->mpi.recv, t_sf_counts); } @@ -1023,7 +1028,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c, /* 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 * super-level is above the level we want */ - if (task_order_need_resort_stars && + if (task_order_star_formation_before_feedback && (c->nodeID == e->nodeID) && (star_resort_cell == NULL) && (c->depth == engine_star_resort_task_depth || c->hydro.super == c)) { diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index 7f4e2d4c4b4ae4865eb2c2320d021be534cc57c3..220b52ceb93444b867f23eb79312695627cb55d3 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -51,6 +51,7 @@ #include "debug.h" #include "error.h" #include "proxy.h" +#include "task_order.h" #include "timers.h" /** @@ -515,12 +516,16 @@ void engine_marktasks_mapper(void *map_data, int num_elements, /* Propagating new star counts? */ if (with_star_formation && with_feedback) { if (ci_active_hydro && ci->hydro.count > 0) { - scheduler_activate_recv(s, ci->mpi.recv, task_subtype_sf_counts); + if (task_order_star_formation_before_feedback) { + scheduler_activate_recv(s, ci->mpi.recv, task_subtype_sf_counts); + } scheduler_activate_recv(s, ci->mpi.recv, task_subtype_tend_spart); } if (cj_active_hydro && cj->hydro.count > 0) { - scheduler_activate_send(s, cj->mpi.send, task_subtype_sf_counts, + if (task_order_star_formation_before_feedback) { + scheduler_activate_send(s, cj->mpi.send, task_subtype_sf_counts, ci_nodeID); + } scheduler_activate_send(s, cj->mpi.send, task_subtype_tend_spart, ci_nodeID); } @@ -576,12 +581,16 @@ void engine_marktasks_mapper(void *map_data, int num_elements, /* Propagating new star counts? */ if (with_star_formation && with_feedback) { if (cj_active_hydro && cj->hydro.count > 0) { - scheduler_activate_recv(s, cj->mpi.recv, task_subtype_sf_counts); + if (task_order_star_formation_before_feedback) { + scheduler_activate_recv(s, cj->mpi.recv, task_subtype_sf_counts); + } scheduler_activate_recv(s, cj->mpi.recv, task_subtype_tend_spart); } if (ci_active_hydro && ci->hydro.count > 0) { - scheduler_activate_send(s, ci->mpi.send, task_subtype_sf_counts, - cj_nodeID); + if (task_order_star_formation_before_feedback) { + scheduler_activate_send(s, ci->mpi.send, task_subtype_sf_counts, + cj_nodeID); + } scheduler_activate_send(s, ci->mpi.send, task_subtype_tend_spart, cj_nodeID); } diff --git a/src/task_order.h b/src/task_order.h index e1752b79d4869f0e63103ced6adca162de390457..b7aed95deab16312ab2014f078019601297ba9bf 100644 --- a/src/task_order.h +++ b/src/task_order.h @@ -24,6 +24,10 @@ #ifdef TASK_ORDER_NONE #include "task_order/none/task_order.h" +#elif TASK_ORDER_GEAR +#include "task_order/GEAR/task_order.h" +#elif TASK_ORDER_EAGLE +#include "task_order/EAGLE/task_order.h" #else #error undefined task order #endif diff --git a/src/task_order/EAGLE/task_order.h b/src/task_order/EAGLE/task_order.h index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b33fe0506d16b06e85f41d098ea7e201fc3b6b40 100644 --- a/src/task_order/EAGLE/task_order.h +++ b/src/task_order/EAGLE/task_order.h @@ -0,0 +1,36 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2019 Loic Hausammann (loic.hausammann@epfl.ch) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ + +#ifndef SWIFT_TASK_ORDER_NONE_H +#define SWIFT_TASK_ORDER_NONE_H + +#include "cell.h" + +#define task_order_star_formation_before_feedback 1 + + +__attribute__((always_inline)) INLINE static void task_order_addunlock_star_formation_feedback( + struct scheduler *s, struct cell *c, struct cell *star_resort_cell) { + + scheduler_addunlock(s, star_resort_cell->hydro.stars_resort, + c->stars.stars_in); + +} + +#endif // SWIFT_TASK_ORDER_NONE_H diff --git a/src/task_order/GEAR/task_order.h b/src/task_order/GEAR/task_order.h index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..9b5eba329ce5ab08260ba1078eb9b11c81a4b973 100644 --- a/src/task_order/GEAR/task_order.h +++ b/src/task_order/GEAR/task_order.h @@ -0,0 +1,36 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2019 Loic Hausammann (loic.hausammann@epfl.ch) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ + +#ifndef SWIFT_TASK_ORDER_GEAR_H +#define SWIFT_TASK_ORDER_GEAR_H + +#include "cell.h" + +#define task_order_star_formation_before_feedback 0 + + +__attribute__((always_inline)) INLINE static void task_order_addunlock_star_formation_feedback( + struct scheduler *s, struct cell *c, struct cell *star_resort_cell) { + + scheduler_addunlock(s, c->stars.stars_out, + c->top->hydro.star_formation); + +} + +#endif // SWIFT_TASK_ORDER_GEAR_H diff --git a/src/task_order/none/task_order.h b/src/task_order/none/task_order.h index 97f6d1140c8347b56be0500daa83914c6d70a333..b33fe0506d16b06e85f41d098ea7e201fc3b6b40 100644 --- a/src/task_order/none/task_order.h +++ b/src/task_order/none/task_order.h @@ -22,7 +22,7 @@ #include "cell.h" -#define task_order_need_resort_stars 1 +#define task_order_star_formation_before_feedback 1 __attribute__((always_inline)) INLINE static void task_order_addunlock_star_formation_feedback(