Universidad de Costa Rica
Escuela de Ciencias de la Computación e Informática
CI-0117 Programación paralela y concurrente
Prácticas
|
|
|
CI0117 /
Practicas
/ Semana-14 / |
/* 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<number of processes> ./mpi_output
*
* Input: None
* Output: A message from each process
*
* IPP: Section 3.3.1 (pp. 97 and ff.)
*/
#include <stdio.h>
#include <mpi.h>
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 */