if ( myid .eq. master ) then
c master initializes and then dispatches A,
b
do 20 j = 1,cols
b(j) = 1
do 10 i = 1,rows
a(i,j) = i
10
continue
20
continue
numsent = 0
c send b to each slave process
call MPI_BCAST(b, cols,
MPI_DOUBLE_PRECISION, master,
& MPI_COMM_WORLD, ierr)
c send a row to each slave process; tag with
row number
do 40 i =
1,min(numprocs-1,rows)
do 30 j = 1,cols
buffer(j) = a(i,j)
30
continue
call MPI_SEND(buffer, cols,
MPI_DOUBLE_PRECISION, i,
& i, MPI_COMM_WORLD, ierr)
numsent = numsent+1
40
continue