main
test-branch
| Line | |
|---|
| 1 | /* Example of a receive buffer that is not big enough to hold
|
|---|
| 2 | * an incoming message. Run with nprocs=2. */
|
|---|
| 3 | #include <mpi.h>
|
|---|
| 4 | #include <stdlib.h>
|
|---|
| 5 | #define comm MPI_COMM_WORLD
|
|---|
| 6 |
|
|---|
| 7 | int main(int argc, char * argv[]) {
|
|---|
| 8 | int rank;
|
|---|
| 9 |
|
|---|
| 10 | MPI_Init(&argc, &argv);
|
|---|
| 11 | MPI_Comm_rank(comm, &rank);
|
|---|
| 12 | if (rank == 0) {
|
|---|
| 13 | int data[2];
|
|---|
| 14 |
|
|---|
| 15 | MPI_Send(data, 2, MPI_INT, 1, 0, comm);
|
|---|
| 16 | } else if (rank == 1) {
|
|---|
| 17 | int rbuf;
|
|---|
| 18 |
|
|---|
| 19 | MPI_Recv(&rbuf, 2, MPI_INT, 0, 0, comm, MPI_STATUS_IGNORE);
|
|---|
| 20 | }
|
|---|
| 21 | MPI_Finalize();
|
|---|
| 22 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.