main
test-branch
| 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 | $assert(nproc >= 2);
|
|---|
| 9 | int a[] = (int[2]) $lambda(int i) rank;
|
|---|
| 10 | if (rank == 0) {
|
|---|
| 11 | int b[2*nproc];
|
|---|
| 12 | MPI_Gather(a, 2, MPI_INT, b, 2, MPI_INT, 0, MPI_COMM_WORLD);
|
|---|
| 13 | $assert($forall (int i:0..nproc-1) (b[2*i]==i && b[2*i+1]==i));
|
|---|
| 14 | } else {
|
|---|
| 15 | MPI_Gather(a, 2, MPI_INT, NULL, 0, MPI_INT, 0, MPI_COMM_WORLD);
|
|---|
| 16 | }
|
|---|
| 17 | MPI_Finalize();
|
|---|
| 18 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.