From e6d2803abd6eefdc3ea7b81b2fd26b60b177f027 Mon Sep 17 00:00:00 2001 From: Lijun Zhu Date: Sat, 17 Aug 2019 13:57:43 -0700 Subject: [PATCH] MPIAnnealing: distribute statistics to all workers --- altar/bayesian/MPIAnnealing.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/altar/bayesian/MPIAnnealing.py b/altar/bayesian/MPIAnnealing.py index 16372b2e..c8c3793b 100644 --- a/altar/bayesian/MPIAnnealing.py +++ b/altar/bayesian/MPIAnnealing.py @@ -114,14 +114,13 @@ def resample(self, annealer, statistics): accepted, rejected, unlikely = statistics # add up the acceptance/rejection statistics from all the nodes - accepted = self.communicator.sum(accepted, destination=manager) - rejected = self.communicator.sum(rejected, destination=manager) - unlikely = self.communicator.sum(unlikely, destination=manager) + # and distribute the results back to all processes + accepted = self.communicator.sum(item=accepted) + rejected = self.communicator.sum(item=rejected) + unlikely = self.communicator.sum(item=unlikely) - # if I am the boss - if self.rank == manager: - # chain up - super().resample(annealer=annealer, statistics=(accepted,rejected,unlikely)) + # chain up + super().resample(annealer=annealer, statistics=(accepted,rejected,unlikely)) # all done return self