Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid into no_simix_global
[simgrid.git] / examples / smpi / mc / non_termination2.c
1 /* Copyright (c) 2015-2021. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include <stdio.h>
7 #include <mpi.h>
8 #include <simgrid/modelchecker.h>
9
10 int x;
11
12 int main(int argc, char **argv) {
13   int recv_buff;
14   int size;
15   int rank;
16   MPI_Status status;
17
18   MPI_Init(&argc, &argv);
19
20   MPI_Comm_size(MPI_COMM_WORLD, &size);   /* Get nr of tasks */
21   MPI_Comm_rank(MPI_COMM_WORLD, &rank);   /* Get id of this process */
22
23   MC_ignore(&status.count, sizeof status.count);
24
25   if (rank == 0) {
26     while (1) {
27       MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
28     }
29   } else {
30     while (1) {
31       x = 2;
32       MPI_Send(&rank, 1, MPI_INT, 0, 42, MPI_COMM_WORLD);
33     }
34   }
35
36   MPI_Finalize();
37
38   return 0;
39 }