Commit 27d059c2 authored by Tiago Peixoto's avatar Tiago Peixoto

Change default OpenMP parameters to: schedule(static) if (N > 100)

parent 29f9f248
......@@ -45,7 +45,7 @@ void normalize_betweenness(const Graph& g,
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -68,7 +68,7 @@ struct get_closeness
get_vertex_dists_t get_vertex_dists;
size_t HN = HardNumVertices()(g);
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
vertex_t v = vertex(i, g);
......
......@@ -48,7 +48,7 @@ struct get_eigentrust
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......@@ -72,7 +72,7 @@ struct get_eigentrust
c_sum.reserve(num_vertices(g));
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......@@ -90,7 +90,7 @@ struct get_eigentrust
// init inferred trust t
int i, N = num_vertices(g), V = HardNumVertices()(g);
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......@@ -105,7 +105,7 @@ struct get_eigentrust
{
delta = 0;
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100) reduction(+:delta)
schedule(static) if (N > 100) reduction(+:delta)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......@@ -137,7 +137,7 @@ struct get_eigentrust
if (iter % 2 != 0)
{
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......
......@@ -51,7 +51,7 @@ struct get_eigenvector
{
norm = 0;
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100) reduction(+:norm)
schedule(static) if (N > 100) reduction(+:norm)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......@@ -77,7 +77,7 @@ struct get_eigenvector
delta = 0;
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100) reduction(+:delta)
schedule(static) if (N > 100) reduction(+:delta)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......@@ -97,7 +97,7 @@ struct get_eigenvector
if (iter % 2 != 0)
{
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......
......@@ -47,7 +47,7 @@ struct get_hits
// init centrality
int i, N = num_vertices(g), V = HardNumVertices()(g);
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......@@ -65,7 +65,7 @@ struct get_hits
{
x_norm = 0;
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100) reduction(+:x_norm)
schedule(static) if (N > 100) reduction(+:x_norm)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......@@ -100,7 +100,7 @@ struct get_hits
delta = 0;
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100) reduction(+:delta)
schedule(static) if (N > 100) reduction(+:delta)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......@@ -122,7 +122,7 @@ struct get_hits
if (iter % 2 != 0)
{
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......
......@@ -51,7 +51,7 @@ struct get_katz
{
norm = 0;
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100) reduction(+:norm)
schedule(static) if (N > 100) reduction(+:norm)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......@@ -77,7 +77,7 @@ struct get_katz
delta = 0;
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100) reduction(+:delta)
schedule(static) if (N > 100) reduction(+:delta)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......@@ -97,7 +97,7 @@ struct get_katz
if (iter % 2 != 0)
{
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......
......@@ -43,7 +43,7 @@ struct get_pagerank
// init degs
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......@@ -62,7 +62,7 @@ struct get_pagerank
{
delta = 0;
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100) reduction(+:delta)
schedule(static) if (N > 100) reduction(+:delta)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......@@ -96,7 +96,7 @@ struct get_pagerank
if (iter % 2 != 0)
{
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......
......@@ -106,7 +106,7 @@ struct get_trust_transitivity
property_traits<InferredTrustMap>::value_type::value_type t_type;
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
vertex_t v = vertex(i, g);
......@@ -116,7 +116,7 @@ struct get_trust_transitivity
}
N = (target == -1) ? num_vertices(g) : target + 1;
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = (target == -1) ? 0 : target; i < N; ++i)
{
vertex_t tgt = vertex(i, g);
......@@ -210,7 +210,7 @@ struct get_trust_transitivity
distance_zero(t_type(1)));
#pragma omp parallel for default(shared) private(j) \
schedule(static, 100)
schedule(static) if (N > 100)
for (j = 0; j < N2; ++j)
{
vertex_t src = vertex(j, g);
......@@ -224,7 +224,7 @@ struct get_trust_transitivity
}
#pragma omp parallel for default(shared) private(j) \
schedule(static, 100)
schedule(static) if (N > 100)
for (j = 0; j < N2; ++j)
{
vertex_t src = vertex(j, g);
......
......@@ -98,7 +98,7 @@ struct get_global_clustering
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i,temp) \
schedule(static, 100) reduction(+:triangles, n)
schedule(static) if (N > 100) reduction(+:triangles, n)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......@@ -117,7 +117,7 @@ struct get_global_clustering
double cerr = 0.0;
#pragma omp parallel for default(shared) private(i,temp) \
schedule(static, 100) reduction(+:cerr)
schedule(static) if (N > 100) reduction(+:cerr)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......@@ -143,7 +143,7 @@ struct set_clustering_to_property
typename get_undirected_graph<Graph>::type ug(g);
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -122,7 +122,7 @@ struct get_extended_clustering
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
vertex_t v = vertex(i, g);
......
......@@ -357,7 +357,7 @@ struct get_all_motifs
int i, N = (p < 1) ? V.size() : num_vertices(g);
#pragma omp parallel for default(shared) private(i, sig) \
schedule(static, 100)
schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
vector<vector<typename graph_traits<Graph>::vertex_descriptor> >
......
......@@ -109,7 +109,7 @@ struct get_communities
// sample a new spin for every vertex
int NV = num_vertices(g),i;
#pragma omp parallel for default(shared) private(i)\
reduction(+:E) schedule(static, 100)
reduction(+:E) schedule(static) if (NV > 100)
for (i = 0; i < NV; ++i)
{
vertex_t v = vertex(i, g);
......@@ -212,7 +212,7 @@ struct get_communities
{
int NV = num_vertices(g), i;
#pragma omp parallel for default(shared) private(i)\
schedule(static, 100)
schedule(static) if (NV > 100)
for (i = 0; i < NV; ++i)
{
vertex_t v = vertex(i, g);
......@@ -381,7 +381,7 @@ public:
void Update(size_t k, size_t old_s, size_t s)
{
int i, NK = _degs.size();
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (NK > 100)
for (i = 0; i < NK; ++i)
{
size_t k1 = _degs[i], k2 = k;
......@@ -407,7 +407,7 @@ public:
_Nks[k].erase(old_s);
_Nks[k][s]++;
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (NK > 100)
for (i = 0; i < NK; ++i)
{
size_t k1 = _degs[i], k2 = k;
......
......@@ -48,7 +48,7 @@ struct get_assortativity_coefficient
SharedMap<tr1::unordered_map<double,count_t> > sa(a), sb(b);
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) firstprivate(sa,sb)\
schedule(static, 100) reduction(+:e_kk, n_edges)
schedule(static) if (N > 100) reduction(+:e_kk, n_edges)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......@@ -82,7 +82,7 @@ struct get_assortativity_coefficient
// "jackknife" variance
double err = 0.0;
#pragma omp parallel for default(shared) private(i) schedule(static, 100)\
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)\
reduction(+:err)
for (i = 0; i < N; ++i)
{
......@@ -127,7 +127,7 @@ struct get_scalar_assortativity_coefficient
double a = 0.0, b = 0.0, da = 0.0, db = 0.0;
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) \
schedule(static, 100) reduction(+:e_xy,n_edges,a,b,da,db)
schedule(static) if (N > 100) reduction(+:e_xy,n_edges,a,b,da,db)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......@@ -163,7 +163,7 @@ struct get_scalar_assortativity_coefficient
r_err = 0.0;
double err = 0.0;
#pragma omp parallel for default(shared) private(i) schedule(static, 100)\
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)\
reduction(+:err)
for (i = 0; i < N; ++i)
{
......
......@@ -67,7 +67,7 @@ struct get_avg_correlation
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) \
firstprivate(s_sum, s_sum2, s_count) schedule(static, 100)
firstprivate(s_sum, s_sum2, s_count) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -60,7 +60,7 @@ struct get_correlation_histogram
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) \
firstprivate(s_hist) schedule(static, 100)
firstprivate(s_hist) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......
......@@ -127,7 +127,7 @@ struct get_geometric
}
#pragma omp parallel for default(shared) private(i, box) \
schedule(static, 100)
schedule(static) if (N > 100)
for (int i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -71,7 +71,7 @@ struct get_lattice
vector<int> pos(shape.size());
//#pragma omp parallel for default(shared) private(i)
// firstprivate(pos) schedule(static, 100)
// firstprivate(pos) schedule(static) if (N > 100)
for (int i = 0; i < N; ++i)
{
get_pos(i, shape, pos);
......
......@@ -244,7 +244,7 @@ struct get_degree_map
typename map_t::unchecked_t deg_map = cdeg_map.get_unchecked(num_vertices(g));
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -273,7 +273,7 @@ struct get_sfdp_layout
size_t nmoves = 0;
#pragma omp parallel for default(shared) private(i) \
firstprivate(Q, diff, pos_u, ftot, cm) \
reduction(+:E, delta, nmoves) schedule(static, 100)
reduction(+:E, delta, nmoves) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......
......@@ -77,7 +77,7 @@ struct get_average
AverageTraverse traverse;
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) \
reduction(+:a,aa,count) schedule(static, 100)
reduction(+:a,aa,count) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -80,7 +80,7 @@ struct get_distance_histogram
get_vertex_dists_t get_vertex_dists;
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i,point) \
firstprivate(s_hist) schedule(static, 100)
firstprivate(s_hist) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
vertex_t v = vertex(i, g);
......
......@@ -88,7 +88,7 @@ struct get_sampled_distance_histogram
typename hist_t::point_t point;
get_vertex_dists_t get_vertex_dists;
#pragma omp parallel for default(shared) private(i,point) \
firstprivate(s_hist) schedule(static, 100)
firstprivate(s_hist) schedule(static) if (num_vertices(g) * n_samples > 100)
for (i = 0; i < int(n_samples); ++i)
{
vertex_t v;
......
......@@ -119,7 +119,7 @@ struct get_histogram
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) \
firstprivate(s_hist) schedule(static, 100)
firstprivate(s_hist) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -36,7 +36,7 @@ struct label_parallel_edges
typedef typename graph_traits<Graph>::edge_descriptor edge_t;
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......@@ -74,7 +74,7 @@ struct label_self_loops
typedef typename graph_traits<Graph>::edge_descriptor edge_t;
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -37,7 +37,7 @@ struct do_all_pairs_search
dist_t;
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
dist_map[i].clear();
......
......@@ -37,7 +37,7 @@ struct get_bipartite
is_bip = is_bipartite(g, vertex_index, part);
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -194,7 +194,7 @@ struct label_attractors
{
typedef typename property_traits<CompMap>::value_type c_type;
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v =
......
......@@ -101,7 +101,7 @@ struct do_bfs_search
typedef unchecked_vector_property_map<size_t, VertexIndexMap> dist_map_t;
dist_map_t dist_map(vertex_index, num_vertices(g));
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -78,7 +78,7 @@ struct get_prim_min_span_tree
// convert the predecessor map to a tree map, and avoid trouble with
// parallel edges
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -64,7 +64,7 @@ struct get_planar_embedding
boyer_myrvold_params::kuratowski_subgraph = kur_insert);
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -47,7 +47,7 @@ struct get_random_span_tree
// convert the predecessor map to a tree map, and avoid trouble with
// parallel edges
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -34,7 +34,7 @@ struct get_reciprocity
int i, NV = num_vertices(g);
#pragma omp parallel for default(shared) private(i) reduction(+:L,Lbd) \
schedule(static, 100)
schedule(static) if (NV > 100)
for (i = 0; i < NV; ++i)
{
typename graph_traits<Graph>::vertex_descriptor v = vertex(i, g);
......
......@@ -113,7 +113,7 @@ struct get_mapping
elabelling_t edge_labelling(sub, *g, edge_label1,
any_cast<EdgeLabel>(edge_label2));
int i, N = F.size();
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
if (vertex(i, sub) == graph_traits<Graph1>::null_vertex())
......
......@@ -148,7 +148,7 @@ bool refine_check(const Graph1& sub, const Graph2& g, matrix_t& M, size_t count,
matrix_t M_temp(num_vertices(sub));
int k = 0, N = num_vertices(sub);
#pragma omp parallel for default(shared) private(k) schedule(static, 100)
#pragma omp parallel for default(shared) private(k) schedule(static) if (N > 100)
for (k = 0; k < int(count); ++k)
M_temp[k] = M[k];
......@@ -157,7 +157,7 @@ bool refine_check(const Graph1& sub, const Graph2& g, matrix_t& M, size_t count,
{
n_mod = 0;
bool abort = false;
#pragma omp parallel for default(shared) private(k) schedule(static, 100) \
#pragma omp parallel for default(shared) private(k) schedule(static) if (N > 100) \
reduction(+:n_mod)
for (k = count; k < N; ++k)
{
......@@ -306,7 +306,7 @@ void subgraph_isomorphism(const Graph1& sub, const Graph2& g,
bool abort = false;
int i, N = num_vertices(sub);
#pragma omp parallel for default(shared) private(i) schedule(static, 100)
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100)
for (i = 0; i < N; ++i)
{
if (vertex(i, sub) == graph_traits<Graph1>::null_vertex() || abort)
......
......@@ -75,7 +75,7 @@ struct find_vertices
#endif
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100) \
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100) \
num_threads(nt)
for (i = 0; i < N; ++i)
{
......@@ -117,7 +117,7 @@ struct find_edges
#endif
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(static, 100) \
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100) \
num_threads(nt)
for (i = 0; i < N; ++i)
{
......
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