source: CIVL/mods/dev.civl.abc/examples/contract/quantifiers.c

main
Last change on this file was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

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

  • Property mode set to 100644
File size: 722 bytes
Line 
1#include<assert.h>
2#include<mpi.h>
3#include<civl-mpi.cvh>
4#include<stdio.h>
5#pragma CIVL ACSL
6
7MPI_Comm comm = MPI_COMM_WORLD;
8int rank, nprocs, left, right;
9
10/*@ \mpi_collective(comm, P2P):
11 @ ensures \mpi_empty_in(left) && left == \result;
12 @ ensures \forall int i; i == 0 ==> i > 0;
13 @*/
14int sendrecv()
15{
16 int message = rank;
17 int recvBuf;
18
19 MPI_Sendrecv(&message, 1, MPI_INT, right, 0, &recvBuf, 1, MPI_INT, left, 0, comm, MPI_STATUS_IGNORE);
20 return recvBuf;
21}
22
23int main(int argc, char * argv[]) {
24 int x;
25
26 MPI_Init(&argc, &argv);
27 MPI_Comm_size(comm, &nprocs);
28 MPI_Comm_rank(comm, &rank);
29 left = (rank-1) % nprocs;
30 right = (rank+1) % nprocs;
31 x = sendrecv();
32 MPI_Finalize();
33 return 0;
34}
Note: See TracBrowser for help on using the repository browser.