source: CIVL/mods/dev.civl.abc/examples/contract/isRecvBufEmpty_BAD.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: 636 bytes
Line 
1#include<assert.h>
2#include<mpi.h>
3#include<civl-mpi.cvh>
4#include<stdio.h>
5#pragma CIVL ACSL
6
7$input int in;
8$input int _mpi_nprocs = 2;
9$assume(in > 0);
10MPI_Comm comm = MPI_COMM_WORLD;
11int rank;
12
13/*@
14 @ requires x > 0;
15 @ ensures x == in;
16 @ \mpi_collective(comm, BOTH):
17 @ ensures x == in;
18 @
19 */
20int gimmeOne(int x)
21{
22 return 1 + x;
23}
24
25int main(int argc, char * argv[]) {
26 int x;
27
28 MPI_Init(&argc, &argv);
29 MPI_Comm_rank(comm, &rank);
30 if(rank == 1)
31 MPI_Send(&rank, 1, MPI_INT, 0, 0, comm);
32 x = gimmeOne(in);
33 if(rank == 0)
34 MPI_Recv(&x, 1, MPI_INT, 1, 0, comm, MPI_STATUS_IGNORE);
35 MPI_Finalize();
36}
37
38
Note: See TracBrowser for help on using the repository browser.