main
test-branch
| 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 |
|
|---|
| 7 | double x;
|
|---|
| 8 | double y;
|
|---|
| 9 |
|
|---|
| 10 | void 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.