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:
630 bytes
|
| Rev | Line | |
|---|
| [a9a9973] | 1 | #include<mpi.h>
|
|---|
| 2 | #include<assert.h>
|
|---|
| 3 |
|
|---|
| 4 | int nprocs;
|
|---|
| 5 | int myrank;
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 | void main() {
|
|---|
| 9 | int argc;
|
|---|
| 10 | char **argv;
|
|---|
| 11 | double buf[3];
|
|---|
| 12 | MPI_Status status;
|
|---|
| 13 | int count;
|
|---|
| 14 |
|
|---|
| 15 | MPI_Init(&argc, &argv);
|
|---|
| 16 | MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
|---|
| 17 | if(myrank == 0) {
|
|---|
| 18 | buf[0] = 1.0;
|
|---|
| 19 | buf[1] = 1.1;
|
|---|
| 20 | MPI_Send(&buf[0], 2, MPI_DOUBLE, 1, 0, MPI_COMM_WORLD);
|
|---|
| 21 | } else {
|
|---|
| 22 | buf[0] = 0.0;
|
|---|
| 23 | buf[1] = 0.0;
|
|---|
| 24 | buf[2] = 0.0;
|
|---|
| 25 | MPI_Recv(&buf[0], 3, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &status);
|
|---|
| 26 | MPI_Get_count(&status, MPI_DOUBLE, &count);
|
|---|
| 27 | assert(count == 2);
|
|---|
| 28 | assert(buf[0] == 1.0 && buf[1] == 1.1 && buf[2] == 0.0);
|
|---|
| 29 | }
|
|---|
| 30 | MPI_Finalize();
|
|---|
| 31 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.