1.23
2.0
acw/focus-triggers
main
test-branch
| Line | |
|---|
| 1 | #include <mpi.h>
|
|---|
| 2 |
|
|---|
| 3 | int size, rank, x;
|
|---|
| 4 | int 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 | @*/
|
|---|
| 13 | void 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.