2 * Copyright (C) by Argonne National Laboratory
3 * See COPYRIGHT in top-level directory
12 This program provides tests cases for the functional evaluation
13 of the MPI communicator info hints infrastructure.
16 int main(int argc, char **argv)
19 MPI_Info info_in, info_out;
22 char query_key[MPI_MAX_INFO_KEY];
23 char val[MPI_MAX_INFO_VAL];
24 char new_key[MPI_MAX_INFO_KEY];
35 /* Read arguments: info key and value */
36 snprintf(query_key, MPI_MAX_INFO_KEY, "arbitrary_key");
37 snprintf(val, MPI_MAX_INFO_VAL, "arbitrary_val");
39 MTest_Init(&argc, &argv);
40 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
42 /* Goal of the test is only to make sure that MPI does not break */
43 /* No expectation is made on if the hints are actually set */
45 /* Test 1: comm_dup */
48 "Testing MPI_Comm_dup with a source comm that has default comm infohints");
49 MPI_Comm_dup(MPI_COMM_WORLD, &comm);
51 /* Test 2: comm_set_info and comm_get_info */
53 MTestPrintfMsg(1, "Testing MPI_Comm_set_info and MPI_Comm_get_info");
54 MPI_Info_create(&info_in);
55 MPI_Info_set(info_in, query_key, val);
56 MPI_Comm_set_info(comm, info_in);
57 MPI_Comm_get_info(comm, &info_out);
58 MPI_Info_free(&info_out);
60 /* Test 3: com_dup after info is set in source comm */
62 MTestPrintfMsg(1, "Testing MPI_Comm_dup: source comm has user provided comm infohint");
63 MPI_Comm_dup(comm, &comm_dup2);
64 MPI_Comm_get_info(comm_dup2, &info_out2);
65 MPI_Comm_free(&comm_dup2);
66 MPI_Info_free(&info_out2);
68 /* Test 4: Comm_dup_with_info */
70 MTestPrintfMsg(1, "Testing MPI_Comm_dup_with_info");
72 /* Add 2 hints and create comm dup with info */
73 MPI_Info_create(&info_in3);
74 MPI_Info_set(info_in3, query_key, val);
75 snprintf(new_key, MPI_MAX_INFO_KEY, "arbitrary_key_2");
76 MPI_Info_set(info_in3, new_key, "arbitrary_value_2");
77 MPI_Comm_dup_with_info(comm, info_in3, &comm_dup3);
78 MPI_Comm_get_info(comm_dup3, &info_out3);
79 MPI_Info_free(&info_in3);
80 MPI_Info_free(&info_out3);
81 MPI_Comm_free(&comm_dup3);
83 /* Test 5: MPI_Comm_split_type */
84 MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, 0, info_in, &comm_split1);
85 MPI_Comm_get_info(comm_split1, &info_out5);
86 MPI_Info_free(&info_out5);
87 MPI_Comm_free(&comm_split1);
89 /* Test 6: comm_dup_with_info with info=MPI_INFO_NULL */
91 MTestPrintfMsg(1, "Testing MPI_Comm_dup_with_info with MPI_INFO_NULL");
92 MPI_Comm_dup_with_info(comm, MPI_INFO_NULL, &comm_dup4);
93 MPI_Comm_free(&comm_dup4);
95 /* TODO - Test: MPI_Dist_graph_create_adjacent */
97 /* Release remaining resources */
98 MPI_Info_free(&info_in);
101 MTest_Finalize(errs);
102 return MTestReturnValue(errs);