#include #include #include /* Prototype */ float integral(float ai, float h, int n); void main(int argc, char* argv[]) { /*################################################################################# # # # This is the first MPI example to demonstrate the use of: # # # # * MPI_Init, MPI_Comm_rank, MPI_Comm_size, MPI_Finalize # # # # Dr. Kadin Tseng # # Scientific Computing and Visualization # # Boston University # # 1998 # # # #################################################################################*/ int nprocs, myid, proc, ierr; int master = 0; /* processor performing total sum */ int tag = 123; /* tag is not needed; just gives it a number */ MPI_Comm comm; MPI_Status status; comm = MPI_COMM_WORLD; ierr = MPI_Init(&argc,&argv); /* starts MPI */ MPI_Comm_rank(comm, &myid); /* get current process id */ MPI_Comm_size(comm, &nprocs); /* get number of processes */ printf("Hello, I am process %2d of %2d processes.\n",myid,nprocs); MPI_Finalize(); /* let MPI finish up ... */ }