From 0935d9159f19c938b2e665cc02d9ef8723429ea1 Mon Sep 17 00:00:00 2001 From: James Willis <james.s.willis@durham.ac.uk> Date: Thu, 28 Mar 2019 10:55:52 +0000 Subject: [PATCH] Fixes after merge. --- examples/main_fof.c | 2 +- src/engine.c | 31 +++++++++++++------------------ src/fof.c | 39 +-------------------------------------- src/space.c | 1 - 4 files changed, 15 insertions(+), 58 deletions(-) diff --git a/examples/main_fof.c b/examples/main_fof.c index 6cee578385..571fcf9f1e 100644 --- a/examples/main_fof.c +++ b/examples/main_fof.c @@ -1018,7 +1018,7 @@ int main(int argc, char *argv[]) { #endif /* Perform first FOF search after the first snapshot dump. */ - //fof_search_tree(&s); + fof_search_tree(&s); #ifdef WITH_MPI MPI_Barrier(MPI_COMM_WORLD); diff --git a/src/engine.c b/src/engine.c index 22648ea4a6..9abea54360 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2203,10 +2203,8 @@ void engine_rebuild(struct engine *e, int repartitioned, } #endif - fof_search_tree(e->s); - /* Re-build the tasks. */ - //engine_maketasks(e); + engine_maketasks(e); /* Make the list of top-level cells that have tasks */ space_list_useful_top_level_cells(e->s); @@ -2853,20 +2851,17 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs, /* No time integration. We just want the density and ghosts */ engine_skip_force_and_kick(e); - //struct scheduler *sched = &e->sched; - //struct task *tasks = sched->tasks; - - /* Activate the send and receive tasks for the gparts. */ - //for (int i = 0; i < sched->nr_tasks; i++) { + /* Activate the self and pair FOF tasks and skip all other tasks. */ + for (int i = 0; i < e->sched.nr_tasks; i++) { - // struct task *t = &tasks[i]; + struct task *t = &e->sched.tasks[i]; - // t->skip = 1; + t->skip = 1; - // if (t->type == task_type_fof_self || t->type == task_type_fof_pair) { - // t->skip = 0; - // } - //} + if (t->type == task_type_fof_self || t->type == task_type_fof_pair) { + scheduler_activate(&e->sched, t); + } + } /* Print the number of active tasks ? */ if (e->verbose) engine_print_task_counts(e); @@ -2892,7 +2887,7 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs, /* Now, launch the calculation */ TIMER_TIC; - //engine_launch(e); + engine_launch(e); TIMER_TOC(timer_runners); /* Apply some conversions (e.g. internal energy -> entropy) */ @@ -2956,7 +2951,7 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs, /* Run the 0th time-step */ TIMER_TIC2; - //engine_launch(e); + engine_launch(e); TIMER_TOC2(timer_runners); #ifdef SWIFT_GRAVITY_FORCE_CHECKS @@ -3225,7 +3220,7 @@ void engine_step(struct engine *e) { /* Start all the tasks. */ TIMER_TIC; - //engine_launch(e); + engine_launch(e); TIMER_TOC(timer_runners); #ifdef SWIFT_GRAVITY_FORCE_CHECKS @@ -3363,7 +3358,7 @@ void engine_check_for_dumps(struct engine *e) { /* Perform a FOF search. */ if (e->run_fof) { - //fof_search_tree(e->s); + fof_search_tree(e->s); e->run_fof = 0; } diff --git a/src/fof.c b/src/fof.c index b67b47b1c7..b2b5d58d45 100644 --- a/src/fof.c +++ b/src/fof.c @@ -1519,37 +1519,6 @@ void fof_search_tree(struct space *s) { group_mass = s->fof_data.group_mass; group_CoM = s->fof_data.group_CoM; - ticks tic = getticks(); - - engine_maketasks(s->e); - //engine_marktasks(s->e); - - struct scheduler *sched = &s->e->sched; - struct task *tasks = sched->tasks; - - /* Activate the self and pair FOF tasks. */ - for (int i = 0; i < sched->nr_tasks; i++) { - - struct task *t = &tasks[i]; - - if (t->type == task_type_fof_self || t->type == task_type_fof_pair) { - scheduler_activate(sched, t); - } - - } - - engine_print_task_counts(s->e); - - message("Making FOF tasks took: %.3f %s.", clocks_from_ticks(getticks() - tic), - clocks_getunit()); - - tic = getticks(); - - engine_launch(s->e); - - message("Local FOF took: %.3f %s.", clocks_from_ticks(getticks() - tic), - clocks_getunit()); - ticks tic_calc_group_size = getticks(); threadpool_map(&s->e->threadpool, fof_calc_group_props_mapper, @@ -1558,12 +1527,6 @@ void fof_search_tree(struct space *s) { message("FOF calc group size took (scaling): %.3f %s.", clocks_from_ticks(getticks() - tic_calc_group_size), clocks_getunit()); - message("FOF search took (scaling): %.3f %s.", - clocks_from_ticks(getticks() - tic_total), clocks_getunit()); - - free(group_bc); - free(com_set); - #ifdef WITH_MPI size_t num_local_roots = 0; size_t *local_roots = NULL; @@ -1631,7 +1594,7 @@ void fof_search_tree(struct space *s) { message("Sorting groups..."); - tic = getticks(); + ticks tic = getticks(); /* Find global properties. */ #ifdef WITH_MPI diff --git a/src/space.c b/src/space.c index 19148a7397..24442a232b 100644 --- a/src/space.c +++ b/src/space.c @@ -4388,7 +4388,6 @@ void space_clean(struct space *s) { free(s->multipoles_top); free(s->local_cells_top); free(s->local_cells_with_tasks_top); - free(s->cell_index); free(s->cells_with_particles_top); free(s->local_cells_with_particles_top); free(s->parts); -- GitLab