Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Tiago Peixoto
graph-tool
Commits
ce197588
Commit
ce197588
authored
Nov 06, 2015
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph_blockmodel.hh: pre-init function cache to prevent race condition if parallel=True
This fixes issue
#252
.
parent
b456f304
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
src/graph/community/graph_blockmodel.hh
src/graph/community/graph_blockmodel.hh
+17
-0
No files found.
src/graph/community/graph_blockmodel.hh
View file @
ce197588
...
...
@@ -2671,6 +2671,23 @@ void move_sweep(vector<BlockState>& states, vector<MEntries>& m_entries_r,
std
::
seed_seq
seq
(
std
::
begin
(
seed_data
),
std
::
end
(
seed_data
));
rngs
.
push_back
(
new
rng_t
(
seq
));
}
// pre-init function cache to prevent race condition
size_t
E
=
0
;
int
i
=
0
,
N
=
num_vertices
(
g
);
#pragma omp parallel for default(shared) private(i) \
reduction(+:E) schedule(runtime)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
())
continue
;
for
(
auto
e
:
out_edges_range
(
v
,
g
))
E
+=
eweight
[
e
];
}
init_lgamma
(
2
*
E
);
init_xlogx
(
2
*
E
);
init_safelog
(
2
*
E
);
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment