Hi,
I have been using collective communicatior over intercommunicator. I am
now trying Allgatherv in my code and I got error as follows
File "Comm.pyx", line 478, in mpi4py.MPI.Comm.Allgatherv (src/mpi4py.MPI.c:51479)
File "message.pxi", line 442, in mpi4py.MPI._p_msg_cco.for_allgather (src/mpi4py.MPI.c:16412)
File "message.pxi", line 330, in mpi4py.MPI._p_msg_cco.for_cco_recv (src/mpi4py.MPI.c:15443)
File "message.pxi", line 195, in mpi4py.MPI.message_vector (src/mpi4py.MPI.c:14334)
TypeError: 'mpi4py.MPI.Datatype' object is not iterable
So, I go back Lisandro's example provided for me just modified argument (add 0 as DISPLS) and changed
function from Allgather to Allgatherv
program main
use mpi
implicit none
integer :: parent, rank, val, dummy, ierr
call MPI_Init(ierr)
call MPI_Comm_get_parent(parent, ierr)
call MPI_Comm_rank(parent, rank, ierr)
val = rank + 1
call MPI_Allgatherv(val, 1, MPI_INTEGER, &
dummy, 0,0, MPI_INTEGER, &
parent, ierr)
call MPI_Comm_disconnect(parent, ierr)
call MPI_Finalize(ierr)
end program main
And python.py has been changed only calling Allgatherv (I look at API for Allgatherv which is the same as Allgather)
from mpi4py import MPI
from array import array
import os
progr = os.path.abspath('a.out')
child = MPI.COMM_WORLD.Spawn(progr,[], 8)
n = child.remote_size
a = array('i', [0]) * n
child.Allgatherv([None,
MPI.INT],[a,
MPI.INT])
child.Disconnect()
print a
yildirim@memosa:~/python_intercomm$ mpif90 fortran.f90
yildirim@memosa:~/python_intercomm$ python python.py
Traceback (most recent call last):
File "python.py", line 9, in <module>
child.Allgatherv([None,
MPI.INT],[a,
MPI.INT])
File "Comm.pyx", line 478, in mpi4py.MPI.Comm.Allgatherv (src/mpi4py.MPI.c:51479)
File "message.pxi", line 442, in mpi4py.MPI._p_msg_cco.for_allgather (src/mpi4py.MPI.c:16412)
File "message.pxi", line 330, in mpi4py.MPI._p_msg_cco.for_cco_recv (src/mpi4py.MPI.c:15443)
File "message.pxi", line 195, in mpi4py.MPI.message_vector (src/mpi4py.MPI.c:14334)
TypeError: 'mpi4py.MPI.Datatype' object is not iterable
what am I doing wrong? if you can help me out, I will be thankful,
Thanks
--
B. Gazi YILDIRIM
--
You received this message because you are subscribed to the Google Groups "mpi4py" group.
To post to this group, send email to
mpi...@googlegroups.com.
To unsubscribe from this group, send email to
mpi4py+un...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/mpi4py?hl=en.