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:
671 bytes
|
| Line | |
|---|
| 1 | #include <mpi.h>
|
|---|
| 2 |
|
|---|
| 3 | int size, rank;
|
|---|
| 4 | int root;
|
|---|
| 5 | int x;
|
|---|
| 6 |
|
|---|
| 7 | /*@ \mpi_collective(MPI_COMM_WORLD, P2P):
|
|---|
| 8 | @ requires rank == \mpi_comm_rank;
|
|---|
| 9 | @ requires size == \mpi_comm_size;
|
|---|
| 10 | @ requires 0 <= root && root < \mpi_comm_size;
|
|---|
| 11 | @ requires \mpi_agree(root);
|
|---|
| 12 | @ requires datatype == MPI_INT;
|
|---|
| 13 | @ ensures \on(root, x) == size - 1 ||
|
|---|
| 14 | @ (\on(root, x) == size - 2 && size - 1 == root);
|
|---|
| 15 | @*/
|
|---|
| 16 | int wildcard(MPI_Datatype datatype) {
|
|---|
| 17 | if (rank == root) {
|
|---|
| 18 | for (int i = 0; i < size; i++)
|
|---|
| 19 | if (i != root)
|
|---|
| 20 | MPI_Recv(&x, 1, datatype, i, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|---|
| 21 | } else
|
|---|
| 22 | MPI_Send(&rank, 1, datatype, root, 0, MPI_COMM_WORLD);
|
|---|
| 23 | return 0;
|
|---|
| 24 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.