source: CIVL/examples/mpi/mpi_comm_self-bad.c@ bb03188

main test-branch
Last change on this file since bb03188 was 5ebed95, checked in by Stephen Siegel <siegel@…>, 18 months ago

Implement MPI_COMM_SELF

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5935 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 456 bytes
Line 
1#include <mpi.h>
2#include <assert.h>
3
4int main() {
5 MPI_Init(NULL, NULL);
6
7 int rank, size, data = 42, rbuf;
8 MPI_Comm_rank(MPI_COMM_SELF, &rank);
9 MPI_Comm_size(MPI_COMM_SELF, &size);
10
11 assert(rank == 0 && size == 1);
12
13 // assuming send buffer size is big enough:
14 MPI_Send(&data, 1, MPI_INT, 0, 0, MPI_COMM_SELF);
15 MPI_Recv(&rbuf, 1, MPI_INT, 0, 0, MPI_COMM_SELF, MPI_STATUS_IGNORE);
16
17 assert(rbuf != data);
18
19 MPI_Finalize();
20 return 0;
21}
Note: See TracBrowser for help on using the repository browser.