我正在尝试使用 NumPy 中的结构化数组在 MPI4Py 中发送和接收数据。以下是我的数组结构:
numpy.zeros(FILE_LINES, dtype='i4,54b')
我正在使用 Sendrecv 方法来交换数据,如下所示:
comm.Sendrecv(data_send, dest=partner_rank, sendtag=data_tag, \
recvbuf=data_receive, source=partner_rank, recvtag=data_tag, status=None)
但是当调用通信方法时出现异常:
Traceback (most recent call last):
File "bipy.py", line 91, in <module>
bitonic_sort()
File "bipy.py", line 72, in bitonic_sort
bitonic_merge(i, ixj, (i & k) == 0)
File "bipy.py", line 51, in bitonic_merge
recvbuf=data_receive, source=partner_rank, recvtag=data_tag, status=None)
File "Comm.pyx", line 166, in mpi4py.MPI.Comm.Sendrecv (src/mpi4py.MPI.c:58898)
File "message.pxi", line 318, in mpi4py.MPI.message_p2p_send (src/mpi4py.MPI.c:21422)
File "message.pxi", line 301, in mpi4py.MPI._p_msg_p2p.for_send (src/mpi4py.MPI.c:21285)
File "message.pxi", line 111, in mpi4py.MPI.message_simple (src/mpi4py.MPI.c:19256)
File "message.pxi", line 58, in mpi4py.MPI.message_basic (src/mpi4py.MPI.c:18509)
KeyError: 'T{=l:f0:(54)b:f1:}'
它在使用只有一种数据类型(例如,所有字节)的数组时有效。MPI4Py 无法发送这些结构化数组,还是我做错了什么?