subroutine dostuff ( id, p ) include 'mpif.h' integer i, id, ierr, j, p, src, tag, target double precision x(1000), x_max, x_max_local if ( id == 0 ) then <--MASTER creates data and sends it do i = 1, p - 1 do j = 1, 1000 x(j) = rand ( ) end do target = i tag = 1 call MPI_Send ( x, 1000, MPI_DOUBLE_PRECISION, target, tag, & MPI_COMM_WORLD, ierr ) end do else <-- WORKERS receive data src = 0 tag = 1 call MPI_Recv ( x, 1000, MPI_DOUBLE_PRECISION, src, tag, & MPI_COMM_WORLD, status, ierr ) end if