High Performance Computing 1
MatVec.f
•
do 70 i = 1,rows       
call MPI_RECV(ans, 1, MPI_DOUBLE_PRECISION,     
     &                 MPI_ANY_SOURCE, MPI_ANY_TAG,     
     &                 MPI_COMM_WORLD, status, ierr)       
sender     = status(MPI_SOURCE)           
anstype    = status(MPI_TAG)     ! row is tag value       
c(anstype) = ans       
if (numsent .lt. rows) then        ! send another row          
do 50 j = 1,cols            
  buffer(j) = a(numsent+1,j)
50            continue          
call MPI_SEND(buffer, cols, MPI_DOUBLE_PRECISION,     
    &                   sender, numsent+1, MPI_COMM_WORLD, ierr)          
numsent = numsent+1       
else      ! Tell sender that there is no more work           call MPI_SEND(MPI_BOTTOM, 0, MPI_DOUBLE_PRECISION,     
    &                    sender, 0, MPI_COMM_WORLD, ierr)       
endif
70            continue