| 3 | 1/1 | 返回列表 |
| 查看: 577 | 回復: 2 | |||
[求助]
初學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ā)表 | |
|---|---|---|---|---|
|
[考研] 一志愿中南大學化學0703總分337求調(diào)劑 +4 | niko- 2026-03-27 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 291求調(diào)劑 +7 | 孅華 2026-03-22 | 7/350 |
|
|
[考研] 085602 化工專碩 338分 求調(diào)劑 +10 | 路癡小琪 2026-03-27 | 10/500 |
|
|
[考研] 085602 307分 求調(diào)劑 +6 | 不知道叫什么! 2026-03-26 | 6/300 |
|
|
[考研] 考研調(diào)劑 +4 | Sanmu-124 2026-03-26 | 4/200 |
|
|
[考研] 0856調(diào)劑 +5 | 求求讓我有書讀?/a> 2026-03-26 | 6/300 |
|
|
[考研] 299求調(diào)劑 +6 | 嗯嗯嗯嗯2 2026-03-27 | 6/300 |
|
|
[考研] 298調(diào)劑 +3 | jiyingjie123 2026-03-27 | 3/150 |
|
|
[考研] 314求調(diào)劑 +3 | 溪云珂 2026-03-26 | 3/150 |
|
|
[考研] 286求調(diào)劑 +4 | lim0922 2026-03-26 | 4/200 |
|
|
[考研] 324求調(diào)劑 +8 | hanamiko 2026-03-26 | 10/500 |
|
|
[考研] 284求調(diào)劑 +11 | junqihahaha 2026-03-26 | 12/600 |
|
|
[考研] 271求調(diào)劑 +6 | 生如夏花… 2026-03-22 | 6/300 |
|
|
[考研] 材料277求調(diào)劑 +5 | min3 2026-03-24 | 5/250 |
|
|
[考研] 303求調(diào)劑 +6 | 藍山月 2026-03-25 | 6/300 |
|
|
[考研] 材料與化工304求B區(qū)調(diào)劑 +3 | 邱gl 2026-03-25 | 3/150 |
|
|
[考研] 296求調(diào)劑 +4 | 汪?! 2026-03-25 | 7/350 |
|
|
[考博] 26申博自薦 +3 | whh869393 2026-03-24 | 3/150 |
|
|
[考研] 336化工調(diào)劑 +4 | 王大坦1 2026-03-23 | 5/250 |
|
|
[考研] 一志愿北京化工大學070300 學碩336求調(diào)劑 +5 | vv迷 2026-03-21 | 8/400 |
|