diff --git a/src/vt/topos/location/location.h b/src/vt/topos/location/location.h index 1e465e0e34..ef4a723058 100644 --- a/src/vt/topos/location/location.h +++ b/src/vt/topos/location/location.h @@ -441,6 +441,22 @@ struct EntityLocationCoord : LocationCoord { */ LocInstType getInst() const; + /** + * \brief Whether dynamic membership is allowed + * + * \return whether it is allowed + */ + bool hasDynamicMembership() const { return dynamic_membership_; } + + /** + * \brief Set whether dynamic membership is allowed + * + * \param[in] in_dynamic_membership whether it is allowed + */ + void setDynamicMembership(bool in_dynamic_membership) { + dynamic_membership_ = in_dynamic_membership; + } + private: LocInstType this_inst = no_loc_inst; @@ -461,6 +477,10 @@ struct EntityLocationCoord : LocationCoord { // List of nodes that inquire about an entity that require an update LocAsksType loc_asks_; + + /// Whether the managed entities have dynamic membership (deletions/insertions + /// after construction) + bool dynamic_membership_ = false; }; }} // end namespace vt::location diff --git a/src/vt/topos/location/location.impl.h b/src/vt/topos/location/location.impl.h index b0f065f3ad..c6947f7a6c 100644 --- a/src/vt/topos/location/location.impl.h +++ b/src/vt/topos/location/location.impl.h @@ -114,6 +114,13 @@ void EntityLocationCoord::registerEntity( local_registered_.insert(id); + if (not migrated and not hasDynamicMembership()) { + vtAssert( + not recs_.exists(id), + "Duplicate insertion of the same entity is not allowed" + ); + } + recs_.insert(id, home, LocRecType{id, eLocState::Local, this_node}); if (msg_action != nullptr) { @@ -788,6 +795,13 @@ void EntityLocationCoord::updatePendingRequest( pending_actions_.erase(pending_iter); } else { + if (not hasDynamicMembership()) { + vtAssert( + not recs_.exists(id), + "Duplicate insertion of the same entity is not allowed" + ); + } + recs_.insert(id, home_node, LocRecType{id, eLocState::Remote, node}); // trigger any pending actions upon registration diff --git a/src/vt/vrt/collection/collection_builder.impl.h b/src/vt/vrt/collection/collection_builder.impl.h index 28004bd2c7..ae1bc2cbed 100644 --- a/src/vt/vrt/collection/collection_builder.impl.h +++ b/src/vt/vrt/collection/collection_builder.impl.h @@ -131,7 +131,8 @@ void CollectionManager::makeCollectionImpl(param::ConstructParams& po) { // Invoke getCollectionLM() to create a new location manager instance for // this collection - theLocMan()->getCollectionLM(proxy); + auto lm = theLocMan()->getCollectionLM(proxy); + lm->setDynamicMembership(has_dynamic_membership); // Insert action on cleanup for this collection addCleanupFn(proxy);