2 * (C) 2018 by Argonne National Laboratory.
3 * See COPYRIGHT in top-level directory.
5 * Portions of this code were written by Intel Corporation.
6 * Copyright (C) 2011-2018 Intel Corporation. Intel provides this material
7 * to Argonne National Laboratory subject to Software Grant and Corporate
8 * Contributor License Agreement dated February 8, 2012.
10 * This program checks if MPICH can correctly handle multiple persistent
11 * communication calls with a derived datatype
22 int main(int argc, char *argv[])
30 MTest_Init(&argc, &argv);
32 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
33 MPI_Comm_size(MPI_COMM_WORLD, &size);
36 fprintf(stderr, "Launch with two processes\n");
37 MPI_Abort(MPI_COMM_WORLD, 1);
41 MTestPrintfMsg(1, "Test 1: Persistent send - Recv\n");
44 MPI_Type_dup(MPI_INT, &int_dup);
46 MPI_Send_init(&v, 1, int_dup, 1, 0, MPI_COMM_WORLD, &req);
47 MPI_Type_free(&int_dup);
48 for (i = 0; i < ITER; i++) {
53 MPI_Request_free(&req);
55 for (i = 0; i < ITER; i++) {
57 MPI_Recv(&v, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
60 fprintf(stderr, "Psend-recv iteration %d: Expected 42 but got %d\n", i, v);
66 MTestPrintfMsg(1, "Test 2: Send - Persistent recv (with ANY_SOURCE)\n");
69 for (i = 0; i < ITER; i++) {
71 MPI_Send(&v, 1, MPI_INT, 1, 0, MPI_COMM_WORLD);
74 MPI_Type_dup(MPI_INT, &int_dup);
75 MPI_Recv_init(&v, 1, int_dup, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, &req);
76 MPI_Type_free(&int_dup);
77 for (i = 0; i < ITER; i++) {
84 fprintf(stderr, "Send-precv(anysrc) iteration %d: Expected %d but got %d\n",
88 MPI_Request_free(&req);
93 return MTestReturnValue(errs);