include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
- foreach(file cmfree cmsplit2 cmsplit cmsplit_type commcreate1 comm_create_group comm_group_half comm_group_rand
- comm_info ctxalloc ctxsplit dup dup_with_info commname)
+ foreach(file cmfree cmfree2 cmsplit2 cmsplit cmsplit_type commcreate1 comm_create_group comm_group_half comm_group_rand
+ comm_info comm_info2 ctxalloc ctxsplit dup dup_with_info commname)
# not compiled files
# comm_idup comm_idup_mul comm_idup_overlap dupic ic1 ic2 iccreate icgroup icm icsplit probe-intercomm
add_executable(${file} EXCLUDE_FROM_ALL ${file}.c)
SET_TESTS_PROPERTIES(test-smpi-mpich3-comm-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
endif()
-foreach(file cmfree cmsplit2 cmsplit cmsplit_type commcreate1 comm_create_group comm_group_half comm_group_rand
- comm_info commname ctxalloc ctxsplit dup dupic dup_with_info ic1 ic2
+foreach(file cmfree cmfree2 cmsplit2 cmsplit cmsplit_type commcreate1 comm_create_group comm_group_half comm_group_rand
+ comm_info comm_info2 commname ctxalloc ctxsplit dup dupic dup_with_info ic1 ic2
iccreate icgroup icm icsplit probe-intercomm comm_create_group_idup comm_idup_comm comm_idup_mul comm_idup comm_idup_iallreduce comm_idup_nb comm_idup_comm2 comm_idup_isend comm_idup_overlap
)
set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file}.c)
--- /dev/null
+/*
+ * Copyright (C) by Argonne National Laboratory
+ * See COPYRIGHT in top-level directory
+ */
+
+#include "mpi.h"
+#include <stdlib.h>
+#include "mpitest.h"
+
+/*
+static char MTEST_Descrip[] = "Test that communicators have reference count semantics";
+*/
+
+int main(int argc, char *argv[])
+{
+ int errs = 0;
+ int rank, size;
+ MPI_Comm comm;
+
+ MTest_Init(&argc, &argv);
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &size);
+ if (size < 2) {
+ fprintf(stderr, "This test requires at least two processes.");
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ }
+
+ MPI_Comm_dup(MPI_COMM_WORLD, &comm);
+
+ if (rank == 0) {
+ MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Ssend(NULL, 0, MPI_INT, 1, 0, comm);
+ MPI_Comm_free(&comm);
+ } else if (rank == 1) {
+ MPI_Request req;
+ /* recv an ssend after the user frees the comm */
+ MPI_Irecv(NULL, 0, MPI_INT, 0, 0, comm, &req);
+ MPI_Comm_free(&comm);
+ MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Wait(&req, MPI_STATUS_IGNORE);
+ } else {
+ MPI_Comm_free(&comm);
+ MPI_Barrier(MPI_COMM_WORLD);
+ }
+
+ MTest_Finalize(errs);
+ return MTestReturnValue(errs);
+}
--- /dev/null
+/*
+ * Copyright (C) by Argonne National Laboratory
+ * See COPYRIGHT in top-level directory
+ */
+
+#include <stdio.h>
+#include <mpi.h>
+#include "mpitest.h"
+
+
+/*
+ This program provides tests cases for the functional evaluation
+ of the MPI communicator info hints infrastructure.
+ */
+
+int main(int argc, char **argv)
+{
+ int rank;
+ MPI_Info info_in, info_out;
+ int errs = 0;
+ MPI_Comm comm;
+ char query_key[MPI_MAX_INFO_KEY];
+ char val[MPI_MAX_INFO_VAL];
+ char new_key[MPI_MAX_INFO_KEY];
+ MPI_Comm comm_dup2;
+ MPI_Comm comm_dup3;
+ MPI_Comm comm_dup4;
+ MPI_Comm comm_split1;
+ MPI_Info info_out2;
+ MPI_Info info_out3;
+ MPI_Info info_out5;
+ MPI_Info info_in3;
+
+
+ /* Read arguments: info key and value */
+ snprintf(query_key, MPI_MAX_INFO_KEY, "arbitrary_key");
+ snprintf(val, MPI_MAX_INFO_VAL, "arbitrary_val");
+
+ MTest_Init(&argc, &argv);
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+ /* Goal of the test is only to make sure that MPI does not break */
+ /* No expectation is made on if the hints are actually set */
+
+ /* Test 1: comm_dup */
+ if (rank == 0)
+ MTestPrintfMsg(1,
+ "Testing MPI_Comm_dup with a source comm that has default comm infohints");
+ MPI_Comm_dup(MPI_COMM_WORLD, &comm);
+
+ /* Test 2: comm_set_info and comm_get_info */
+ if (rank == 0)
+ MTestPrintfMsg(1, "Testing MPI_Comm_set_info and MPI_Comm_get_info");
+ MPI_Info_create(&info_in);
+ MPI_Info_set(info_in, query_key, val);
+ MPI_Comm_set_info(comm, info_in);
+ MPI_Comm_get_info(comm, &info_out);
+ MPI_Info_free(&info_out);
+
+ /* Test 3: com_dup after info is set in source comm */
+ if (rank == 0)
+ MTestPrintfMsg(1, "Testing MPI_Comm_dup: source comm has user provided comm infohint");
+ MPI_Comm_dup(comm, &comm_dup2);
+ MPI_Comm_get_info(comm_dup2, &info_out2);
+ MPI_Comm_free(&comm_dup2);
+ MPI_Info_free(&info_out2);
+
+ /* Test 4: Comm_dup_with_info */
+ if (rank == 0)
+ MTestPrintfMsg(1, "Testing MPI_Comm_dup_with_info");
+
+ /* Add 2 hints and create comm dup with info */
+ MPI_Info_create(&info_in3);
+ MPI_Info_set(info_in3, query_key, val);
+ snprintf(new_key, MPI_MAX_INFO_KEY, "arbitrary_key_2");
+ MPI_Info_set(info_in3, new_key, "arbitrary_value_2");
+ MPI_Comm_dup_with_info(comm, info_in3, &comm_dup3);
+ MPI_Comm_get_info(comm_dup3, &info_out3);
+ MPI_Info_free(&info_in3);
+ MPI_Info_free(&info_out3);
+ MPI_Comm_free(&comm_dup3);
+
+ /* Test 5: MPI_Comm_split_type */
+ MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, 0, info_in, &comm_split1);
+ MPI_Comm_get_info(comm_split1, &info_out5);
+ MPI_Info_free(&info_out5);
+ MPI_Comm_free(&comm_split1);
+
+ /* Test 6: comm_dup_with_info with info=MPI_INFO_NULL */
+ if (rank == 0)
+ MTestPrintfMsg(1, "Testing MPI_Comm_dup_with_info with MPI_INFO_NULL");
+ MPI_Comm_dup_with_info(comm, MPI_INFO_NULL, &comm_dup4);
+ MPI_Comm_free(&comm_dup4);
+
+ /* TODO - Test: MPI_Dist_graph_create_adjacent */
+
+ /* Release remaining resources */
+ MPI_Info_free(&info_in);
+ MPI_Comm_free(&comm);
+
+ MTest_Finalize(errs);
+ return MTestReturnValue(errs);
+}