Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into clean_events
[simgrid.git] / examples / smpi / mc / non_termination2.c
1 #include <stdio.h>
2 #include <mpi.h>
3 #include <simgrid/modelchecker.h>
4
5 int x;
6
7 int main(int argc, char **argv) {
8   int recv_buff;
9   int size;
10   int rank;
11   MPI_Status status;
12
13   MPI_Init(&argc, &argv);
14
15   MPI_Comm_size(MPI_COMM_WORLD, &size);   /* Get nr of tasks */
16   MPI_Comm_rank(MPI_COMM_WORLD, &rank);   /* Get id of this process */
17
18   MC_ignore(&(status.count), sizeof(status.count));
19
20   if (rank == 0) {
21     while (1) {
22       MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
23     }
24   } else {
25     while (1) {
26       x = 2;
27       MPI_Send(&rank, 1, MPI_INT, 0, 42, MPI_COMM_WORLD);
28     }
29   }
30
31   MPI_Finalize();
32
33   return 0;
34 }