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

main test-branch
Last change on this file since bb03188 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

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

  • Property mode set to 100644
File size: 678 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 && root < \mpi_comm_size;
10 @ requires \mpi_agree(root);
11 @ ensures \on(root, x) == size - 1 ||
12 @ (\on(root, x) == size - 2 && size - 1 == root); // The ensurance will not hold due to the wildcard.
13 @*/
14int wildcard() {
15 if (rank == root) {
16 for (int i = 0; i < size; i++)
17 if (i != root)
18 MPI_Recv(&x, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
19 }
20 else
21 MPI_Send(&rank, 1, MPI_INT, root, 0, MPI_COMM_WORLD);
22 return 0;
23}
Note: See TracBrowser for help on using the repository browser.