source: CIVL/examples/experimental/sequential/simpleMpiTest.c@ 8a8a3a5

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

working on a transformer for contracts

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

  • Property mode set to 100644
File size: 498 bytes
Line 
1#include<mpi.h>
2#include<assert.h>
3#include<civlc.cvh>
4
5double * u;
6int nx = 10;
7
8/*@
9 @ \mpi_collective(MPI_COMM_WORLD, P2P):
10 @ requires \mpi_comm_size == 2;
11 @ requires \mpi_comm_rank == x;
12 @*/
13void 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
24int 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.