From 3e9fef1ba8f9cd412d2dd02c9cc430f99efe15c7 Mon Sep 17 00:00:00 2001 From: Pedro Gonnet <gonnet@google.com> Date: Fri, 2 Nov 2018 09:51:49 +0100 Subject: [PATCH] rename cell_tag to cell_ensure_tagged, it's a bit more descriptive. --- src/cell.c | 3 ++- src/cell.h | 6 +----- src/engine.c | 6 +++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/cell.c b/src/cell.c index c2e7ceada1..53e5716446 100644 --- a/src/cell.c +++ b/src/cell.c @@ -344,6 +344,7 @@ int cell_unpack(struct pcell *restrict pc, struct cell *restrict c, c->split = 1; count += cell_unpack(&pc[pc->progeny[k]], temp, s, with_gravity); } + c->split = (count > 1); /* Return the total number of unpacked cells. */ c->mpi.pcell_size = count; @@ -3160,7 +3161,7 @@ void cell_set_super_mapper(void *map_data, int num_elements, void *extra_data) { /* All top-level cells get an MPI tag. */ #ifdef WITH_MPI - if (c->mpi.tag < 0 && c->mpi.sendto) cell_tag(c); + if (c->mpi.sendto) cell_ensure_tagged(c); #endif /* Super-pointer for hydro */ diff --git a/src/cell.h b/src/cell.h index 050295ce43..59011e0df4 100644 --- a/src/cell.h +++ b/src/cell.h @@ -850,13 +850,9 @@ __attribute__((always_inline)) INLINE static int cell_need_rebuild_for_pair( * * @param c The #cell to tag. */ -__attribute__((always_inline)) INLINE static void cell_tag(struct cell *c) { +__attribute__((always_inline)) INLINE static void cell_ensure_tagged(struct cell *c) { #ifdef WITH_MPI -#ifdef SWIFT_DEBUG_CHECKS - if (c->mpi.tag > 0) error("setting tag for already tagged cell"); -#endif - lock_lock(&c->hydro.lock); if (c->mpi.tag < 0 && (c->mpi.tag = atomic_inc(&cell_next_tag)) > cell_max_tag) diff --git a/src/engine.c b/src/engine.c index b1904ae2e6..4f624495fa 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1497,7 +1497,7 @@ void engine_addtasks_send_hydro(struct engine *e, struct cell *ci, if (t_xv == NULL) { /* Make sure this cell is tagged. */ - cell_tag(ci); + cell_ensure_tagged(ci); t_xv = scheduler_addtask(s, task_type_send, task_subtype_xv, ci->mpi.tag, 0, ci, cj); @@ -1589,7 +1589,7 @@ void engine_addtasks_send_gravity(struct engine *e, struct cell *ci, if (t_grav == NULL) { /* Make sure this cell is tagged. */ - cell_tag(ci); + cell_ensure_tagged(ci); t_grav = scheduler_addtask(s, task_type_send, task_subtype_gpart, ci->mpi.tag, 0, ci, cj); @@ -1652,7 +1652,7 @@ void engine_addtasks_send_timestep(struct engine *e, struct cell *ci, if (t_ti == NULL) { /* Make sure this cell is tagged. */ - cell_tag(ci); + cell_ensure_tagged(ci); t_ti = scheduler_addtask(s, task_type_send, task_subtype_tend, ci->mpi.tag, 0, ci, cj); -- GitLab