Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into adrien
[simgrid.git] / teshsuite / smpi / mpich3-test / pt2pt / waitany-null.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 <stdlib.h>
8 #include "mpitestconf.h"
9 #ifdef HAVE_STRING_H
10 #include <string.h>
11 #endif
12 #include "mpi.h"
13
14 int main(int argc, char *argv[]);
15 int parse_args(int argc, char **argv);
16
17 int main(int argc, char *argv[])
18 {
19     int i, err, errs = 0, rank, toterrs;
20
21     int index;
22     MPI_Request requests[10];
23     MPI_Status statuses[10];
24
25     MPI_Init(&argc, &argv);
26     parse_args(argc, argv);
27
28     for (i = 0; i < 10; i++) {
29         requests[i] = MPI_REQUEST_NULL;
30     }
31
32     /* begin testing */
33     /* To improve reporting of problems about operations, we
34      * change the error handler to errors return */
35     MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
36
37     err = MPI_Waitany(10, requests, &index, statuses);
38
39     if (err != MPI_SUCCESS) {
40         errs++;
41         fprintf(stderr, "MPI_Waitany did not return MPI_SUCCESS\n");
42     }
43
44     if (index != MPI_UNDEFINED) {
45         errs++;
46         fprintf(stderr, "MPI_Waitany did not set index to MPI_UNDEFINED\n");
47     }
48
49     /* end testing */
50
51     MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL);
52     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
53     MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
54     if (rank == 0) {
55         if (toterrs) {
56             fprintf(stderr, " Found %d errors\n", toterrs);
57         }
58         else {
59             printf(" No Errors\n");
60         }
61     }
62     MPI_Finalize();
63     return 0;
64 }
65
66 int parse_args(int argc, char **argv)
67 {
68     /*
69      * int ret;
70      *
71      * while ((ret = getopt(argc, argv, "v")) >= 0)
72      * {
73      * switch (ret) {
74      * case 'v':
75      * verbose = 1; <-- never used, thus removed
76      * break;
77      * }
78      * }
79      */
80     return 0;
81 }