main
| Rev | Line | |
|---|
| [5514bd7] | 1 | #include <mpi.h>
|
|---|
| 2 |
|
|---|
| 3 | int main(void) {
|
|---|
| 4 | int nproc, rank;
|
|---|
| 5 | MPI_Init(NULL, NULL);
|
|---|
| 6 | MPI_Comm_size(MPI_COMM_WORLD, &nproc);
|
|---|
| 7 | MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
|---|
| 8 | int a[] = (int[3])$lambda(int i) rank;
|
|---|
| 9 | $assert(nproc >= 2);
|
|---|
| 10 | if (rank == 0)
|
|---|
| 11 | MPI_Send(a, 3, MPI_INT, 1, 0, MPI_COMM_WORLD);
|
|---|
| 12 | else {
|
|---|
| 13 | MPI_Recv(a, 3, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|---|
| 14 | $assert($forall (int i:0 .. 2) a[i] == 0);
|
|---|
| 15 | }
|
|---|
| 16 | MPI_Finalize();
|
|---|
| 17 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.