MpiHello.c
// MpiHello.c
#include <mpi.h>
#include <stdio.h>
int main(int argc, char** argv)
{
// Initialize the MPI environment
MPI_Init(NULL, NULL);
// Get the number of processes
int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
// Get the rank of the process
int my_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
MPI_Barrier(MPI_COMM_WORLD);
// Print off a hello world message
printf("Hello from process %d out of %d processors\n", my_rank, world_size);
// Finalize the MPI environment.
MPI_Finalize();
}