Commit 5bb03747 authored by Halim Amer's avatar Halim Amer Committed by Kenneth Raffenetti
Browse files

Test send cancellation issues with unmatched sends



In this test, two messages are sent with the same rank, comm, and tag,
and one of them is cancelled before it gets matched. If the
destination does not differentiate between the messages, e.g. by using
sequence numbers or the origin request handle, the wrong message might
be canceled.
Signed-off-by: Kenneth Raffenetti's avatarKen Raffenetti <raffenet@mcs.anl.gov>
parent ed749773
......@@ -953,6 +953,7 @@
/pt2pt/rqstatus
/pt2pt/scancel
/pt2pt/scancel2
/pt2pt/scancel_unmatch
/pt2pt/sendall
/pt2pt/sendflood
/pt2pt/sendrecv1
......
......@@ -38,6 +38,7 @@ noinst_PROGRAMS = \
scancel2 \
rcancel \
pscancel \
scancel_unmatch\
sendflood \
sendrecv1 \
sendrecv2 \
......
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2015 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include "mpitest.h"
/*
static char MTEST_Descrip[] = "Test message reception ordering issues
after cancelling a send";
*/
int main(int argc, char *argv[])
{
int a, b, flag = 0, errs = 0;
MPI_Request requests[2];
MPI_Status statuses[2];
MPI_Init(&argc, &argv);
int rank, size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
int source = 0;
int dest = size - 1;
if (rank == 0) {
a = 10;
b = 20;
MPI_Isend(&a, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, &requests[0]);
MPI_Isend(&b, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, &requests[1]);
MPI_Cancel(&requests[1]);
MPI_Wait(&requests[1], &statuses[1]);
MPI_Test_cancelled(&statuses[1], &flag);
if (!flag) {
printf("Failed to cancel send");
errs++;
}
MPI_Barrier(MPI_COMM_WORLD);
MPI_Wait(&requests[0], MPI_STATUS_IGNORE);
}
else if (rank == 1) {
MPI_Barrier(MPI_COMM_WORLD);
MPI_Recv(&a, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
if (a == 20) {
printf("Failed! got the data from the wrong send!\n");
errs++;
}
}
MTest_Finalize(errs);
MPI_Finalize();
return 0;
}
......@@ -30,6 +30,7 @@ scancel2 2
pscancel 2 xfail=ticket2266 xfail=ticket2270
rcancel 2
cancelrecv 2 xfail=ticket2266 xfail=ticket2270
scancel_unmatch 2 xfail=ticket2276
cancelanysrc 2
isendselfprobe 1
inactivereq 1
......
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