main
|
Last change
on this file 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
|
| Rev | Line | |
|---|
| [7f8124c] | 1 | #include <mpi.h>
|
|---|
| 2 |
|
|---|
| 3 | int size, rank, x;
|
|---|
| 4 | int root;
|
|---|
| 5 |
|
|---|
| [cc2ac3e] | 6 | /*@ \mpi_collective(MPI_COMM_WORLD, P2P):
|
|---|
| [7f8124c] | 7 | @ requires rank == \mpi_comm_rank;
|
|---|
| 8 | @ requires size == \mpi_comm_size;
|
|---|
| [cc2ac3e] | 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.
|
|---|
| [7f8124c] | 13 | @*/
|
|---|
| [cc2ac3e] | 14 | int wildcard() {
|
|---|
| 15 | if (rank == root) {
|
|---|
| [7f8124c] | 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);
|
|---|
| [cc2ac3e] | 19 | }
|
|---|
| [7f8124c] | 20 | else
|
|---|
| [cc2ac3e] | 21 | MPI_Send(&rank, 1, MPI_INT, root, 0, MPI_COMM_WORLD);
|
|---|
| 22 | return 0;
|
|---|
| [7f8124c] | 23 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.