/* File: mpi_output.c * * Purpose: A program in which multiple MPI processes try to print * a message. * * Compile: mpicc -g -Wall -o mpi_output mpi_output.c * Usage: mpiexec -n ./mpi_output * * Input: None * Output: A message from each process * * IPP: Section 3.3.1 (pp. 97 and ff.) */ #include #include int main(void) { int my_rank, comm_sz; MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &comm_sz); MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); printf("Proc %d of %d > Does anyone have a toothpick?\n", my_rank, comm_sz); MPI_Finalize(); return 0; } /* main */