1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2005 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
11 * This program checks that the various MPI_Test and MPI_Wait routines
12 * allow both null requests and in the multiple completion cases, empty
16 int main(int argc, char **argv)
19 MPI_Status status, *status_array = 0;
20 int count = 0, flag, idx, rc, errlen, *indices=0, outcnt;
21 MPI_Request *reqs = 0;
22 char errmsg[MPI_MAX_ERROR_STRING];
24 MTest_Init(&argc, &argv);
26 MPI_Comm_set_errhandler( MPI_COMM_WORLD, MPI_ERRORS_RETURN );
28 rc = MPI_Testall( count, reqs, &flag, status_array );
29 if (rc != MPI_SUCCESS) {
30 MPI_Error_string( rc, errmsg, &errlen );
31 printf( "MPI_Testall returned failure: %s\n", errmsg );
35 printf( "MPI_Testall( 0, ... ) did not return a true flag\n") ;
39 rc = MPI_Waitall( count, reqs, status_array );
40 if (rc != MPI_SUCCESS) {
41 MPI_Error_string( rc, errmsg, &errlen );
42 printf( "MPI_Waitall returned failure: %s\n", errmsg );
46 rc = MPI_Testany( count, reqs, &idx, &flag, &status );
47 if (rc != MPI_SUCCESS) {
48 MPI_Error_string( rc, errmsg, &errlen );
49 printf( "MPI_Testany returned failure: %s\n", errmsg );
53 printf( "MPI_Testany( 0, ... ) did not return a true flag\n") ;
57 rc = MPI_Waitany( count, reqs, &idx, &status );
58 if (rc != MPI_SUCCESS) {
59 MPI_Error_string( rc, errmsg, &errlen );
60 printf( "MPI_Waitany returned failure: %s\n", errmsg );
64 rc = MPI_Testsome( count, reqs, &outcnt, indices, status_array );
65 if (rc != MPI_SUCCESS) {
66 MPI_Error_string( rc, errmsg, &errlen );
67 printf( "MPI_Testsome returned failure: %s\n", errmsg );
71 rc = MPI_Waitsome( count, reqs, &outcnt, indices, status_array );
72 if (rc != MPI_SUCCESS) {
73 MPI_Error_string( rc, errmsg, &errlen );
74 printf( "MPI_Waitsome returned failure: %s\n", errmsg );
78 MTest_Finalize( errs );