Ticket #39438: hw_mpi.c

File hw_mpi.c, 350 bytes (added by hans.ekkehard.plesser@…, 11 years ago)
Line 
1#include <stdio.h>
2
3#include <mpi.h>
4
5int main(int argc, char **argv)
6{
7  int provided;
8  MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED, &provided);
9
10  printf("Provided threading level: %d.\n", provided);
11
12  int rank;
13  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
14
15  printf("Hello, world! This is rank %d.\n", rank);
16
17  MPI_Finalize();
18  return 0;
19}