Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Massive mv to use cmake as the default compilation infrastructure.
[simgrid.git] / examples / smpi / compute.c
1 #include <stdio.h>
2 #include <mpi.h>
3
4 int main(int argc, char *argv[])
5 {
6   int i;
7   double d;
8   MPI_Init(&argc, &argv);
9   d = 2.0;
10   for (i = 0; i < atoi(argv[1]); i++) {
11     if (d < 10000) {
12       d = d * d;
13     } else {
14       d = 2;
15     }
16   }
17   printf("%d %f\n", i, d);
18   MPI_Comm_rank(MPI_COMM_WORLD, &i);
19   MPI_Finalize();
20   return 0;
21 }