COMPUTEPI.f
program main
include "mpif.h"
double precision PI25DT
parameter (PI25DT
=3.141592653589793238462643d0)
double precision mypi, pi, h, sum, x, f, a
double precision starttime,
endtime
integer n, myid, numprocs, i,
ierr
c function to integrate
f(a) = 4.d0 / (1.d0 + a*a)
call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD,
myid, ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD,
numprocs, ierr)
10if ( myid .eq. 0 ) then
print *, 'Enter the number of
intervals: (0 quits) '
read(*,*) n
endif