Program example1 c################################################################################## c# # c# This is the first MPI example to demonstrate the use of: # c# # c# * MPI_Init, MPI_Comm_rank, MPI_Comm_size, MPI_Finalize # c# # c# Dr. Kadin Tseng # c# Scientific Computing and Visualization # c# Boston University # c# 1998 # c# # c################################################################################## implicit none integer nprocs, ierr, myid, comm include 'mpif.h' ! brings in pre-defined MPI constants, ... integer status(MPI_STATUS_SIZE) ! size defined in mpif.h comm = MPI_COMM_WORLD call MPI_Init(ierr) ! starts MPI call MPI_Comm_rank(comm, myid, ierr) ! get current proc ID call MPI_Comm_size(comm, nprocs, ierr) ! get number of procs write(*,"('Hello, I am process ',i2,' of ',i2,' processes')") & myid,nprocs call MPI_Finalize(ierr) ! MPI finish up ... end