source: CIVL/examples/contracts/contractsMPI/wildcard-good.c@ 3b8cd00

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 3b8cd00 was 3b8cd00, checked in by Ziqing Luo <ziqing@…>, 10 years ago

commit progress

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

  • Property mode set to 100644
File size: 600 bytes
Line 
1#include <mpi.h>
2
3int size, rank, x;
4int root;
5
6/*@ \mpi_collective(MPI_COMM_WORLD, P2P):
7 @ requires rank == \mpi_comm_rank;
8 @ requires size == \mpi_comm_size;
9 @ requires 0 <= root < \mpi_comm_size;
10 @ ensures \on(root, x) == size - 1 ||
11 @ (\on(root, x) == size - 2 && rank == root); // The ensurance will not hold due to the wildcard.
12 @*/
13int wildcard() {
14 if (rank == root)
15 for (int i = 0; i < size; i++)
16 if (i != root)
17 MPI_Recv(&x, 1, MPI_INT, i, 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.