main
test-branch
|
Last change
on this file since 397ae5f 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:
603 bytes
|
| Rev | Line | |
|---|
| [056aaa8] | 1 | /* This program illustrates assertion checking related
|
|---|
| 2 | * to message data.
|
|---|
| 3 | */
|
|---|
| 4 | #include <stdio.h>
|
|---|
| 5 | #include <mpi.h>
|
|---|
| 6 | #include <assert.h>
|
|---|
| 7 |
|
|---|
| 8 | int main( int argc, char **argv) {
|
|---|
| 9 | int rank, nprocs;
|
|---|
| 10 |
|
|---|
| 11 | MPI_Init(&argc, &argv);
|
|---|
| 12 | MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
|---|
| 13 | MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
|---|
| 14 | if (rank == 0) {
|
|---|
| 15 | MPI_Status status;
|
|---|
| 16 |
|
|---|
| 17 | for (int i = 1; i < nprocs; i++)
|
|---|
| 18 | MPI_Recv(NULL, 0, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD,
|
|---|
| 19 | &status);
|
|---|
| 20 | assert(status.MPI_SOURCE >= 0);
|
|---|
| 21 | }
|
|---|
| 22 | else
|
|---|
| 23 | MPI_Send(NULL, 0, MPI_INT, 0, 0, MPI_COMM_WORLD);
|
|---|
| 24 |
|
|---|
| 25 | MPI_Finalize();
|
|---|
| 26 | return 0;
|
|---|
| 27 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.