source: CIVL/examples/experimental/nullPtrBugInReduce.c

main
Last change on this file 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: 608 bytes
Line 
1/* Minimal example of a mismatch in collective calls.
2 * One proc tries to broadcast then reduce, the others
3 * reduce then broadcast. Call with nprocs=2 or higher.
4 */
5#include <mpi.h>
6#include <stdlib.h>
7#define comm MPI_COMM_WORLD
8
9int main(int argc, char * argv[]) {
10 int rank;
11 int x = 1;
12
13 MPI_Init(&argc, &argv);
14 MPI_Comm_rank(comm, &rank);
15 if (rank == 0) {
16 MPI_Bcast(NULL, 0, MPI_INT, 0, comm);
17 MPI_Reduce(NULL, NULL, 0, MPI_INT, MPI_SUM, 0, comm);
18 } else {
19 MPI_Bcast(NULL, 0, MPI_INT, 0, comm);
20 MPI_Reduce(NULL, NULL, 0, MPI_INT, MPI_SUM, 0, comm);
21 }
22 MPI_Finalize();
23}
Note: See TracBrowser for help on using the repository browser.