source: CIVL/examples/mpi/simple/noninterference2.c@ bb03188

main test-branch
Last change on this file since bb03188 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: 676 bytes
Line 
1/* Illustrates non-interference of collectives and point-to-point operations.
2 * Program is erroneous since a collective is interspersed between a matching
3 * send and recv. It will work correctly if buffering, but not synchronously.
4 */
5#include <mpi.h>
6
7double x;
8double y;
9
10void main() {
11 int argc;
12 char **argv;
13 int rank;
14
15 x = 0;
16 y = 0;
17 MPI_Init(&argc,&argv);
18 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
19 if (rank==0) {
20 MPI_Send(&x, 1, MPI_DOUBLE, 1, 0, MPI_COMM_WORLD);
21 }
22 MPI_Bcast(&y, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD);
23 if (rank==1) {
24 MPI_Recv(&x, 1, MPI_DOUBLE, 0, MPI_ANY_TAG, MPI_COMM_WORLD,
25 MPI_STATUS_IGNORE);
26 }
27 MPI_Finalize();
28}
Note: See TracBrowser for help on using the repository browser.