program template !-- Template for any mpi program implicit none ! highly recommended. It will make ! debugging infinitely easier. !--Include the mpi header file include 'mpif.h' ! --> Required statement !--Declare all variables and arrays. integer ierr,myid,numprocs,itag integer irc,ip real x,y !--Initialize MPI call MPI_INIT( ierr ) ! --> Required statement !--Who am I? --- get my rank=myid call MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr ) !--How many processes in the global group? call MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr ) !--Set the value of x on all processes x=5. !--Define the value of y on each process and print it. do ip=1,numprocs if(myid == ip-1) then y=x**(2+myid) write(*,*)'On process ',myid,' y=',y end if end do !--Finilize MPI call MPI_FINALIZE(irc) ! ---> Required statement stop end