Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a collection is list inserted with pre-constructed elements don't try to construct #2001

Closed
lifflander opened this issue Oct 24, 2022 · 0 comments · Fixed by #2004
Closed
Assignees

Comments

@lifflander
Copy link
Collaborator

lifflander commented Oct 24, 2022

Describe the bug
This occurs when .listInsertHere is used.

vt: [0] ------------------------------------------------------------------------------------------------------------------------
vt: [0] ------------------------------------------- Runtime Error: System Aborting! --------------------------------------------
vt: [0] ------------------------------------------------ Fatal Error on Node 0 -------------------------------------------------
vt: [0] ------------------------------------------------------------------------------------------------------------------------
vt: [0] 
vt: [0]              Reason: Must have constructor fn if not default constructible
vt: [0]    Assertion failed: (cons_fn_)
vt: [0]                Node: 0
vt: [0]           Num Nodes: 1
vt: [0]                File: /ascldap/users/nlslatt/gemma-main/gemma/DARMA/vt/src/vt/vrt/collection/param/construct_params.h
vt: [0]                Line: 375
vt: [0]            Function: getConsFn

To Reproduce
Here's the "hack" fix:

diff --git a/DARMA/vt/src/vt/vrt/collection/collection_builder.impl.h b/DARMA/vt/src/vt/vrt/collection/collection_builder.impl.h
index 018067a..d6bf62d 100644
--- a/DARMA/vt/src/vt/vrt/collection/collection_builder.impl.h
+++ b/DARMA/vt/src/vt/vrt/collection/collection_builder.impl.h
@@ -162,10 +162,9 @@ void CollectionManager::makeCollectionImpl(param::ConstructParams<ColT>& po) {
     po.bulk_inserts_.push_back(po.bounds_);
   }
 
-  auto cons_fn = po.template getConsFn<ColT>();
-
   // Do all bulk insertions
   for (auto&& range : po.bulk_inserts_) {
+    auto cons_fn = po.template getConsFn<ColT>();
     range.foreach([&](IndexType idx) {
       if (elementMappedHere(map_han, map_object, idx, bounds)) {
         makeCollectionElement<ColT>(proxy, idx, this_node, cons_fn);
@@ -176,6 +175,7 @@ void CollectionManager::makeCollectionImpl(param::ConstructParams<ColT>& po) {
 
   // Do all list insertions
   for (auto&& list_fn : po.list_inserts_) {
+    auto cons_fn = po.template getConsFn<ColT>();
     list_fn([&](IndexType idx) {
       if (elementMappedHere(map_han, map_object, idx, bounds)) {
         makeCollectionElement<ColT>(proxy, idx, this_node, cons_fn);
thearusable added a commit that referenced this issue Oct 31, 2022
thearusable added a commit that referenced this issue Nov 4, 2022
thearusable added a commit that referenced this issue Nov 4, 2022
thearusable added a commit that referenced this issue Nov 7, 2022
nlslatt pushed a commit that referenced this issue Nov 9, 2022
nlslatt pushed a commit that referenced this issue Nov 9, 2022
nlslatt added a commit that referenced this issue Nov 9, 2022
#2001: Avoid reconstruction when pre-constructed elements are present in collection
cz4rs pushed a commit that referenced this issue Dec 28, 2022
cz4rs pushed a commit that referenced this issue Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants