source: CIVL/examples/experimental/simpleCondBuggy.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: 516 bytes
Line 
1#include<mpi.h>
2#include<assert.h>
3#include<civlc.cvh>
4#include<stdio.h>
5
6$input int x, y;
7$input int _mpi_nprocs=2;
8//$assume (x > y);
9
10int main() {
11 int rank, buf;
12 int data[2];
13
14 MPI_Init(NULL, NULL);
15 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
16 if(!rank)
17 data[0] = x;
18 else
19 data[0] = y;
20 data[1] = rank;
21 MPI_Allreduce(data, data, 1, MPI_2INT, MPI_MINLOC, MPI_COMM_WORLD);
22 printf("data[1] = %d\n", data[1]);
23 MPI_Bcast(&buf, 1, MPI_INT, data[1], MPI_COMM_WORLD);
24 MPI_Finalize();
25 return 0;
26}
Note: See TracBrowser for help on using the repository browser.