From 56d93eb18b914096ad863ee7e495c32d4c8873d2 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Tue, 20 May 2014 23:58:32 +0200 Subject: [PATCH] Replace omp atomic with std variant --- DataStructures/DynamicGraph.h | 5 ++--- DataStructures/Percent.h | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/DataStructures/DynamicGraph.h b/DataStructures/DynamicGraph.h index 934086c08..142c0b671 100644 --- a/DataStructures/DynamicGraph.h +++ b/DataStructures/DynamicGraph.h @@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include template class DynamicGraph { @@ -198,7 +199,6 @@ template class DynamicGraph void DeleteEdge(const NodeIterator source, const EdgeIterator e) { Node &node = m_nodes[source]; -#pragma omp atomic --m_numEdges; --node.edges; BOOST_ASSERT(std::numeric_limits::max() != node.edges); @@ -226,7 +226,6 @@ template class DynamicGraph } } -#pragma omp atomic m_numEdges -= deleted; m_nodes[source].edges -= deleted; @@ -272,7 +271,7 @@ template class DynamicGraph }; NodeIterator m_numNodes; - EdgeIterator m_numEdges; + std::atomic_uint m_numEdges; std::vector m_nodes; DeallocatingVector m_edges; diff --git a/DataStructures/Percent.h b/DataStructures/Percent.h index 6c56ebedf..e3fc563cb 100644 --- a/DataStructures/Percent.h +++ b/DataStructures/Percent.h @@ -30,6 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../Util/OpenMPWrapper.h" #include +#include class Percent { @@ -61,20 +62,18 @@ class Percent void printIncrement() { -#pragma omp atomic ++m_current_value; printStatus(m_current_value); } void printAddition(const unsigned addition) { -#pragma omp atomic m_current_value += addition; printStatus(m_current_value); } private: - unsigned m_current_value; + std::atomic_uint m_current_value; unsigned m_max_value; unsigned m_percent_interval; unsigned m_next_threshold;