Blame test/mpi/coll/allredmany.c

Packit 0848f5
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit 0848f5
/*
Packit 0848f5
 *  (C) 2001 by Argonne National Laboratory.
Packit 0848f5
 *      See COPYRIGHT in top-level directory.
Packit 0848f5
 */
Packit 0848f5
#include <stdio.h>
Packit 0848f5
#include "mpi.h"
Packit 0848f5
Packit 0848f5
/*
Packit 0848f5
 * This example should be run with 2 processes and tests the ability of the
Packit 0848f5
 * implementation to handle a flood of one-way messages.
Packit 0848f5
 */
Packit 0848f5
Packit 0848f5
int main(int argc, char **argv)
Packit 0848f5
{
Packit 0848f5
    double wscale = 10.0, scale;
Packit 0848f5
    int numprocs, myid, i;
Packit 0848f5
Packit 0848f5
    MPI_Init(&argc, &argv);
Packit 0848f5
    MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
Packit 0848f5
    MPI_Comm_rank(MPI_COMM_WORLD, &myid);
Packit 0848f5
Packit 0848f5
    for (i = 0; i < 10000; i++) {
Packit 0848f5
        MPI_Allreduce(&wscale, &scale, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
Packit 0848f5
    }
Packit 0848f5
Packit 0848f5
    if (myid == 0) {
Packit 0848f5
        /* If we get here at all, we're ok */
Packit 0848f5
        printf(" No Errors\n");
Packit 0848f5
    }
Packit 0848f5
    MPI_Finalize();
Packit 0848f5
Packit 0848f5
    return 0;
Packit 0848f5
}