psum example fails: mismatch between mpi4py 1.1.0 and ipython 0.10 documentation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
IPython |
Fix Committed
|
Undecided
|
Brian Granger |
Bug Description
mpi4py version: 1.1.0 -- this is the relevant package
ipython version: 0.10 -- actually a problem with the documentation
python version: 2.6.3 -- likely any version of python
I am unable to run the MPI "psum" example appearing in the documentation for ipython version 0.10. The psum code can be found on page 81. Here is the (very short) function definition, as it appears in the document (ipython-0.10.pdf):
from mpi4py import MPI
import numpy as np
def psum(a):
s = np.sum(a)
return MPI.COMM_
The example continues on page 82, where the user is invited to enter
In [8]: px s = psum(a)
and it is at this point that ipython begins to complain
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (9, 0))
...
mercifully ending at last with
CompositeError: one or more exceptions from call to method: execute
[0:execute]: TypeError: message: expecting a list or tuple
...
The problem is that the Allreduce function invoked in psum.py does not have the proper signature for mpi4py1.1.0, which looks like this:
In [23]: help(MPI.
Allreduce(...)
To make matters worse, (as far as I can tell) the positional arguments can not be ignored -- both are required. And even worse yet, these positional arguments need to be lists. Here is a version of psum.py that does work with mpi1.1.0
from mpi4py import MPI
import numpy as np
def pdum(a):
s = np.sum(a)
rcvBuf = np.array(0.0,'d')
return rcvBuf
There are likely other incantations that will work -- this is just the closest to the given code that I could come up with. One thing is certain: the example as supplied will not work with mpi4py1.1.0.
Changed in ipython: | |
status: | New → Fix Committed |
assignee: | nobody → Brian Granger (ellisonbg) |
Thanks,
I will fix this example. I haven't updated my mpi4py installations to
1.1.0.
Cheers,
Brian
On Mon, Oct 12, 2009 at 7:20 PM, J.Thomas <email address hidden> wrote:
> Public bug reported: WORLD.Allreduce (s,MPI. SUM) COMM_WORLD. Allreduce) self, sendbuf, recvbuf, Op op=SUM) WORLD.Allreduce ([s, MPI.DOUBLE], /bugs.launchpad .net/bugs/ 450025
>
>
> mpi4py version: 1.1.0 -- this is the relevant package
> ipython version: 0.10 -- actually a problem with the documentation
> python version: 2.6.3 -- likely any version of python
>
> I am unable to run the MPI "psum" example appearing in the documentation
> for ipython version 0.10. The psum code can be found on page 81. Here
> is the (very short) function definition, as it appears in the document
> (ipython-0.10.pdf):
>
> from mpi4py import MPI
> import numpy as np
> def psum(a):
> s = np.sum(a)
> return MPI.COMM_
>
> The example continues on page 82, where the user is invited to enter
>
> In [8]: px s = psum(a)
>
> and it is at this point that ipython begins to complain
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (9, 0))
> ...
>
> mercifully ending at last with
>
> CompositeError: one or more exceptions from call to method: execute
> [0:execute]: TypeError: message: expecting a list or tuple
> ...
>
>
> The problem is that the Allreduce function invoked in psum.py does not have
> the proper signature for mpi4py1.1.0, which looks like this:
>
> In [23]: help(MPI.
> Allreduce(...)
> Comm.Allreduce(
>
> To make matters worse, (as far as I can tell) the positional arguments
> can not be ignored -- both are required. And even worse yet, these
> positional arguments need to be lists. Here is a version of psum.py
> that does work with mpi1.1.0
>
> from mpi4py import MPI
> import numpy as np
> def pdum(a):
> s = np.sum(a)
> rcvBuf = np.array(0.0,'d')
> MPI.COMM_
> [rcvBuf, MPI.DOUBLE],
> op=MPI.SUM)
> return rcvBuf
>
> There are likely other incantations that will work -- this is just the
> closest to the given code that I could come up with. One thing is
> certain: the example as supplied will not work with mpi4py1.1.0.
>
> ** Affects: ipython
> Importance: Undecided
> Status: New
>
> --
> psum example fails: mismatch between mpi4py 1.1.0 and ipython 0.10
> documentation
> https:/
> You received this bug notification because you are a member of IPython
> Developers, which is subscribed to IPython.
>
> Status in IPython - Enhanced Interactive Python: New
>
> Bug description:
>
> mpi4py version: 1.1.0 -- this is the relevant package
> ipython version: 0.10 -- actually a problem with the documentation
> python version: 2.6.3 -- likely any version of python
>
> I am unable to run the MPI "psum" example appearing in the documentation
> for ipython version 0.10. The psum code can be found on page 81. Here is
> the (very short) function definition, as it appears in the document
> (ipython-0.10.pdf):
>
> from mpi4py i...