source: CIVL/examples/mpi/mpiFeature/mpi_opnull_reduce.c@ beab7f2

main test-branch
Last change on this file since beab7f2 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: 751 bytes
RevLine 
[1888049]1#include <mpi.h>
2#include <stdio.h>
3
4#define buff_size 128
5
6int main(int argc, char **argv) {
7 int nprocs = -1;
8 int rank = -1;
9 int root = 0;
10 int size = 1, j = 0;
11
12 MPI_Init(&argc, &argv);
13 MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
14 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
15 printf("Hello from rank %d \n", rank);
16
17 if (nprocs < 2)
18 printf("This test needs at least 2 processes to produce a bug!\n");
19
20 MPI_Comm newcom = MPI_COMM_WORLD;
21 MPI_Op op = MPI_SUM;
22 MPI_Datatype type = MPI_INT;
23
24 int dbs = sizeof(int) * nprocs;
25
26 op = MPI_OP_NULL;
27
28 int sum1, val1 = 1;
29
30 MPI_Reduce(&val1, &sum1, 1, type, op, root, newcom);
31
32 MPI_Finalize();
33 printf("Rank %d finished normally\n", rank);
34 return 0;
35}
Note: See TracBrowser for help on using the repository browser.