Commit 0ec26259 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'subsize' into 'master'

Subsize

Use separate parameters to determine when a pair or self interaction should be made a sub-cell task.

See merge request !365
parents dd532e97 3b3b609f
......@@ -8,12 +8,12 @@ InternalUnitSystem:
# Parameters for the task scheduling
Scheduler:
nr_queues: 0 # (Optional) The number of task queues to use. Use 0 to let the system decide.
cell_max_size: 8000000 # (Optional) Maximal number of interactions per task if we force the split (this is the default value).
cell_sub_size: 64000000 # (Optional) Maximal number of interactions per sub-task (this is the default value).
cell_split_size: 400 # (Optional) Maximal number of particles per cell (this is the default value).
cell_max_count: 10000 # (Optional) Maximal number of particles per cell allowed before triggering a sanitizing (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).
nr_queues: 0 # (Optional) The number of task queues to use. Use 0 to let the system decide.
cell_max_size: 8000000 # (Optional) Maximal number of interactions per task if we force the split (this is the default value).
cell_sub_size_pair: 256000000 # (Optional) Maximal number of interactions per sub-pair task (this is the default value).
cell_sub_size_self: 32000 # (Optional) Maximal number of interactions per sub-self task (this is the default value).
cell_split_size: 400 # (Optional) Maximal number of particles per cell (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).
# Parameters governing the time integration (Set dt_min and dt_max to the same value for a fixed time-step run.)
TimeIntegration:
......
......@@ -151,8 +151,7 @@ static void scheduler_splittask_hydro(struct task *t, struct scheduler *s) {
if (cell_can_split_self_task(ci)) {
/* Make a sub? */
if (scheduler_dosub && /* Note division here to avoid overflow */
(ci->count > 0 && ci->count < space_subsize / ci->count)) {
if (scheduler_dosub && ci->count < space_subsize_self) {
/* convert to a self-subtask. */
t->type = task_type_sub_self;
......@@ -211,8 +210,8 @@ static void scheduler_splittask_hydro(struct task *t, struct scheduler *s) {
if (cell_can_split_pair_task(ci) && cell_can_split_pair_task(cj)) {
/* Replace by a single sub-task? */
if (scheduler_dosub &&
ci->count * sid_scale[sid] < space_subsize / cj->count &&
if (scheduler_dosub && /* Use division to avoid integer overflow. */
ci->count * sid_scale[sid] < space_subsize_pair / cj->count &&
!sort_is_corner(sid)) {
/* Make this task a sub task. */
......@@ -624,8 +623,7 @@ static void scheduler_splittask_gravity(struct task *t, struct scheduler *s) {
if (ci->split) {
/* Make a sub? */
if (scheduler_dosub && /* Note division here to avoid overflow */
(ci->gcount > 0 && ci->gcount < space_subsize / ci->gcount)) {
if (scheduler_dosub && ci->gcount < space_subsize_self) {
/* convert to a self-subtask. */
t->type = task_type_sub_self;
......
......@@ -60,9 +60,9 @@
/* Split size. */
int space_splitsize = space_splitsize_default;
int space_subsize = space_subsize_default;
int space_subsize_pair = space_subsize_pair_default;
int space_subsize_self = space_subsize_self_default;
int space_maxsize = space_maxsize_default;
int space_maxcount = space_maxcount_default;
/**
* @brief Interval stack necessary for parallel particle sorting.
......@@ -2697,15 +2697,18 @@ void space_init(struct space *s, const struct swift_params *params,
/* Get the constants for the scheduler */
space_maxsize = parser_get_opt_param_int(params, "Scheduler:cell_max_size",
space_maxsize_default);
space_subsize = parser_get_opt_param_int(params, "Scheduler:cell_sub_size",
space_subsize_default);
space_subsize_pair = parser_get_opt_param_int(
params, "Scheduler:cell_sub_size_pair", space_subsize_pair_default);
space_subsize_self = parser_get_opt_param_int(
params, "Scheduler:cell_sub_size_self", space_subsize_self_default);
space_splitsize = parser_get_opt_param_int(
params, "Scheduler:cell_split_size", space_splitsize_default);
space_maxcount = parser_get_opt_param_int(params, "Scheduler:cell_max_count",
space_maxcount_default);
if (verbose)
message("max_size set to %d, sub_size set to %d, split_size set to %d",
space_maxsize, space_subsize, space_splitsize);
message(
"max_size set to %d, sub_size_pair set to %d, sub_size_self set to %d, "
"split_size set to %d",
space_maxsize, space_subsize_pair, space_subsize_self, space_splitsize);
/* Apply h scaling */
const double scaling =
......
......@@ -43,8 +43,8 @@ struct cell;
#define space_cellallocchunk 1000
#define space_splitsize_default 400
#define space_maxsize_default 8000000
#define space_subsize_default 64000000
#define space_maxcount_default 10000
#define space_subsize_pair_default 256000000
#define space_subsize_self_default 32000
#define space_max_top_level_cells_default 12
#define space_stretch 1.10f
#define space_maxreldx 0.1f
......@@ -55,8 +55,8 @@ struct cell;
/* Split size. */
extern int space_splitsize;
extern int space_maxsize;
extern int space_subsize;
extern int space_maxcount;
extern int space_subsize_pair;
extern int space_subsize_self;
/**
* @brief The space in which the cells and particles reside.
......
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