Skip to content

Commit

Permalink
Merge pull request #12098 from KratosMultiphysics/core/mpi/pointer-co…
Browse files Browse the repository at this point in the history
…mmunicator-test-update

[Core][MPI] `PointerCommunicator` test update
  • Loading branch information
loumalouomega authored Feb 21, 2024
2 parents 78955e5 + f066b4b commit 3fdc687
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@ KRATOS_DISTRIBUTED_TEST_CASE_IN_SUITE(PointerCommunicatorPartialPartitions, Krat
indices.push_back(i);
}
ranks.reserve(world_size - 1);
std::string name_data_comm = "SubDataComm_";
for(int i = 0; i < world_size - 1; ++i) {
ranks.push_back(i);
name_data_comm += std::to_string(i) + "_";
}

if (current_rank < world_size - 1) {
auto& r_partial_data_comm = r_default_comm.GetSubDataCommunicator(ranks, "SubDataComm");
auto& r_partial_data_comm = r_default_comm.GetSubDataCommunicator(ranks, name_data_comm);
auto gp_list = GlobalPointerUtilities::RetrieveGlobalIndexedPointers(mp.Nodes(), indices, r_partial_data_comm );

GlobalPointerCommunicator< Node> pointer_comm(r_partial_data_comm, gp_list.ptr_begin(), gp_list.ptr_end());
Expand Down Expand Up @@ -151,7 +153,7 @@ KRATOS_DISTRIBUTED_TEST_CASE_IN_SUITE(PointerCommunicatorPartialPartitions, Krat
}

// Extend checks
auto& r_partial_data_comm_again = r_default_comm.GetSubDataCommunicator(ranks, "SubDataComm");
auto& r_partial_data_comm_again = r_default_comm.GetSubDataCommunicator(ranks, name_data_comm);
if (current_rank < world_size - 1) {
KRATOS_EXPECT_TRUE(r_partial_data_comm_again.IsDefinedOnThisRank());
} else {
Expand All @@ -161,9 +163,9 @@ KRATOS_DISTRIBUTED_TEST_CASE_IN_SUITE(PointerCommunicatorPartialPartitions, Krat
std::vector<int> ranks_wrong(ranks);
ranks_wrong.push_back(world_size -1);
if (current_rank < world_size - 1) {
KRATOS_EXPECT_EXCEPTION_IS_THROWN(r_default_comm.GetSubDataCommunicator(ranks_wrong, "SubDataComm"), "Inconsistency between the communicator world size: " + std::to_string(world_size - 1) + " and the number of ranks required: " + std::to_string(world_size));
KRATOS_EXPECT_EXCEPTION_IS_THROWN(r_default_comm.GetSubDataCommunicator(ranks_wrong, name_data_comm), "Inconsistency between the communicator world size: " + std::to_string(world_size - 1) + " and the number of ranks required: " + std::to_string(world_size));
} else {
KRATOS_EXPECT_EXCEPTION_IS_THROWN(r_default_comm.GetSubDataCommunicator(ranks_wrong, "SubDataComm"), "The rank " + std::to_string(current_rank) + " does not participate in the existing data communicator SubDataComm despite being in the provided rank list");
KRATOS_EXPECT_EXCEPTION_IS_THROWN(r_default_comm.GetSubDataCommunicator(ranks_wrong, name_data_comm), "The rank " + std::to_string(current_rank) + " does not participate in the existing data communicator " + name_data_comm + " despite being in the provided rank list");
}
}

Expand Down

0 comments on commit 3fdc687

Please sign in to comment.