我正在阅读MPI4PY教程,并偶然发现错误。
教程代码产生和错误。从这里开始:http://mpi4py.readthedocs.io/en/stable/tutorial.html#point-to-point-communication
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
if rank == 0:
data = {'a': 7, 'b': 3.14}
req = comm.isend(data, dest=1, tag=11)
req.wait()
elif rank == 1:
req = comm.irecv(source=0, tag=11)
data = req.wait()
此代码给出:
$ mpirun -n 8 python3 pywork/esd.py
Traceback (most recent call last):
File "pywork/esd.py", line 37, in <module>
req = comm.irecv(source=0, tag=11)
File "MPI/Comm.pyx", line 1180, in mpi4py.MPI.Comm.irecv (src/mpi4py.MPI.c:95932)
TypeError: irecv() got an unexpected keyword argument 'source'
-------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
-------------------------------------------------------
--------------------------------------------------------------------------
mpirun detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:
Process name: [[28451,1],1]
Exit code: 1
--------------------------------------------------------------------------
所以似乎irecv
没有属性来源。我如何以非阻塞方式与给定流程进行通信?