Commit a81ec2ac authored by Wesley Bland's avatar Wesley Bland
Browse files

Add test for revoke+shrink

This tests the behavior after a failure when using revoke+shrink. Right
now this test still fails so it is marked as xfail.

See #2198

No reviewer
parent f759813f
......@@ -13,4 +13,4 @@ include $(top_srcdir)/Makefile.mtest
noinst_PROGRAMS = die abort sendalive isendalive senddead recvdead isenddead \
irecvdead barrier gather reduce bcast scatter failure_ack \
anysource revoke_nofail shrink agree multi_isendalive \
agree_shrink
agree_shrink revoke_shrink
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include "mpi.h"
MPI_Comm comm_all;
void error_handler(MPI_Comm *communicator, int *error_code, ...) {
MPI_Comm *new_comm = malloc(sizeof(MPI_Comm));
MPIX_Comm_revoke(comm_all);
MPIX_Comm_shrink(comm_all, new_comm);
MPI_Comm_free(&comm_all);
comm_all = *new_comm;
}
int main(int argc, char *argv[]) {
int rank, size;
int sum = 0, val = 1;
int errs = 0;
MPI_Errhandler errhandler;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
if (size < 4) {
fprintf(stderr, "Must run with at least 4 processes.\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
MPI_Comm_dup(MPI_COMM_WORLD, &comm_all);
MPI_Comm_create_errhandler(&error_handler, &errhandler);
MPI_Comm_set_errhandler(comm_all, errhandler);
for (int i = 0; i < 10; ++i) {
MPI_Comm_size(comm_all, &size);
sum = 0;
if (i == 5 && rank == 1) {
exit(1);
} else if (i != 5) {
MPI_Allreduce(&val, &sum, 1, MPI_INT, MPI_SUM, comm_all);
if (sum != size && rank == 0) {
errs++;
fprintf(stderr, "Incorrect answer: %d != %d\n", sum, size);
}
}
}
if (0 == rank && errs) {
fprintf(stdout, " Found %d errors\n", errs);
} else if (0 == rank) {
fprintf(stdout, " No errors\n");
}
MPI_Comm_free(&comm_all);
MPI_Errhandler_free(&errhandler);
MPI_Finalize();
return 0;
}
......@@ -16,3 +16,4 @@ anysource 3 env=MPIR_CVAR_ENABLE_FT=1 mpiexecarg=-disable-auto-cleanup resultTes
revoke_nofail 2 env=MPIR_CVAR_ENABLE_FT=1 strict=false timeLimit=10
shrink 8 env=MPIR_CVAR_ENABLE_FT=1 mpiexecarg=-disable-auto-cleanup resultTest=TestStatusNoErrors strict=false timeLimit=10
agree 4 env=MPIR_CVAR_ENABLE_FT=1 mpiexecarg=-disable-auto-cleanup resultTest=TestStatusNoErrors strict=false timeLimit=10
revoke_shrink 4 env=MPIR_CVAR_ENABLE=1 mpiexecarg=-disable-auto-cleanup resultTest=TestStatusNoErrors strict=false timeLimit=10 xfail=2198
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment