簡體   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