Commit cbdd0293 authored by Matthieu Schaller's avatar Matthieu Schaller Committed by Matthieu Schaller
Browse files

Replace the absolute depth criterion for gravity tasks with a relative...

Replace the absolute depth criterion for gravity tasks with a relative criterion based on the local depth of the tree.
parent 1ac99176
......@@ -59,10 +59,10 @@ Scheduler:
cell_sub_size_self_hydro: 32000 # (Optional) Maximal number of interactions per sub-self hydro task (this is the default value).
cell_sub_size_pair_grav: 256000000 # (Optional) Maximal number of interactions per sub-pair gravity task (this is the default value).
cell_sub_size_self_grav: 32000 # (Optional) Maximal number of interactions per sub-self gravity task (this is the default value).
cell_sub_size_pair_stars: 256000000 # (Optional) Maximal number of interactions per sub-pair stars task (this is the default value).
cell_sub_size_self_stars: 32000 # (Optional) Maximal number of interactions per sub-self stars task (this is the default value).
cell_sub_size_pair_stars: 256000000 # (Optional) Maximal number of interactions per sub-pair stars task (this is the default value).
cell_sub_size_self_stars: 32000 # (Optional) Maximal number of interactions per sub-self stars task (this is the default value).
cell_split_size: 400 # (Optional) Maximal number of particles per cell (this is the default value).
cell_subdepth_grav: 2 # (Optional) Maximal depth the gravity tasks can be pushed down (this is the default value).
cell_subdepth_diff_grav: 4 # (Optional) Maximal depth difference between leaves and a cell that gravity tasks can be pushed down to (this is the default value).
max_top_level_cells: 12 # (Optional) Maximal number of top-level cells in any dimension. The number of top-level cells will be the cube of this (this is the default value).
tasks_per_cell: 0 # (Optional) The average number of tasks per cell. If not large enough the simulation will fail (means guess...).
mpi_message_limit: 4096 # (Optional) Maximum MPI task message size to send non-buffered, KB.
......
......@@ -808,8 +808,8 @@ __attribute__((always_inline)) INLINE static int cell_can_split_self_stars_task(
__attribute__((always_inline)) INLINE static int
cell_can_split_pair_gravity_task(const struct cell *c) {
/* Is the cell split ? */
return c->split && c->depth < space_subdepth_grav;
/* Is the cell split and still far from the leaves ? */
return c->split && ((c->maxdepth - c->depth) > space_subdepth_diff_grav);
}
/**
......@@ -821,8 +821,8 @@ cell_can_split_pair_gravity_task(const struct cell *c) {
__attribute__((always_inline)) INLINE static int
cell_can_split_self_gravity_task(const struct cell *c) {
/* Is the cell split ? */
return c->split && c->depth < space_subdepth_grav;
/* Is the cell split and still far from the leaves ? */
return c->split && ((c->maxdepth - c->depth) > space_subdepth_diff_grav);
}
/**
......
......@@ -568,7 +568,8 @@ void engine_make_hierarchical_tasks_gravity(struct engine *e, struct cell *c) {
}
/* We are below the super-cell but not below the maximal splitting depth */
else if (c->grav.super != NULL && c->depth < space_subdepth_grav) {
else if ((c->grav.super != NULL) &&
((c->maxdepth - c->depth) >= space_subdepth_diff_grav)) {
/* Local tasks only... */
if (c->nodeID == e->nodeID) {
......@@ -588,7 +589,7 @@ void engine_make_hierarchical_tasks_gravity(struct engine *e, struct cell *c) {
}
/* Recurse but not below the maximal splitting depth */
if (c->split && c->depth <= space_subdepth_grav)
if (c->split && ((c->maxdepth - c->depth) >= space_subdepth_diff_grav))
for (int k = 0; k < 8; k++)
if (c->progeny[k] != NULL)
engine_make_hierarchical_tasks_gravity(e, c->progeny[k]);
......
......@@ -1353,7 +1353,7 @@ static void runner_do_unskip_gravity(struct cell *c, struct engine *e) {
if (!cell_is_active_gravity(c, e)) return;
/* Recurse */
if (c->split && c->depth < space_subdepth_grav) {
if (c->split && ((c->maxdepth - c->depth) >= space_subdepth_diff_grav)) {
for (int k = 0; k < 8; k++) {
if (c->progeny[k] != NULL) {
struct cell *cp = c->progeny[k];
......
......@@ -68,7 +68,7 @@ int space_subsize_pair_grav = space_subsize_pair_grav_default;
int space_subsize_self_grav = space_subsize_self_grav_default;
int space_subsize_pair_stars = space_subsize_pair_stars_default;
int space_subsize_self_stars = space_subsize_self_stars_default;
int space_subdepth_grav = space_subdepth_grav_default;
int space_subdepth_diff_grav = space_subdepth_diff_grav_default;
int space_maxsize = space_maxsize_default;
#ifdef SWIFT_DEBUG_CHECKS
int last_cell_id;
......@@ -3159,13 +3159,14 @@ void space_init(struct space *s, struct swift_params *params,
space_subsize_self_stars_default);
space_splitsize = parser_get_opt_param_int(
params, "Scheduler:cell_split_size", space_splitsize_default);
space_subdepth_grav = parser_get_opt_param_int(
params, "Scheduler:cell_subdepth_grav", space_subdepth_grav_default);
space_subdepth_diff_grav =
parser_get_opt_param_int(params, "Scheduler:cell_subdepth_diff_grav",
space_subdepth_diff_grav_default);
if (verbose) {
message("max_size set to %d split_size set to %d", space_maxsize,
space_splitsize);
message("subdepth_grav set to %d", space_subdepth_grav);
message("subdepth_grav set to %d", space_subdepth_diff_grav);
message("sub_size_pair_hydro set to %d, sub_size_self_hydro set to %d",
space_subsize_pair_hydro, space_subsize_self_hydro);
message("sub_size_pair_grav set to %d, sub_size_self_grav set to %d",
......
......@@ -50,7 +50,7 @@ struct cosmology;
#define space_subsize_self_grav_default 32000
#define space_subsize_pair_stars_default 256000000
#define space_subsize_self_stars_default 32000
#define space_subdepth_grav_default 2
#define space_subdepth_diff_grav_default 4
#define space_max_top_level_cells_default 12
#define space_stretch 1.10f
#define space_maxreldx 0.1f
......@@ -67,7 +67,7 @@ extern int space_subsize_pair_grav;
extern int space_subsize_self_grav;
extern int space_subsize_pair_stars;
extern int space_subsize_self_stars;
extern int space_subdepth_grav;
extern int space_subdepth_diff_grav;
/**
* @brief The space in which the cells and particles reside.
......
Supports Markdown
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