主题:cvf+mpich2运行错误问题
本人正在学习mpi编程,用的cvf和mpich2,按照教程上的文档写了一个程序,但是用mpiexec运行的时候出现了如下的错误:
process 0 read value 78
process 0 send value 78 ->-> process 1
forrtl: severe (157): Program Exception - access violation Image PC Routine Line Source
fmpich2.dll 10014410 Unknown Unknown Unknown
CVF_MPI.exe 00432749 Unknown Unknown Unknown
CVF_MPI.exe 00427F44 Unknown Unknown Unknown
kernel32.dll 7C817077 Unknown Unknown Unknown
job aborted:
rank: node: exit code[: error message]
0: aquarius: 123
1: aquarius: -1073741667: process 1 exited without calling finalize
2: aquarius: 123
3: aquarius: 123
4: aquarius: 123
5: aquarius: 123
6: aquarius: 123
---------------------------------------------------------------------
源程序如下所示:
Program MainPro
use mpi
character*(MPI_MAX_PROCESSOR_NAME) processor_name
integer*4 :: myid,numprocs,namelen,ic,ierr
integer*4 :: version,subversion,ipvalue
ipvalue = 78
call MPI_INIT(ierr)
CALL MPI_COMM_RANK(MPI_COMM_WORLD,myid,ierr) !current process id number
CALL MPI_COMM_SIZE(MPI_COMM_WORLD,numprocs,ierr) !total number of processes
do while(ipvalue >= 0)
if(myid == 0) then !current process
print *, 'process ',myid,' read value ',ipvalue
if(numprocs > 1) then
CALL MPI_SEND(ipvalue,1,MPI_INT,myid+1,0,MPI_COMM_WORLD,ierr)
print *,'process ',myid,' send value ',ipvalue,' ->-> process ',myid+1
endif
ELSE
call MPI_RECV(ipvalue,1,MPI_INT,myid - 1,0,MPI_COMM_WORLD,ierr)
print *,'process ',myid,' receive value ',ipvalue,' <-<- process ',myid-1
if(myid < numprocs-1) then
call MPI_SEND(ipvalue,1,MPI_INT,myid + 1,0,MPI_COMM_WORLD,ierr)
print *,'process ',myid,' send value ',ipvalue,' ->-> process ',myid+1
endif
endif
call MPI_Barrier(MPI_COMM_WORLD,ierr)
ipvalue = -9
end do
CALL MPI_FINALIZE(rc)
end
不知道问题出在哪里?照着书上的c代码写的。请高手赐教一二。先在此谢过了。
process 0 read value 78
process 0 send value 78 ->-> process 1
forrtl: severe (157): Program Exception - access violation Image PC Routine Line Source
fmpich2.dll 10014410 Unknown Unknown Unknown
CVF_MPI.exe 00432749 Unknown Unknown Unknown
CVF_MPI.exe 00427F44 Unknown Unknown Unknown
kernel32.dll 7C817077 Unknown Unknown Unknown
job aborted:
rank: node: exit code[: error message]
0: aquarius: 123
1: aquarius: -1073741667: process 1 exited without calling finalize
2: aquarius: 123
3: aquarius: 123
4: aquarius: 123
5: aquarius: 123
6: aquarius: 123
---------------------------------------------------------------------
源程序如下所示:
Program MainPro
use mpi
character*(MPI_MAX_PROCESSOR_NAME) processor_name
integer*4 :: myid,numprocs,namelen,ic,ierr
integer*4 :: version,subversion,ipvalue
ipvalue = 78
call MPI_INIT(ierr)
CALL MPI_COMM_RANK(MPI_COMM_WORLD,myid,ierr) !current process id number
CALL MPI_COMM_SIZE(MPI_COMM_WORLD,numprocs,ierr) !total number of processes
do while(ipvalue >= 0)
if(myid == 0) then !current process
print *, 'process ',myid,' read value ',ipvalue
if(numprocs > 1) then
CALL MPI_SEND(ipvalue,1,MPI_INT,myid+1,0,MPI_COMM_WORLD,ierr)
print *,'process ',myid,' send value ',ipvalue,' ->-> process ',myid+1
endif
ELSE
call MPI_RECV(ipvalue,1,MPI_INT,myid - 1,0,MPI_COMM_WORLD,ierr)
print *,'process ',myid,' receive value ',ipvalue,' <-<- process ',myid-1
if(myid < numprocs-1) then
call MPI_SEND(ipvalue,1,MPI_INT,myid + 1,0,MPI_COMM_WORLD,ierr)
print *,'process ',myid,' send value ',ipvalue,' ->-> process ',myid+1
endif
endif
call MPI_Barrier(MPI_COMM_WORLD,ierr)
ipvalue = -9
end do
CALL MPI_FINALIZE(rc)
end
不知道问题出在哪里?照着书上的c代码写的。请高手赐教一二。先在此谢过了。