[Fortran] 纯文本查看 复制代码
IF(rank==1)THEN !观察点所处进程不是0进程并且为该观察进程时
call MPI_SEND(TmpEx,1,MPI_REAL,0,19,MPI_COMM_WORLD,ierr)!这边进行发送是发送到0进程,0进程进行接收
call MPI_SEND(TmpEy,1,MPI_REAL,0,20,MPI_COMM_WORLD,ierr)
call MPI_SEND(TmpEz,1,MPI_REAL,0,21,MPI_COMM_WORLD,ierr)
call MPI_SEND(TmpHx,1,MPI_REAL,0,22,MPI_COMM_WORLD,ierr)
call MPI_SEND(TmpHy,1,MPI_REAL,0,23,MPI_COMM_WORLD,ierr)
call MPI_SEND(TmpHz,1,MPI_REAL,0,24,MPI_COMM_WORLD,ierr)
ENDIF
call MPI_Barrier(MPI_COMM_WORLD,IERR) !///这边进程同步
write(*,*),'发送前','rank号',rank
Write(*,'(I3,7e20.10e3)')oby1,Ctime(mstart(num)+mstop(num)-1),TmpHx,TmpHy,TmpHz,&
&TmpEx,TmpEy,TmpEz
call sleep(3)
!!!这边对所传递的数据进行接收,全都在0进程进行接收==================
IF(rank==0)THEN
call MPI_RECV(TmpEx,1,MPI_REAL,1,19,MPI_COMM_WORLD,STATUS,ierr)
call MPI_RECV(TmpEy,1,MPI_REAL,1,20,MPI_COMM_WORLD,STATUS,ierr)
call MPI_RECV(TmpEz,1,MPI_REAL,1,21,MPI_COMM_WORLD,STATUS,ierr)
call MPI_RECV(TmpHx,1,MPI_REAL,1,22,MPI_COMM_WORLD,STATUS,ierr)
call MPI_RECV(TmpHy,1,MPI_REAL,1,23,MPI_COMM_WORLD,STATUS,ierr)
call MPI_RECV(TmpHz,1,MPI_REAL,1,24,MPI_COMM_WORLD,STATUS,ierr)
ENDIF
call MPI_Barrier(MPI_COMM_WORLD,IERR) !///这边进程同步
write(*,*),'接收后','rank号',rank
Write(*,*)oby1,Ctime(mstart(num)+mstop(num)-1),TmpHx,TmpHy,TmpHz,&
&TmpEx,TmpEy,TmpEz
pause 22