Skip to content

Instantly share code, notes, and snippets.

Created May 10, 2012 01:57
Show Gist options
  • Save anonymous/2650436 to your computer and use it in GitHub Desktop.
Save anonymous/2650436 to your computer and use it in GitHub Desktop.
from mpi4py import MPI
import numpy as np
def psum(a):
s = np.sum(a)
rcvBuf = np.array(0.0,'d')
MPI.COMM_WORLD.Allreduce([s, MPI.DOUBLE],
[rcvBuf, MPI.DOUBLE],
op=MPI.SUM)
return rcvBuf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment