Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
support MPI_Op_commutative call, as it was already implemented internally
[simgrid.git] / teshsuite / smpi / mpich3-test / coll / allredmany.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *  (C) 2001 by Argonne National Laboratory.
4  *      See COPYRIGHT in top-level directory.
5  */
6 #include <stdio.h>
7 #include "mpi.h"
8
9 /*
10  * This example should be run with 2 processes and tests the ability of the
11  * implementation to handle a flood of one-way messages.
12  */
13
14 int main(int argc, char **argv)
15 {
16     double wscale = 10.0, scale;
17     int numprocs, myid, i;
18
19     MPI_Init(&argc, &argv);
20     MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
21     MPI_Comm_rank(MPI_COMM_WORLD, &myid);
22
23     for (i = 0; i < 1000; i++) {
24         MPI_Allreduce(&wscale, &scale, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
25     }
26
27     if (myid == 0) {
28         /* If we get here at all, we're ok */
29         printf(" No Errors\n");
30     }
31     MPI_Finalize();
32
33     return 0;
34 }