Commit 503ec869 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix clang compilation problems with openmp

parent 8688be7a
...@@ -170,12 +170,12 @@ public: ...@@ -170,12 +170,12 @@ public:
return _items; return _items;
} }
const auto begin() const auto begin() const
{ {
return _items.begin(); return _items.begin();
} }
const auto end() const auto end() const
{ {
return _items.end(); return _items.end();
} }
......
...@@ -106,12 +106,12 @@ public: ...@@ -106,12 +106,12 @@ public:
return _items; return _items;
} }
const auto begin() const auto begin() const
{ {
return _items.begin(); return _items.begin();
} }
const auto end() const auto end() const
{ {
return _items.end(); return _items.end();
} }
......
...@@ -91,10 +91,11 @@ struct get_arf_layout ...@@ -91,10 +91,11 @@ struct get_arf_layout
} }
} }
auto dt_ = dt; // workaround clang
for (size_t j = 0; j < dim; ++j) for (size_t j = 0; j < dim; ++j)
{ {
#pragma omp atomic #pragma omp atomic
pos[v][j] += dt * delta_pos[j]; pos[v][j] += dt_ * delta_pos[j];
delta += abs(delta_pos[j]); delta += abs(delta_pos[j]);
} }
......
...@@ -38,8 +38,6 @@ struct do_maximal_vertex_set ...@@ -38,8 +38,6 @@ struct do_maximal_vertex_set
{ {
typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; typedef typename graph_traits<Graph>::vertex_descriptor vertex_t;
uniform_real_distribution<> sample(0, 1);
VertexSet marked(vertex_index, num_vertices(g)); VertexSet marked(vertex_index, num_vertices(g));
vector<vertex_t> vlist; vector<vertex_t> vlist;
double max_deg = 0, tmp_max_deg = 0; double max_deg = 0, tmp_max_deg = 0;
...@@ -86,9 +84,12 @@ struct do_maximal_vertex_set ...@@ -86,9 +84,12 @@ struct do_maximal_vertex_set
else else
p = 1. / (2 * out_degree(v, g)); p = 1. / (2 * out_degree(v, g));
uniform_real_distribution<> sample(0, 1);
auto& rng_ = rng; // workaround clang
#pragma omp critical #pragma omp critical
{ {
r = sample(rng); r = sample(rng_);
} }
if (r < p) if (r < p)
include = true; include = true;
...@@ -101,17 +102,20 @@ struct do_maximal_vertex_set ...@@ -101,17 +102,20 @@ struct do_maximal_vertex_set
if (include) if (include)
{ {
marked[v] = true; marked[v] = true;
auto& selected_ = selected; // workaround clang
#pragma omp critical (selected) #pragma omp critical (selected)
{ {
selected.push_back(v); selected_.push_back(v);
} }
} }
else else
{ {
auto& tmp_ = tmp; // workaround clang
auto& tmp_max_deg_ = tmp_max_deg;
#pragma omp critical (tmp) #pragma omp critical (tmp)
{ {
tmp.push_back(v); tmp_.push_back(v);
tmp_max_deg = max(tmp_max_deg, out_degree(v, g)); tmp_max_deg_ = max(tmp_max_deg_, out_degree(v, g));
} }
} }
}); });
...@@ -149,10 +153,12 @@ struct do_maximal_vertex_set ...@@ -149,10 +153,12 @@ struct do_maximal_vertex_set
} }
else else
{ {
auto& tmp_ = tmp; // workaround clang
auto& tmp_max_deg_ = tmp_max_deg;
#pragma omp critical (tmp) #pragma omp critical (tmp)
{ {
tmp.push_back(v); tmp_.push_back(v);
tmp_max_deg = max(tmp_max_deg, out_degree(v, g)); tmp_max_deg_ = max(tmp_max_deg_, out_degree(v, g));
} }
} }
marked[v] = false; marked[v] = false;
......
...@@ -87,9 +87,10 @@ struct find_vertices ...@@ -87,9 +87,10 @@ struct find_vertices
(!is_eq && (range.first <= val && val <= range.second))) (!is_eq && (range.first <= val && val <= range.second)))
{ {
PythonVertex<Graph> pv(gp, v); PythonVertex<Graph> pv(gp, v);
auto& ret_ = ret; // work around clang
#pragma omp critical #pragma omp critical
{ {
ret.append(pv); ret_.append(pv);
} }
} }
}); });
...@@ -139,9 +140,10 @@ struct find_edges ...@@ -139,9 +140,10 @@ struct find_edges
(!is_eq && (range.first <= val && val <= range.second))) (!is_eq && (range.first <= val && val <= range.second)))
{ {
PythonEdge<Graph> pe(gp, e); PythonEdge<Graph> pe(gp, e);
auto& ret_ = ret; // work around clang
#pragma omp critical #pragma omp critical
{ {
ret.append(pe); ret_.append(pe);
} }
} }
}); });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment