Pergunta

I'd like to use MPI.Op class to perform some operation represented by instance of it (in this case MPI.SUM).

Here is my snippet:

input = numpy.array(3, dtype='i')
output = numpy.array(3, dtype='i')
MPI.SUM.Reduce_local(input, output)

But when I try to run it I get this traceback:

Traceback (most recent call last):
  File "./mpi.py", line 37, in <module>
    MPI.SUM.Reduce_local(input, output)
  File "Op.pyx", line 75, in mpi4py.MPI.Op.Reduce_local (src/mpi4py.MPI.c:54825)
AttributeError: 'mpi4py.MPI.Op' object has no attribute 'scount'

I'm new to python so it's pretty possible that I'm making some kind of easy mistake. Any thoughts?

I'm using Python 2.6.6.

Foi útil?

Solução

Okay, I have an answer to this question.

It seems that it was a bug in mpi4py library which is now fixed: https://bitbucket.org/mpi4py/mpi4py/commits/43c7388ad740e90cc7074c1c21857c3fd3880190

But if you don't have newest version of mpi4py you can still do this:

buffers = [[1,1],[2,2]]
result = reduce(MPI.SUM, buffers)

And a result will be: [3,3]

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top