You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
537 B
C
26 lines
537 B
C
#include <stdio.h>
|
|
#include <mpi.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
int mi_rank, num_procs;
|
|
char nombre[MPI_MAX_PROCESSOR_NAME];
|
|
int len;
|
|
MPI_Init(&argc, &argv);
|
|
MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &mi_rank);
|
|
MPI_Get_processor_name(nombre, &len);
|
|
|
|
|
|
if(! mi_rank) {
|
|
printf("¡Holas generales!\n");
|
|
printf("Procesos: %d\n", num_procs);
|
|
}
|
|
|
|
printf("¡Hola desde el proceso %d en %s!\n", mi_rank, nombre);
|
|
|
|
MPI_Finalize();
|
|
|
|
return 0;
|
|
}
|
|
|