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... if(myid == 0) then y=x**2 else if (myid == 1) then y=x**3 else if (myid == 2) then y=x**4 end if !--..and print it. write(*,*)'On process ',myid,' y=',y !--Finilize MPI call MPI_FINALIZE(irc) ! ---> Required statement stop end