27 lines
459 B
C
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;
|
||
|
}
|