source: CIVL/examples/mpi/simple/bcast_int.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: 389 bytes
Line 
1/* Good broadcasts.
2 */
3#include<mpi.h>
4#include<assert.h>
5
6int nprocs;
7int myrank;
8
9void main() {
10 int argc;
11 char **argv;
12 int x;
13 int y;
14
15 MPI_Init(&argc, &argv);
16 MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
17 x=myrank;
18 y=myrank;
19 MPI_Bcast(&x, 1, MPI_INT, 0, MPI_COMM_WORLD);
20 MPI_Bcast(&y, 1, MPI_INT, 1, MPI_COMM_WORLD);
21 assert(x==0);
22 assert(y==1);
23 MPI_Finalize();
24}
Note: See TracBrowser for help on using the repository browser.