2009-05-03 2 views
2

MPI4Py Python 모듈의 분산 기능에 문제가 있습니다. 내 가정은 sendbuffer에 대한 단일 목록을 전달할 수 있어야한다는 것입니다. 그러나, 나는 다른 두 개의 인수, recvbuf 루트 추가 참으로 내가 그렇게 할 때 일관성있는 오류 메시지를 받고, 또는 해요 : 여기MPI4Py Scatter sendbuf 인수 유형?

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를 초기화 조합의 숫자를 시도했습니다,하지만 난 적절히 분산 인수 유형을 이해하지 않아야합니다.

파이썬/MPI 전문가는 이것을 명확하게 설명합니까?

답변

6

원시 버퍼를 이동하려는 경우 (Gather과 같이) 세 쌍을 [buffer, size, type]으로 입력하십시오. 이 예제에 대한 데모를보십시오. 파이썬 객체를 보내려면 상위 인터페이스를 사용하고 내부적으로 pickle을 사용하는 gather (소문자 참고)을 호출해야합니다.

+0

젠드,이 질문에 =) 나는 코드를 풀어서 답을 확인해야 할 것입니다 ... – Noel

관련 문제