|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* (C) 2013 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 communication between 2 running processes
|
|
Packit Service |
c5cf8c |
* after another process has failed. The communication should complete
|
|
Packit Service |
c5cf8c |
* successfully.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
int main(int argc, char **argv)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int rank, size, errs, toterrs = 0;
|
|
Packit Service |
c5cf8c |
char buf[10];
|
|
Packit Service |
c5cf8c |
MPI_Request request;
|
|
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 |
MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (size < 4) {
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "Must run with at least 4 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 |
errs = MPI_Issend("No Errors", 10, MPI_CHAR, 3, 0, MPI_COMM_WORLD, &request);
|
|
Packit Service |
c5cf8c |
errs += MPI_Wait(&request, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
if (errs) {
|
|
Packit Service |
c5cf8c |
toterrs += errs;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "An error occurred during the send operation\n");
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (rank == 3) {
|
|
Packit Service |
c5cf8c |
errs = MPI_Irecv(buf, 10, MPI_CHAR, 0, 0, MPI_COMM_WORLD, &request);
|
|
Packit Service |
c5cf8c |
errs += MPI_Wait(&request, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
if (errs) {
|
|
Packit Service |
c5cf8c |
toterrs += errs;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "An error occurred during the recv operation\n");
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (rank == 3) {
|
|
Packit Service |
c5cf8c |
exit(EXIT_FAILURE);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (rank == 0) {
|
|
Packit Service |
c5cf8c |
errs = MPI_Issend("No Errors", 10, MPI_CHAR, 2, 0, MPI_COMM_WORLD, &request);
|
|
Packit Service |
c5cf8c |
errs += MPI_Wait(&request, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
if (errs) {
|
|
Packit Service |
c5cf8c |
toterrs += errs;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "An error occurred during the send operation\n");
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (rank == 2) {
|
|
Packit Service |
c5cf8c |
errs = MPI_Irecv(buf, 10, MPI_CHAR, 0, 0, MPI_COMM_WORLD, &request);
|
|
Packit Service |
c5cf8c |
errs += MPI_Wait(&request, MPI_STATUS_IGNORE);
|
|
Packit Service |
c5cf8c |
if (errs) {
|
|
Packit Service |
c5cf8c |
toterrs += errs;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "An error occurred during the recv operation\n");
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
printf(" %s\n", buf);
|
|
Packit Service |
c5cf8c |
fflush(stdout);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (rank == 2) {
|
|
Packit Service |
c5cf8c |
exit(EXIT_FAILURE);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Finalize();
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
return MTestReturnValue(toterrs);
|
|
Packit Service |
c5cf8c |
}
|