From 64ea3e3bb74387af9bbd78df28dbb9c0cdfe3fc9 Mon Sep 17 00:00:00 2001 From: Martin Bauer <martin.bauer@fau.de> Date: Fri, 29 Dec 2017 14:46:20 +0100 Subject: [PATCH] AllGather support for fields --- src/field/Gather.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/field/Gather.h b/src/field/Gather.h index 4dd5ff1e4..58e23ff67 100644 --- a/src/field/Gather.h +++ b/src/field/Gather.h @@ -40,7 +40,8 @@ namespace field { * \param blocks the block storage where the field is stored * \param fieldID the block data id of the field * \param boundingBox cell bounding box in global coordinates of the interval which is gathered - * \param targetRank rank of the process where field is gathered + * \param targetRank rank of the process where field is gathered, if negative rank is passed, field is gathered + * on all processes * \param comm MPI communicator * * \tparam Field_T the type of field which is stored in the given fieldID @@ -88,7 +89,10 @@ namespace field { // -- Gather message sizes -- mpi::RecvBuffer recvBuffer; - mpi::gathervBuffer( sendBuffer, recvBuffer, targetRank, comm ); + if ( targetRank >= 0 ) + mpi::gathervBuffer( sendBuffer, recvBuffer, targetRank, comm ); + else + mpi::allGathervBuffer( sendBuffer, recvBuffer, comm ); // -- Unpacking -- if ( recvBuffer.size() > 0 ) @@ -105,7 +109,6 @@ namespace field { recvBuffer >> it.getF(f); } } - } -- GitLab