1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | #include<mpi.h>
|
|---|
| 2 | #include<assert.h>
|
|---|
| 3 | #include<civlc.cvh>
|
|---|
| 4 |
|
|---|
| 5 | double * u;
|
|---|
| 6 | int nx = 10;
|
|---|
| 7 |
|
|---|
| 8 | /*@
|
|---|
| 9 | @ \mpi_collective(MPI_COMM_WORLD, P2P):
|
|---|
| 10 | @ requires \mpi_comm_size == 2;
|
|---|
| 11 | @ requires \mpi_comm_rank == x;
|
|---|
| 12 | @*/
|
|---|
| 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);
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | int main() {
|
|---|
| 25 | int dummy = 7;
|
|---|
| 26 | exchange(0);
|
|---|
| 27 | dummy=8;
|
|---|
| 28 | $havoc(NULL);
|
|---|
| 29 | return 0;
|
|---|
| 30 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.