From 7f486859df24bff5b8ffdb36ef3d7a9f5ffc391d Mon Sep 17 00:00:00 2001 From: Pedro Gonnet <gonnet@google.com> Date: Wed, 24 May 2017 22:20:51 +0200 Subject: [PATCH] split the ghost task into implicit ghost_in and ghost_out tasks. --- src/cell.c | 3 ++- src/cell.h | 5 +++-- src/engine.c | 19 +++++++++++-------- src/space.c | 3 ++- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/cell.c b/src/cell.c index e9608075d8..5d6a1b10a3 100644 --- a/src/cell.c +++ b/src/cell.c @@ -1752,7 +1752,8 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { for (struct link *l = c->grav; l != NULL; l = l->next) scheduler_activate(s, l->t); if (c->extra_ghost != NULL) scheduler_activate(s, c->extra_ghost); - if (c->ghost != NULL) scheduler_activate(s, c->ghost); + if (c->ghost_in != NULL) scheduler_activate(s, c->ghost_in); + if (c->ghost_out != NULL) scheduler_activate(s, c->ghost_out); if (c->init_grav != NULL) scheduler_activate(s, c->init_grav); if (c->drift != NULL) scheduler_activate(s, c->drift); if (c->kick1 != NULL) scheduler_activate(s, c->kick1); diff --git a/src/cell.h b/src/cell.h index fc3d90bb24..e72cba2032 100644 --- a/src/cell.h +++ b/src/cell.h @@ -151,8 +151,9 @@ struct cell { /*! The multipole initialistation task */ struct task *init_grav; - /*! The ghost task */ - struct task *ghost; + /*! The ghost tasks */ + struct task *ghost_in; + struct task *ghost_out; /*! The extra ghost task for complex hydro schemes */ struct task *extra_ghost; diff --git a/src/engine.c b/src/engine.c index 5ba0549ed2..f04bc6cb98 100644 --- a/src/engine.c +++ b/src/engine.c @@ -183,10 +183,13 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) { scheduler_addunlock(s, c->grav_down, c->kick2); } - /* Generate the ghost task. */ - if (is_hydro) - c->ghost = scheduler_addtask(s, task_type_ghost, task_subtype_none, 0, - 0, c, NULL); + /* Generate the ghost tasks. */ + if (is_hydro) { + c->ghost_in = scheduler_addtask(s, task_type_ghost, task_subtype_none, 0, + /* implicit = */ 1, c, NULL); + c->ghost_out = scheduler_addtask(s, task_type_ghost, task_subtype_none, 0, + /* implicit = */ 1, c, NULL); + } #ifdef EXTRA_HYDRO_LOOP /* Generate the extra ghost task. */ @@ -1041,10 +1044,10 @@ void engine_addtasks_send(struct engine *e, struct cell *ci, struct cell *cj, scheduler_addunlock(s, t_rho, ci->super->kick2); /* The send_rho task depends on the cell's ghost task. */ - scheduler_addunlock(s, ci->super->ghost, t_rho); + scheduler_addunlock(s, ci->super->ghost_out, t_rho); /* The send_xv task should unlock the super-cell's ghost task. */ - scheduler_addunlock(s, t_xv, ci->super->ghost); + scheduler_addunlock(s, t_xv, ci->super->ghost_in); #endif @@ -2035,8 +2038,8 @@ static inline void engine_make_hydro_loops_dependencies(struct scheduler *sched, struct cell *c, int with_cooling) { /* density loop --> ghost --> force loop */ - scheduler_addunlock(sched, density, c->super->ghost); - scheduler_addunlock(sched, c->super->ghost, force); + scheduler_addunlock(sched, density, c->super->ghost_in); + scheduler_addunlock(sched, c->super->ghost_out, force); if (with_cooling) { /* force loop --> cooling (--> kick2) */ diff --git a/src/space.c b/src/space.c index 0c67fe27ac..cb200d399f 100644 --- a/src/space.c +++ b/src/space.c @@ -213,7 +213,8 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements, c->scount = 0; c->init_grav = NULL; c->extra_ghost = NULL; - c->ghost = NULL; + c->ghost_in = NULL; + c->ghost_out = NULL; c->kick1 = NULL; c->kick2 = NULL; c->timestep = NULL; -- GitLab