Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SURF: Unify the types of models in a uniq s_surf_model_t (using an union) +reindent...
[simgrid.git] / examples / smpi / split.c
1 #include <stdio.h>
2 #include <mpi.h>
3
4 int main(int argc, char *argv[])
5 {
6   int worldrank, localrank;
7   MPI_Comm localcomm;
8   MPI_Init(&argc, &argv);
9   MPI_Comm_rank(MPI_COMM_WORLD, &worldrank);
10   MPI_Comm_split(MPI_COMM_WORLD, worldrank % 2, worldrank, &localcomm);
11   MPI_Comm_rank(localcomm, &localrank);
12   printf("node with world rank %d has local rank %d\n", worldrank, localrank);
13   MPI_Finalize();
14   return 0;
15 }