Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
aafca4d25093d407b55c488a8e0957ce6e7c48b4
[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, size, rank;
9   MPI_Status status;
10
11   MPI_Init(&argc, &argv);
12
13   MPI_Comm_size(MPI_COMM_WORLD, &size);   /* Get nr of tasks */
14   MPI_Comm_rank(MPI_COMM_WORLD, &rank);   /* Get id of this process */
15
16   MC_ignore(&(status.count), sizeof(status.count));
17
18   if (rank == 0) {
19     while (1) {
20       MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
21     }
22   } else {
23     while (1) {
24       x = 2;
25       MPI_Send(&rank, 1, MPI_INT, 0, 42, MPI_COMM_WORLD);
26     }
27   }
28
29   MPI_Finalize();
30
31   return 0;
32 }