source: CIVL/examples/contracts/contractsMPI/simpleMpiTest.c@ de60512

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

move contracts examples out of experimental folder

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

  • Property mode set to 100644
File size: 502 bytes
RevLine 
[4e62451]1#include<mpi.h>
[9d7c12b]2#include<assert.h>
[cce30c6]3#include<civlc.cvh>
[4e62451]4
5double * u;
6int 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]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);
[4e62451]21}
22
23
24int 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.