source: CIVL/examples/experimental/sequential/simpleMpiTest.c@ c08afa1

1.23 2.0 main test-branch
Last change on this file since c08afa1 was 9d7c12b, checked in by Ziqing Luo <ziqing@…>, 10 years ago

add translation of MPI_Collective block

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@3017 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 462 bytes
Line 
1#include<mpi.h>
2#include<assert.h>
3
4double * u;
5int nx = 10;
6
7/*@
8 @ \mpi_collective(MPI_COMM_WORLD, P2P):
9 @ requires \mpi_comm_size == 2;
10 @ requires \mpi_comm_rank == x;
11 @*/
12void exchange(int x) {
13 int y;
14 int neighbor = 1 - x;
15
16 MPI_Sendrecv(&x, 1, MPI_INT, neighbor, 0, &y,
17 1, MPI_INT, neighbor, 0,
18 MPI_COMM_WORLD, MPI_STATUS_IGNORE);
19 assert(x + y == 1);
20}
21
22
23int main() {
24 int dummy = 7;
25 exchange(0);
26 dummy=8;
27 return 0;
28}
Note: See TracBrowser for help on using the repository browser.