From a6a087fed3df77d33874288dbe3b2f9b5422cf4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicente=20Mataix=20Ferr=C3=A1ndiz?= Date: Mon, 10 Feb 2025 17:36:35 +0100 Subject: [PATCH 1/2] [Core] Missing `SHALLOW_GLOBAL_POINTERS_SERIALIZATION` flag in `GatherModelPartUtility` --- kratos/mpi/utilities/gather_modelpart_utility.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kratos/mpi/utilities/gather_modelpart_utility.cpp b/kratos/mpi/utilities/gather_modelpart_utility.cpp index 1e24f55da3c5..32c0d7f604fc 100644 --- a/kratos/mpi/utilities/gather_modelpart_utility.cpp +++ b/kratos/mpi/utilities/gather_modelpart_utility.cpp @@ -395,6 +395,7 @@ void GatherModelPartUtility::GatherEntityFromOtherPartitions( std::string recv_buffer; r_data_communicator.Recv(recv_buffer, origin_rank, static_cast(index)); StreamSerializer serializer; + serializer.Set(Serializer::SHALLOW_GLOBAL_POINTERS_SERIALIZATION); const auto p_serializer_buffer = dynamic_cast(serializer.pGetBuffer()); p_serializer_buffer->write(recv_buffer.data(), recv_buffer.size()); if constexpr (std::is_same::value) { @@ -422,6 +423,7 @@ void GatherModelPartUtility::GatherEntityFromOtherPartitions( if (it_find != send_entities.end()) { for (auto index : it_find->second) { StreamSerializer serializer; + serializer.Set(Serializer::SHALLOW_GLOBAL_POINTERS_SERIALIZATION); if constexpr (std::is_same::value) { KRATOS_DEBUG_ERROR_IF_NOT(rModelPart.HasNode(index)) << "Node with index " << index << " not found in model part" << std::endl; auto p_send_node = rModelPart.pGetNode(index); From 9cdcf03688e67e4f9fa482a019496b99f8b4aa33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicente=20Mataix=20Ferr=C3=A1ndiz?= Date: Wed, 12 Feb 2025 09:31:39 +0100 Subject: [PATCH 2/2] Verify root model part instead as well --- kratos/mpi/utilities/gather_modelpart_utility.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kratos/mpi/utilities/gather_modelpart_utility.cpp b/kratos/mpi/utilities/gather_modelpart_utility.cpp index 32c0d7f604fc..e790ae4ca483 100644 --- a/kratos/mpi/utilities/gather_modelpart_utility.cpp +++ b/kratos/mpi/utilities/gather_modelpart_utility.cpp @@ -386,6 +386,7 @@ void GatherModelPartUtility::GatherEntityFromOtherPartitions( } // Use serializer + auto& r_root_model_part = rModelPart.GetRootModelPart(); for (int i_rank = 0; i_rank < world_size; ++i_rank) { // Receiving if (i_rank == rank) { @@ -401,17 +402,17 @@ void GatherModelPartUtility::GatherEntityFromOtherPartitions( if constexpr (std::is_same::value) { Node::Pointer p_new_node; serializer.load("bring_node_" + std::to_string(index), p_new_node); - KRATOS_DEBUG_ERROR_IF(rModelPart.HasNode(p_new_node->Id())) << "The node " << p_new_node->Id() << " from rank: " << origin_rank << " already exists in rank: " << rank << std::endl; + KRATOS_DEBUG_ERROR_IF(r_root_model_part.HasNode(p_new_node->Id())) << "The node " << p_new_node->Id() << " from rank: " << origin_rank << " already exists in rank: " << rank << std::endl; entities_to_bring.push_back(p_new_node); } else if constexpr (std::is_same::value) { Element::Pointer p_new_element; serializer.load("bring_element_" + std::to_string(index), p_new_element); - KRATOS_DEBUG_ERROR_IF(rModelPart.HasElement(p_new_element->Id())) << "The element " << p_new_element->Id() << " from rank: " << origin_rank << " already exists in rank: " << rank << std::endl; + KRATOS_DEBUG_ERROR_IF(r_root_model_part.HasElement(p_new_element->Id())) << "The element " << p_new_element->Id() << " from rank: " << origin_rank << " already exists in rank: " << rank << std::endl; entities_to_bring.push_back(p_new_element); } else if constexpr (std::is_same::value) { Condition::Pointer p_new_condition; serializer.load("bring_condition_" + std::to_string(index), p_new_condition); - KRATOS_DEBUG_ERROR_IF(rModelPart.HasCondition(p_new_condition->Id())) << "The condition " << p_new_condition->Id() << " from rank: " << origin_rank << " already exists in rank: " << rank << std::endl; + KRATOS_DEBUG_ERROR_IF(r_root_model_part.HasCondition(p_new_condition->Id())) << "The condition " << p_new_condition->Id() << " from rank: " << origin_rank << " already exists in rank: " << rank << std::endl; entities_to_bring.push_back(p_new_condition); } else { KRATOS_ERROR << "Entity type not supported" << std::endl;