source: CIVL/examples/contracts/contractsMPI/wildcard-error.c@ b1e6b3b

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since b1e6b3b was 7f8124c, checked in by Manchun Zheng <zmanchun@…>, 10 years ago

added examples from civl-paper repo

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@3576 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 622 bytes
Line 
1#include <mpi.h>
2
3int size, rank, x;
4int root;
5
6/*@ \mpi_collective[p2p, MPI_COMM_WORLD]:
7 @ requires rank == \mpi_comm_rank;
8 @ requires size == \mpi_comm_size;
9 @ requires 0 <= root < \mpi_comm_size;
10 @ ensures \remote(x, root) == size - 1 ||
11 @ (\remote(x, root) == size - 2 && rank == root); // The ensurance will not hold due to the wildcard.
12 @*/
13void wildcard() {
14 if (rank == root)
15 for (int i = 0; i < size; i++)
16 if (i != root)
17 MPI_Recv(&x, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
18 else
19 MPI_Send(&rank, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
20}
Note: See TracBrowser for help on using the repository browser.