Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix [#17799] : have mpi_group_range_incl and mpi_group_range_excl better test some...
[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 __attribute__((unused)) invalid_key[] = "invalid_test_key";
21     char buf[MPI_MAX_INFO_VAL];
22     int flag;
23
24     MPI_Init(&argc, &argv);
25
26     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
27
28     MPI_Info_create(&info_in);
29     MPI_Info_set(info_in, invalid_key, (char *) "true");
30
31     MPI_Comm_dup(MPI_COMM_WORLD, &comm);
32
33     MPI_Comm_set_info(comm, info_in);
34     MPI_Comm_get_info(comm, &info_out);
35
36     MPI_Info_get(info_out, invalid_key, MPI_MAX_INFO_VAL, buf, &flag);
37 #ifndef USE_STRICT_MPI
38     /* Check if our invalid key was ignored.  Note, this check's MPICH's
39      * behavior, but this behavior may not be required for a standard
40      * conforming MPI implementation. */
41     if (flag) {
42         printf("%d: %s was not ignored\n", rank, invalid_key);
43         errors++;
44     }
45 #endif
46
47     MPI_Info_free(&info_in);
48     MPI_Info_free(&info_out);
49     MPI_Comm_free(&comm);
50
51     MPI_Reduce(&errors, &all_errors, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
52
53     if (rank == 0 && all_errors == 0)
54         printf(" No Errors\n");
55
56     MPI_Finalize();
57
58     return 0;
59 }