|
Packit |
0848f5 |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit |
0848f5 |
/*
|
|
Packit |
0848f5 |
* (C) 2005 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 |
#include "mpitest.h"
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
/*
|
|
Packit |
0848f5 |
* This program checks that the various MPI_Test and MPI_Wait routines
|
|
Packit |
0848f5 |
* allow both null requests and in the multiple completion cases, empty
|
|
Packit |
0848f5 |
* lists of requests.
|
|
Packit |
0848f5 |
*/
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
int main(int argc, char **argv)
|
|
Packit |
0848f5 |
{
|
|
Packit |
0848f5 |
int errs = 0;
|
|
Packit |
0848f5 |
MPI_Status status, *status_array = 0;
|
|
Packit |
0848f5 |
int count = 0, flag, idx, rc, errlen, *indices = 0, outcnt;
|
|
Packit |
0848f5 |
MPI_Request *reqs = 0;
|
|
Packit |
0848f5 |
char errmsg[MPI_MAX_ERROR_STRING];
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
MTest_Init(&argc, &argv);
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
rc = MPI_Testall(count, reqs, &flag, status_array);
|
|
Packit |
0848f5 |
if (rc != MPI_SUCCESS) {
|
|
Packit |
0848f5 |
MPI_Error_string(rc, errmsg, &errlen);
|
|
Packit |
0848f5 |
printf("MPI_Testall returned failure: %s\n", errmsg);
|
|
Packit |
0848f5 |
errs++;
|
|
Packit |
0848f5 |
}
|
|
Packit |
0848f5 |
else if (!flag) {
|
|
Packit |
0848f5 |
printf("MPI_Testall(0, ...) did not return a true flag\n");
|
|
Packit |
0848f5 |
errs++;
|
|
Packit |
0848f5 |
}
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
rc = MPI_Waitall(count, reqs, status_array);
|
|
Packit |
0848f5 |
if (rc != MPI_SUCCESS) {
|
|
Packit |
0848f5 |
MPI_Error_string(rc, errmsg, &errlen);
|
|
Packit |
0848f5 |
printf("MPI_Waitall returned failure: %s\n", errmsg);
|
|
Packit |
0848f5 |
errs++;
|
|
Packit |
0848f5 |
}
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
rc = MPI_Testany(count, reqs, &idx, &flag, &status);
|
|
Packit |
0848f5 |
if (rc != MPI_SUCCESS) {
|
|
Packit |
0848f5 |
MPI_Error_string(rc, errmsg, &errlen);
|
|
Packit |
0848f5 |
printf("MPI_Testany returned failure: %s\n", errmsg);
|
|
Packit |
0848f5 |
errs++;
|
|
Packit |
0848f5 |
}
|
|
Packit |
0848f5 |
else if (!flag) {
|
|
Packit |
0848f5 |
printf("MPI_Testany(0, ...) did not return a true flag\n");
|
|
Packit |
0848f5 |
errs++;
|
|
Packit |
0848f5 |
}
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
rc = MPI_Waitany(count, reqs, &idx, &status);
|
|
Packit |
0848f5 |
if (rc != MPI_SUCCESS) {
|
|
Packit |
0848f5 |
MPI_Error_string(rc, errmsg, &errlen);
|
|
Packit |
0848f5 |
printf("MPI_Waitany returned failure: %s\n", errmsg);
|
|
Packit |
0848f5 |
errs++;
|
|
Packit |
0848f5 |
}
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
rc = MPI_Testsome(count, reqs, &outcnt, indices, status_array);
|
|
Packit |
0848f5 |
if (rc != MPI_SUCCESS) {
|
|
Packit |
0848f5 |
MPI_Error_string(rc, errmsg, &errlen);
|
|
Packit |
0848f5 |
printf("MPI_Testsome returned failure: %s\n", errmsg);
|
|
Packit |
0848f5 |
errs++;
|
|
Packit |
0848f5 |
}
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
rc = MPI_Waitsome(count, reqs, &outcnt, indices, status_array);
|
|
Packit |
0848f5 |
if (rc != MPI_SUCCESS) {
|
|
Packit |
0848f5 |
MPI_Error_string(rc, errmsg, &errlen);
|
|
Packit |
0848f5 |
printf("MPI_Waitsome returned failure: %s\n", errmsg);
|
|
Packit |
0848f5 |
errs++;
|
|
Packit |
0848f5 |
}
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
MTest_Finalize(errs);
|
|
Packit |
0848f5 |
MPI_Finalize();
|
|
Packit |
0848f5 |
return 0;
|
|
Packit |
0848f5 |
}
|