From 2e2f987f7f3497f38bee4217741fc905370d8fc6 Mon Sep 17 00:00:00 2001 From: Michael Krayer Date: Fri, 12 Feb 2021 02:11:15 +0100 Subject: [PATCH] bugfix: statistics communication for derived fields --- python/ibmppp/ibmppp.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/ibmppp/ibmppp.py b/python/ibmppp/ibmppp.py index 6fd5e65..62dcde7 100644 --- a/python/ibmppp/ibmppp.py +++ b/python/ibmppp/ibmppp.py @@ -1306,7 +1306,8 @@ class ibmppp: if not key in self.spatialMean or self.spatialMean[key] is None: raise ValueError('Statistics not available') # Broadcast statistics - self.spatialMean[key] = self.__comm.bcast(self.spatialMean[key],root=0) + sendbuf = self.spatialMean[key] if self.__rank==0 else None + self.spatialMean[key] = self.__comm.bcast(sendbuf,root=0) # Get dimensions dims = self.spatialMean[key].shape # Slice statistics for each processor @@ -1330,8 +1331,10 @@ class ibmppp: not key in self.spatialMsqr or self.spatialMsqr[key] is None): raise ValueError('Statistics not available') # Broadcast statistics - self.spatialMean[key] = self.__comm.bcast(self.spatialMean[key],root=0) - self.spatialMsqr[key] = self.__comm.bcast(self.spatialMsqr[key],root=0) + sendbuf = self.spatialMean[key] if self.__rank==0 else None + self.spatialMean[key] = self.__comm.bcast(sendbuf,root=0) + sendbuf = self.spatialMsqr[key] if self.__rank==0 else None + self.spatialMsqr[key] = self.__comm.bcast(sendbuf,root=0) # Compute standard deviation assert(self.spatialMean[key].shape==self.spatialMsqr[key].shape) spatialStdDev = np.sqrt(self.spatialMsqr[key]-np.square(self.spatialMean[key]))