1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2001 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
8 #include "mpitestconf.h"
14 static int verbose = 0;
16 int main(int argc, char *argv[]);
17 int parse_args(int argc, char **argv);
19 int main(int argc, char *argv[])
21 int i, err, errs = 0, rank, toterrs;
24 MPI_Request requests[10];
25 MPI_Status statuses[10];
27 MPI_Init(&argc, &argv);
28 parse_args(argc, argv);
30 for (i=0; i < 10; i++) {
31 requests[i] = MPI_REQUEST_NULL;
35 /* To improve reporting of problems about operations, we
36 change the error handler to errors return */
37 MPI_Comm_set_errhandler( MPI_COMM_WORLD, MPI_ERRORS_RETURN );
39 err = MPI_Waitany(10, requests, &index, statuses);
41 if (err != MPI_SUCCESS) {
43 fprintf(stderr, "MPI_Waitany did not return MPI_SUCCESS\n");
46 if (index != MPI_UNDEFINED) {
48 fprintf(stderr, "MPI_Waitany did not set index to MPI_UNDEFINED\n");
53 MPI_Comm_set_errhandler( MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL );
54 MPI_Comm_rank( MPI_COMM_WORLD, & rank );
55 MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
58 fprintf(stderr, " Found %d errors\n", toterrs);
61 printf(" No Errors\n");
68 int parse_args(int argc, char **argv)
73 while ((ret = getopt(argc, argv, "v")) >= 0)
82 if (argc > 1 && strcmp(argv[1], "-v") == 0)