|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* (C) 2003 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#include "mpi.h"
|
|
Packit Service |
c5cf8c |
#include <stdio.h>
|
|
Packit Service |
c5cf8c |
#include <stdlib.h>
|
|
Packit Service |
c5cf8c |
#include "mpitest.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
* This test attempts MPI_Recv with the source being a dead process. It should fail
|
|
Packit Service |
c5cf8c |
* and return an error. If we are testing sufficiently new MPICH, we look for the
|
|
Packit Service |
c5cf8c |
* MPIX_ERR_PROC_FAILED error code. These should be converted to look for the
|
|
Packit Service |
c5cf8c |
* standarized error code once it is finalized.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
int main(int argc, char **argv)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int rank, size, err, errclass, toterrs = 0;
|
|
Packit Service |
c5cf8c |
char buf[10];
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Init(&argc, &argv);
|
|
Packit Service |
c5cf8c |
MPI_Comm_rank(MPI_COMM_WORLD, &rank;;
|
|
Packit Service |
c5cf8c |
MPI_Comm_size(MPI_COMM_WORLD, &size);
|
|
Packit Service |
c5cf8c |
if (size < 2) {
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "Must run with at least 2 processes\n");
|
|
Packit Service |
c5cf8c |
MPI_Abort(MPI_COMM_WORLD, 1);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (rank == 1) {
|
|
Packit Service |
c5cf8c |
exit(EXIT_FAILURE);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (rank == 0) {
|
|
Packit Service |
c5cf8c |
MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
|
|
Packit Service |
c5cf8c |
err = MPI_Recv(buf, 1, MPI_CHAR, 1, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
#if defined (MPICH) && (MPICH_NUMVERSION >= 30100102)
|
|
Packit Service |
c5cf8c |
MPI_Error_class(err, &errclass);
|
|
Packit Service |
c5cf8c |
if (errclass == MPIX_ERR_PROC_FAILED) {
|
|
Packit Service |
c5cf8c |
printf(" No Errors\n");
|
|
Packit Service |
c5cf8c |
fflush(stdout);
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "Wrong error code (%d) returned. Expected MPIX_ERR_PROC_FAILED\n",
|
|
Packit Service |
c5cf8c |
errclass);
|
|
Packit Service |
c5cf8c |
toterrs++;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
#else
|
|
Packit Service |
c5cf8c |
if (err) {
|
|
Packit Service |
c5cf8c |
printf(" No Errors\n");
|
|
Packit Service |
c5cf8c |
fflush(stdout);
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "Program reported MPI_SUCCESS, but an error code was expected.\n");
|
|
Packit Service |
c5cf8c |
toterrs++;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Finalize();
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
return MTestReturnValue(toterrs);
|
|
Packit Service |
c5cf8c |
}
|