/* MCS 572 Wed 18 Jan 2012 : mpi_hello_world.c
 * a parallel hello world program
 * to compile and run the program
 *   1) mpicc mpi_hello_world.c -o mpi_hello_world
 *   2) mpirun -np 10 mpi_hello_world
 * with the flag "-np 10" we indidate we will use 10 processors. */

#include <stdio.h>
#include <mpi.h>

int main ( int argc, char *argv[] )
{
   int i,p;

   MPI_Init(&argc,&argv);
   MPI_Comm_size(MPI_COMM_WORLD,&p);
   MPI_Comm_rank(MPI_COMM_WORLD,&i);

   printf("Hello world from processor %d out of %d.\n",
          i,p);

   MPI_Finalize();

   return 0;
}

