回 帖 发 新 帖 刷新版面

主题:Fotran中最简单的MPI例子报错

各位大虾:

      本人正在学习MPI,今天刚刚运行了第一个例子,是一个最简单的Send-receive的例子,但是程序执行时报错了,请问这是怎么回事?

附上程序段:

program main

  use mpi
  integer a(10)
  integer myrank,ierr,rc
  call MPI_INIT(ierr)
  call MPI_COMM_RANK(MPI_COMM_WORLD,myrank,ierr)


  if(myrank==1) then
    a=1
    call MPI_SEND(a,10,MPI_INTEGER,0,99,MPI_COMM_WORLD,ierr)
  else
    call MPI_RECV(a,20,MPI_INTEGER,1,99,MPI_COMM_WORLD,ierr)
    print *,"received:",a
  endif 
  call MPI_FINALIZE(rc) 

end



报错情况

forrtl: severe (157): Program Exception - access violation Image              PC                Routine            Line        Source             
fmpich2.dll        00000001800190C5  Unknown               Unknown  Unknown
MPI.exe            000000013F321103  Unknown               Unknown  Unknown
MPI.exe            000000013F36F67C  Unknown               Unknown  Unknown
MPI.exe            000000013F357C4B  Unknown               Unknown  Unknown
kernel32.dll       0000000077B8F34D  Unknown               Unknown  Unknown
ntdll.dll          0000000077CC2CA1  Unknown               Unknown  Unknown


job aborted:
rank: node: exit code[: error message]
0: Kingbo-PC: 157: process 0 exited without calling finalize
1: Kingbo-PC: 123
2: Kingbo-PC: 123

回复列表 (共1个回复)

沙发

问题已经解决了,是因为MPI_RECV函数缺少status参数!

我来回复

您尚未登录,请登录后再回复。点此登录或注册