Skip to content

Instantly share code, notes, and snippets.

@joezuntz
Created November 30, 2012 17:41
Show Gist options
  • Save joezuntz/4177285 to your computer and use it in GitHub Desktop.
Save joezuntz/4177285 to your computer and use it in GitHub Desktop.
Emcee bugfix patch
diff --git a/emcee/utils.py b/emcee/utils.py
index c5685d3..0aa63c7 100644
--- a/emcee/utils.py
+++ b/emcee/utils.py
@@ -163,19 +163,25 @@ if MPI is not None:
F = _function_wrapper(function)
# Tell all the workers what function to use.
+ requests = []
+
for i in range(self.size):
- self.comm.isend(F, dest=i + 1)
+ r=self.comm.isend(F, dest=i + 1)
+ requests.append(r)
+ MPI.Request.waitall(requests)
# Send all the tasks off. Do not wait for them to be received,
# just continue.
+ requests = []
for i, task in enumerate(tasks):
worker = i % self.size + 1
if self.debug:
print(u"Sent task {0} to worker {1} with tag {2}."
.format(task, worker, i))
- self.comm.isend(task, dest=worker, tag=i)
+ r=self.comm.isend(task, dest=worker, tag=i)
+ requests.append(r)
results = []
-
+ MPI.Request.waitall(requests)
# Now wait for the answers.
for i in range(ntask):
worker = i % self.size + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment