繁体   English   中英

MPI4Py散点sendbuf参数类型?

[英]MPI4Py Scatter sendbuf Argument Type?

我在MPI4Py Python模块中的Scatter函数遇到问题。 我的假设是我应该能够将其传递给sendbuffer的单个列表。 但是,当我这样做时,或者确实添加了其他两个参数recvbuf和root时,我得到的是一致的错误消息:

  File "code/step3.py", line 682, in subbox_grid
    i = mpi_communicator.Scatter(station_range, station_data)
  File "Comm.pyx", line 427, in mpi4py.MPI.Comm.Scatter (src/
mpi4py_MPI.c:44993)
  File "message.pxi", line 321, in mpi4py.MPI._p_msg_cco.for_scatter
(src/mpi4py_MPI.c:14497)
  File "message.pxi", line 232, in mpi4py.MPI._p_msg_cco.for_cco_send
(src/mpi4py_MPI.c:13630)
  File "message.pxi", line 36, in mpi4py.MPI.message_simple (src/
mpi4py_MPI.c:11904)
ValueError: message: expecting 2 or 3 items

这是相关的代码片段,从上面提到的682几行开始。

for station in stations
        #snip--do some stuff with station
        station_data = []
        station_range = range(1,len(station))
        mpi_communicator = MPI.COMM_WORLD
        i = mpi_communicator.Scatter(station_range, nsm)
        #snip--do some stuff with station[i]
        nsm = combine(avg, wt, dnew, nf1, nl1, wti[i], wtm, station[i].id)
        station_data = mpi_communicator.Gather(station_range, nsm)

我尝试了多种初始化station_range的组合,但是我一定不能正确理解Scatter参数类型。

Python / MPI专家对此有澄清吗?

如果要移动原始缓冲区(与Gather ),请提供一个三元组[buffer, size, type] 查看演示中的示例。 如果你想发送的Python对象,你应该使用更高级别的接口并调用gather (注意是小写),它使用pickle内部。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM