Skip to content

Commit

Permalink
Merge pull request #6052 from masterleinad/fix_unordered_map_shared_s…
Browse files Browse the repository at this point in the history
…pace

Don't create a shared state for size() in UnorderedMap's deep_copy
  • Loading branch information
dalg24 committed Apr 13, 2023
2 parents 3b1afb5 + d26f88c commit 7645d6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion containers/src/Kokkos_UnorderedMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ class UnorderedMap {
tmp.m_bounded_insert = src.m_bounded_insert;
tmp.m_hasher = src.m_hasher;
tmp.m_equal_to = src.m_equal_to;
tmp.m_size = src.m_size;
*tmp.m_size = *src.m_size;
tmp.m_available_indexes = bitset_type(src.capacity());
tmp.m_hash_lists = size_type_view(
view_alloc(WithoutInitializing, "UnorderedMap hash list"),
Expand Down
5 changes: 5 additions & 0 deletions containers/unit_tests/TestUnorderedMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ struct TestInsert {
}
}
}

const unsigned int old_size = map_h.size();
map_h.clear();
ASSERT_EQ(map.size(), old_size);
ASSERT_EQ(map_h.size(), 0u);
}

KOKKOS_INLINE_FUNCTION
Expand Down

0 comments on commit 7645d6c

Please sign in to comment.