From 6bf0a3bbcd8cae23c7b3d35a802e3a258fbe1ede Mon Sep 17 00:00:00 2001 From: James Willis <james.s.willis@durham.ac.uk> Date: Thu, 18 Apr 2019 10:43:13 +0100 Subject: [PATCH] Skip all other tasks when running the local and MPI FOF tasks. --- examples/EAGLE_low_z/EAGLE_50/eagle_50.yml | 2 +- src/engine_maketasks.c | 34 +++++++++++++++++++++- src/fof.c | 1 + 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml b/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml index 97935ef818..56ea0a8adf 100644 --- a/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml +++ b/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml @@ -56,7 +56,7 @@ SPH: # Parameters for the Friends-Of-Friends algorithm FOF: basename: fof_output # Common part of the name of output files - run_freq: 10 # (Optional) The no. of steps between each FOF search. Defaults to 2000. + run_freq: 2000 # (Optional) The no. of steps between each FOF search. Defaults to 2000. min_group_size: 20 # (Optional) The minimum no. of particles required for a group. Defaults to 20 if unspecified. linking_length_scale: 0.2 # (Optional) Scales the linking length. Defaults to 0.2 if unspecified. group_links_size_default: 20000 # (Optional) Sets the initial size of the group_links array, which is used to store links across MPI domains. Defaults to 20000 if unspecified. diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index d3ad3882c3..980ec51c71 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -2242,7 +2242,8 @@ void engine_make_fof_tasks(struct engine *e) { struct task *t = &sched->tasks[i]; - if (t->type == task_type_fof_self || t->type == task_type_fof_pair) scheduler_activate(sched, t); + if (t->type == task_type_fof_self || t->type == task_type_fof_pair) scheduler_activate(sched, t); + else t->skip = 1; } if (e->verbose) @@ -2257,6 +2258,37 @@ void engine_make_fof_tasks(struct engine *e) { } #endif + ticks tic2 = getticks(); + + /* Report the number of tasks we actually used */ + if (e->verbose) + message( + "Nr. of tasks: %d allocated tasks: %d ratio: %f memory use: %zd MB.", + e->sched.nr_tasks, e->sched.size, + (float)e->sched.nr_tasks / (float)e->sched.size, + e->sched.size * sizeof(struct task) / (1024 * 1024)); + + tic2 = getticks(); + + /* Set the unlocks per task. */ + scheduler_set_unlocks(sched); + + if (e->verbose) + message("Setting unlocks took %.3f %s.", + clocks_from_ticks(getticks() - tic2), clocks_getunit()); + + tic2 = getticks(); + + /* Weight the tasks. */ + scheduler_reweight(sched, e->verbose); + + /* Set the tasks age. */ + e->tasks_age = 0; + + if (e->verbose) + message("took %.3f %s (including reweight).", + clocks_from_ticks(getticks() - tic), clocks_getunit()); + } /** diff --git a/src/fof.c b/src/fof.c index 4c95951781..5a8a84261b 100644 --- a/src/fof.c +++ b/src/fof.c @@ -1581,6 +1581,7 @@ void fof_search_foreign_cells(struct space *s) { (t->type == task_type_recv && t->subtype == task_subtype_gpart) ) { scheduler_activate(sched, t); } + else t->skip = 1; } -- GitLab