source: CIVL/examples/contracts/isRecvBufEmpty_BAD.c

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

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

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