1.23
2.0
main
test-branch
| Rev | Line | |
|---|
| [4e62451] | 1 | #include<mpi.h>
|
|---|
| [9d7c12b] | 2 | #include<assert.h>
|
|---|
| [cce30c6] | 3 | #include<civlc.cvh>
|
|---|
| [4e62451] | 4 |
|
|---|
| 5 | double * u;
|
|---|
| 6 | int nx = 10;
|
|---|
| 7 |
|
|---|
| 8 | /*@
|
|---|
| [9d7c12b] | 9 | @ \mpi_collective(MPI_COMM_WORLD, P2P):
|
|---|
| [9074a6e] | 10 | @ requires \mpi_comm_size == 2;
|
|---|
| 11 | @ requires \mpi_comm_rank == x;
|
|---|
| [4e62451] | 12 | @*/
|
|---|
| [9d7c12b] | 13 | void exchange(int x) {
|
|---|
| 14 | int y;
|
|---|
| 15 | int neighbor = 1 - x;
|
|---|
| 16 |
|
|---|
| 17 | MPI_Sendrecv(&x, 1, MPI_INT, neighbor, 0, &y,
|
|---|
| 18 | 1, MPI_INT, neighbor, 0,
|
|---|
| 19 | MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|---|
| 20 | assert(x + y == 1);
|
|---|
| [4e62451] | 21 | }
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | int main() {
|
|---|
| 25 | int dummy = 7;
|
|---|
| [9d7c12b] | 26 | exchange(0);
|
|---|
| [4e62451] | 27 | dummy=8;
|
|---|
| [cce30c6] | 28 | $havoc(NULL);
|
|---|
| [4e62451] | 29 | return 0;
|
|---|
| 30 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.