| 3 | 1/1 | 返回列表 |
| 查看: 575 | 回復(fù): 2 | |||
[求助]
初學(xué)MPI,以下Fortran程序請教
|
|
以下程序編譯后運行: mpiexec -n 4 test.exe 出現(xiàn)如下結(jié)果: myid= 2 results( 3 )= 10 myid= 1 results( 2 )= 10 myid= 3 results( 4 )= 10 myid= 0 results( 1 )= 10 results( 1 )= 10 results( 2 )= -842150451 results( 3 )= -842150451 results( 4 )= -842150451 期望所有輸出結(jié)果均為10,請問哪里錯了? 謝謝! 附:Fortran程序: program test implicit none include 'mpif.h' integer::i integer rank, size, myid, ierror,commandsize integer,allocatable::results( ![]() commandsize=4 allocate(results(commandsize)) call MPI_INIT(ierror) call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror) call MPI_COMM_RANK(MPI_COMM_WORLD, myid, ierror) write(*,*)'myid=',myid results(myid+1)=10 write(*,*)'results(',myid+1,')=',results(myid+1) call MPI_ALLGATHER(results,commandsize,MPI_INTEGER,results,commandsize,MPI_INTEGER,MPI_COMM_WORLD,ierror) if(myid==0)then do i=1,commandsize write(*,*)'results(',i,')=',results(i) enddo endif call MPI_FINALIZE(ierror) deallocate(results) end |
資源收集 |
金蟲 (小有名氣)

| 3 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 352分 化工與材料 +5 | 海納百川Ly 2026-03-27 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 085602 307分 求調(diào)劑 +6 | 不知道叫什么! 2026-03-26 | 6/300 |
|
|
[考研] 266分求材料化工冶金礦業(yè)等專業(yè)的調(diào)劑 +4 | 哇呼哼呼哼 2026-03-26 | 4/200 |
|
|
[考研] 一志愿北京化工大學(xué) 070300 學(xué)碩 336分 求調(diào)劑 +9 | vv迷 2026-03-22 | 9/450 |
|
|
[考研] 07化學(xué)280分求調(diào)劑 +10 | 722865 2026-03-23 | 10/500 |
|
|
[考研] 348求調(diào)劑 +4 | 小懶蟲不懶了 2026-03-27 | 5/250 |
|
|
[考研] 一志愿鄭大085600,310分求調(diào)劑 +5 | 李瀟可 2026-03-26 | 5/250 |
|
|
[考研] 276求調(diào)劑。有半年電池和半年高分子實習(xí)經(jīng)歷 +10 | 材料學(xué)257求調(diào)劑 2026-03-23 | 11/550 |
|
|
[考研] 一志愿北化求調(diào)劑 +3 | Jsman 2026-03-22 | 3/150 |
|
|
[考研] 286求調(diào)劑 +13 | Faune 2026-03-21 | 13/650 |
|
|
[考研] 材料考研求調(diào)劑 +3 | Dendel 2026-03-23 | 6/300 |
|
|
[考研] 081700 調(diào)劑 267分 +11 | 迷人的哈哈 2026-03-23 | 11/550 |
|
|
[考研] 生物技術(shù)與工程 +3 | 1294608413 2026-03-25 | 4/200 |
|
|
[考研] 求b區(qū)院校調(diào)劑 +4 | 周56 2026-03-24 | 5/250 |
|
|
[考研] 各位老師您好:本人初試372分 +5 | jj涌77 2026-03-25 | 6/300 |
|
|
[考研] 282求調(diào)劑 +3 | wcq131415 2026-03-24 | 3/150 |
|
|
[考研] 求調(diào)劑一志愿武漢理工大學(xué)材料工程(085601) +5 | WW.' 2026-03-23 | 7/350 |
|
|
[考研] 285求調(diào)劑 +6 | ytter 2026-03-22 | 6/300 |
|
|
[考研] 一志愿南大,0703化學(xué),分?jǐn)?shù)336,求調(diào)劑 +3 | 收到VS 2026-03-21 | 3/150 |
|
|
[考研] 求調(diào)劑 +3 | .m.. 2026-03-21 | 4/200 |
|