Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
comment tests we don't support in MPI3, and fix a few we support
[simgrid.git] / teshsuite / smpi / mpich3-test / comm / comm_info.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *
4  *  (C) 2012 by Argonne National Laboratory.
5  *      See COPYRIGHT in top-level directory.
6  */
7
8 #include <stdio.h>
9 #include <mpi.h>
10 #include "mpitest.h"
11
12 #define VERBOSE 0
13
14 int main(int argc, char **argv)
15 {
16     int rank;
17     MPI_Info info_in, info_out;
18     int errors = 0, all_errors = 0;
19     MPI_Comm comm;
20     char invalid_key[] = "invalid_test_key";
21     char val[]= "true";
22     char buf[MPI_MAX_INFO_VAL];
23     int flag;
24
25     MPI_Init(&argc, &argv);
26
27     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
28
29     MPI_Info_create(&info_in);
30     MPI_Info_set(info_in, invalid_key, val);
31
32     MPI_Comm_dup(MPI_COMM_WORLD, &comm);
33
34     MPI_Comm_set_info(comm, info_in);
35     MPI_Comm_get_info(comm, &info_out);
36
37     MPI_Info_get(info_out, invalid_key, MPI_MAX_INFO_VAL, buf, &flag);
38 #ifdef USE_STRICT_MPI
39     /* Check if our invalid key was ignored.  Note, this check's MPICH's
40      * behavior, but this behavior may not be required for a standard
41      * conforming MPI implementation. */
42     if (flag) {
43         printf("%d: %s was not ignored\n", rank, invalid_key);
44         errors++;
45     }
46 #endif
47
48     MPI_Info_free(&info_in);
49     MPI_Info_free(&info_out);
50     MPI_Comm_free(&comm);
51
52     MPI_Reduce(&errors, &all_errors, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
53
54     if (rank == 0 && all_errors == 0)
55         printf(" No Errors\n");
56
57     MPI_Finalize();
58
59     return 0;
60 }