TP-calcul-parallele/TP1/00_Who_am_i/who_am_i.c
2023-06-23 19:34:09 +02:00

27 lines
459 B
C

#include <stdio.h>
#include <mpi.h>
int main( int argc, char *argv[] ) {
int rank, size;
int l;
char name[MPI_MAX_PROCESSOR_NAME];
MPI_Init( &argc, &argv );
// Get rank
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
// Get size
MPI_Comm_size(MPI_COMM_WORLD, &size);
// Get name
MPI_Get_processor_name (name , &l);
printf("Hello world from process %d of %d on processor named %s\n", rank, size, name);
MPI_Finalize();
return 0;
}