rendered paste body Program test
USE MPI
real,target ::vector (100)
integer status (MPI_STATUS_SIZE)
integer p,my_rank,ierr
integer i,source,dest,count,tag
pointer point(:)
point=>vector
vector=30
call MPI_INIT(ierr)
call MPI_COMM_rank(MPI_COMM_WORLD,my_rank,ierr)
call MPI_COMM_size(MPI_COMM_WORLD,p,ierr)
source=0
if (my_rank==0) then
tag=47
count=50
dest=1
call MPI_SEND(point(51),count,MPI_REAL,dest,tag,MPI_COMM_WORLD&
,ierr)
tag=47
count=50
source=1
call MPI_RECV(point(51),count,MPI_REAL,source,tag,MPI_COMM_WORLD,&
status,ierr)
else
tag=47
count=50
source=0
call MPI_RECV(point(51),count,MPI_REAL,source,tag,MPI_COMM_WORLD,&
status,ierr)
do i=1,count
point(50+i)= 15
enddo
tag=47
count=50
dest=0
call MPI_SEND(point(51),count,MPI_REAL,dest,tag,MPI_COMM_WORLD&
,ierr)
endif
call MPI_Finalize(ierr)
do i=50,100
write (*,*) vector(i),point(i)
enddo
END