From f80c65cf089e18a959fd1d4d1a493e0b176334a8 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Tue, 15 Jan 2019 14:12:02 +0800 Subject: [PATCH] Base the logic upon the MPI recv tasks instead of the hydro pair tasks. --- src/cell.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/cell.c b/src/cell.c index 55c1ec4950..bd1022f1fa 100644 --- a/src/cell.c +++ b/src/cell.c @@ -199,13 +199,15 @@ int cell_link_sparts(struct cell *c, struct spart *sparts) { */ int cell_link_foreign_parts(struct cell *c, struct part *parts) { +#ifdef WITH_MPI + #ifdef SWIFT_DEBUG_CHECKS if (c->nodeID == engine_rank) error("Linking foreign particles in a local cell!"); #endif /* Do we have a hydro task at this level? */ - if (c->hydro.density != NULL) { + if (c->mpi.hydro.recv_xv != NULL) { /* Recursively attach the parts */ const int counts = cell_link_parts(c, parts); @@ -228,6 +230,10 @@ int cell_link_foreign_parts(struct cell *c, struct part *parts) { } else { return 0; } + +#else + error("Calling linking of foregin particles in non-MPI mode."); +#endif } /** @@ -242,13 +248,15 @@ int cell_link_foreign_parts(struct cell *c, struct part *parts) { */ int cell_link_foreign_gparts(struct cell *c, struct gpart *gparts) { +#ifdef WITH_MPI + #ifdef SWIFT_DEBUG_CHECKS if (c->nodeID == engine_rank) error("Linking foreign particles in a local cell!"); #endif /* Do we have a hydro task at this level? */ - if (c->grav.grav != NULL) { + if (c->mpi.grav.recv != NULL) { /* Recursively attach the gparts */ const int counts = cell_link_gparts(c, gparts); @@ -271,6 +279,10 @@ int cell_link_foreign_gparts(struct cell *c, struct gpart *gparts) { } else { return 0; } + +#else + error("Calling linking of foregin particles in non-MPI mode."); +#endif } /** @@ -283,13 +295,15 @@ int cell_link_foreign_gparts(struct cell *c, struct gpart *gparts) { */ int cell_count_parts_for_tasks(const struct cell *c) { +#ifdef WITH_MPI + #ifdef SWIFT_DEBUG_CHECKS if (c->nodeID == engine_rank) error("Counting foreign particles in a local cell!"); #endif /* Do we have a hydro task at this level? */ - if (c->hydro.density != NULL) { + if (c->mpi.hydro.recv_xv != NULL) { return c->hydro.count; } @@ -304,6 +318,10 @@ int cell_count_parts_for_tasks(const struct cell *c) { } else { return 0; } + +#else + error("Calling linking of foregin particles in non-MPI mode."); +#endif } /** @@ -316,13 +334,15 @@ int cell_count_parts_for_tasks(const struct cell *c) { */ int cell_count_gparts_for_tasks(const struct cell *c) { +#ifdef WITH_MPI + #ifdef SWIFT_DEBUG_CHECKS if (c->nodeID == engine_rank) error("Counting foreign particles in a local cell!"); #endif /* Do we have a hydro task at this level? */ - if (c->grav.grav != NULL) { + if (c->mpi.grav.recv != NULL) { return c->grav.count; } @@ -337,6 +357,10 @@ int cell_count_gparts_for_tasks(const struct cell *c) { } else { return 0; } + +#else + error("Calling linking of foregin particles in non-MPI mode."); +#endif } /** -- GitLab