From 4f34cc095875af8d0a7b4366c622cd4de5fb3998 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Fri, 20 Dec 2024 11:40:57 -0800 Subject: [PATCH] Ensure we're not losing variance in paired info improver. Use better unordered data structures --- src/common/paired_info/concurrent_pair_info_buffer.hpp | 6 ++++++ src/common/paired_info/pair_info_improver.hpp | 10 +++++----- src/common/paired_info/paired_info.hpp | 6 ++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/common/paired_info/concurrent_pair_info_buffer.hpp b/src/common/paired_info/concurrent_pair_info_buffer.hpp index 9048ceb2b..5d4305732 100644 --- a/src/common/paired_info/concurrent_pair_info_buffer.hpp +++ b/src/common/paired_info/concurrent_pair_info_buffer.hpp @@ -128,6 +128,12 @@ class ConcurrentPairedBuffer : public PairedBufferBase using ConcurrentPairedInfoBuffer = ConcurrentPairedBuffer; +template +using ConcurrentClusteredPairedInfoBuffer = ConcurrentPairedBuffer; + +template +using ConcurrentUnorderedClusteredPairedInfoBuffer = ConcurrentPairedBuffer; + } // namespace de } // namespace omnigraph diff --git a/src/common/paired_info/pair_info_improver.hpp b/src/common/paired_info/pair_info_improver.hpp index eb19ae82d..b19ab6d51 100644 --- a/src/common/paired_info/pair_info_improver.hpp +++ b/src/common/paired_info/pair_info_improver.hpp @@ -45,7 +45,7 @@ class PairInfoImprover { typedef std::vector > PairInfos; typedef std::pair EdgePair; typedef omnigraph::de::PairedInfoIndexT Index; - typedef omnigraph::de::ConcurrentPairedInfoBuffer Buffer; + typedef omnigraph::de::ConcurrentUnorderedClusteredPairedInfoBuffer Buffer; public: PairInfoImprover(const Graph& g, @@ -123,7 +123,7 @@ class PairInfoImprover { } size_t RemoveContradictional(unsigned nthreads) { - omnigraph::de::ConcurrentPairedInfoBuffer buf(graph_); + Buffer buf(graph_); omnigraph::IterationHelper edges(graph_); auto ranges = edges.Ranges(nthreads * 16); @@ -142,7 +142,7 @@ class PairInfoImprover { DEBUG("Merging maps"); // FIXME: This is a bit crazy, but we do not have a sane way to iterate // over buffer. In any case, this is better than it used to be before - omnigraph::de::UnclusteredPairedInfoIndexT to_remove(graph_); + omnigraph::de::UnorderedPairedInfoIndexT to_remove(graph_); to_remove.MoveAssign(buf); DEBUG("Resulting size " << to_remove.size()); @@ -161,7 +161,7 @@ class PairInfoImprover { size_t FillMissing(unsigned nthreads) { DEBUG("Fill missing: Creating indexes"); - omnigraph::de::ConcurrentPairedInfoBuffer buf(graph_); + Buffer buf(graph_); SplitPathConstructor spc(graph_); @@ -189,7 +189,7 @@ class PairInfoImprover { DEBUG("Merging maps"); // FIXME: This is a bit crazy, but we do not have a sane way to iterate // over buffer. In any case, this is better than it used to be before - omnigraph::de::UnclusteredPairedInfoIndexT to_add(graph_); + omnigraph::de::UnorderedPairedInfoIndexT to_add(graph_); to_add.MoveAssign(buf); DEBUG("Resulting size " << to_add.size()); diff --git a/src/common/paired_info/paired_info.hpp b/src/common/paired_info/paired_info.hpp index ad9455034..7a2ac6af6 100644 --- a/src/common/paired_info/paired_info.hpp +++ b/src/common/paired_info/paired_info.hpp @@ -603,6 +603,12 @@ using const_btree_map = NoLockingConstAdapter>; //Two-par template using PairedInfoIndexT = PairedIndex; +template +using phmap_map = NoLockingAdapter>; //Two-parameters wrapper + +template +using UnorderedPairedInfoIndexT = PairedIndex; + template using btree_map = NoLockingAdapter>; //Two-parameters wrapper