Commit 7ce8aced authored by Loic Hausammann's avatar Loic Hausammann
Browse files

Task order: implement structure

parent 8d019571
......@@ -1376,6 +1376,7 @@ with_subgrid_pressure_floor=none
with_subgrid_stars=none
with_subgrid_star_formation=none
with_subgrid_feedback=none
with_subgrid_task_order=none
case "$with_subgrid" in
yes)
......@@ -1391,6 +1392,7 @@ case "$with_subgrid" in
with_subgrid_star_formation=GEAR
with_subgrid_feedback=none
with_subgrid_black_holes=none
with_subgrid_task_order=GEAR
enable_fof=no
;;
EAGLE)
......@@ -1402,6 +1404,7 @@ case "$with_subgrid" in
with_subgrid_star_formation=EAGLE
with_subgrid_feedback=EAGLE
with_subgrid_black_holes=EAGLE
with_subgrid_task_order=EAGLE
enable_fof=yes
;;
*)
......@@ -1882,6 +1885,38 @@ case "$with_black_holes" in
;;
esac
# Task order
AC_ARG_WITH([task-order],
[AS_HELP_STRING([--with-task-order=<model>],
[Task order to use @<:@none, EAGLE, GEAR default: none@:>@]
)],
[with_task_order="$withval"],
[with_task_order="none"]
)
if test "$with_subgrid" != "none"; then
if test "$with_task_order" != "none"; then
AC_MSG_ERROR([Cannot provide with-subgrid and with-task-order together])
else
with_task_order="$with_subgrid_task_order"
fi
fi
case "$with_task_order" in
EAGLE)
AC_DEFINE([TASK_ORDER_EAGLE], [1], [EAGLE task order])
;;
none)
AC_DEFINE([TASK_ORDER_NONE], [1], [Default task order])
;;
GEAR)
AC_DEFINE([TASK_ORDER_GEAR], [1], [GEAR task order])
;;
*)
AC_MSG_ERROR([Unknown feedback model: $with_feedback])
;;
esac
# External potential
AC_ARG_WITH([ext-potential],
[AS_HELP_STRING([--with-ext-potential=<pot>],
......@@ -2117,6 +2152,7 @@ AC_MSG_RESULT([
Star formation model : $with_star_formation
Star feedback model : $with_feedback
Black holes model : $with_black_holes
Task order : $with_task_order
Individual timers : $enable_timers
Task debugging : $enable_task_debugging
......
......@@ -55,7 +55,7 @@ include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \
pressure_floor.h pressure_floor_struct.h pressure_floor_iact.h \
velociraptor_struct.h velociraptor_io.h random.h memuse.h mpiuse.h memuse_rnodes.h \
black_holes.h black_holes_io.h black_holes_properties.h black_holes_struct.h \
feedback.h feedback_struct.h feedback_properties.h
feedback.h feedback_struct.h feedback_properties.h task_order.h
# source files for EAGLE cooling
EAGLE_COOLING_SOURCES =
......@@ -236,7 +236,8 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h
black_holes/EAGLE/black_holes_struct.h \
pressure_floor/GEAR/pressure_floor.h pressure_floor/none/pressure_floor.h \
pressure_floor/GEAR/pressure_floor_iact.h pressure_floor/none/pressure_floor_iact.h \
pressure_floor/GEAR/pressure_floor_struct.h pressure_floor/none/pressure_floor_struct.h
pressure_floor/GEAR/pressure_floor_struct.h pressure_floor/none/pressure_floor_struct.h \
task_order/GEAR/task_order.h task_order/EAGLE/task_order.h task_order/none/task_order.h
# Sources and flags for regular library
......
......@@ -67,6 +67,7 @@
#include "space_getsid.h"
#include "star_formation.h"
#include "stars.h"
#include "task_order.h"
#include "timers.h"
#include "tools.h"
#include "tracers.h"
......@@ -2476,7 +2477,9 @@ 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 */
cell_activate_star_resort_tasks(c, s);
if (task_order_need_resort_stars) {
cell_activate_star_resort_tasks(c, s);
}
}
/**
......
......@@ -50,6 +50,7 @@
#include "debug.h"
#include "error.h"
#include "proxy.h"
#include "task_order.h"
#include "timers.h"
extern int engine_max_parts_per_ghost;
......@@ -1022,7 +1023,8 @@ 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 ((c->nodeID == e->nodeID) && (star_resort_cell == NULL) &&
if (task_order_need_resort_stars &&
(c->nodeID == e->nodeID) && (star_resort_cell == NULL) &&
(c->depth == engine_star_resort_task_depth || c->hydro.super == c)) {
if (with_star_formation && c->hydro.count > 0) {
......@@ -1131,8 +1133,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c,
scheduler_addunlock(s, c->stars.stars_out, c->super->timestep);
if (with_star_formation && c->hydro.count > 0) {
scheduler_addunlock(s, star_resort_cell->hydro.stars_resort,
c->stars.stars_in);
task_order_addunlock_star_formation_feedback(s, c, star_resort_cell);
}
}
......
......@@ -45,6 +45,7 @@ void runner_do_stars_resort(struct runner *r, struct cell *c, const int timer) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->nodeID != r->e->nodeID) error("Task must be run locally!");
if (!task_order_need_resort_stars) error("Resorting when not needed");
#endif
TIMER_TIC;
......
......@@ -83,6 +83,7 @@
#include "stars.h"
#include "stars_io.h"
#include "task.h"
#include "task_order.h"
#include "threadpool.h"
#include "timeline.h"
#include "timers.h"
......
/*******************************************************************************
* 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_H
#define SWIFT_TASK_ORDER_H
#include "../config.h"
#ifdef TASK_ORDER_NONE
#include "task_order/none/task_order.h"
#else
#error undefined task order
#endif
#endif // SWIFT_TASK_ORDER_H
/*******************************************************************************
* 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_need_resort_stars 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment