Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Radek Hušek
group-connectivity-pub
Commits
cd4ed502
Commit
cd4ed502
authored
Dec 10, 2015
by
Radek Hušek
Committed by
Radek Hušek
Nov 09, 2017
Browse files
parmap: add queue_size option
Exposes another parameter for fine tuning parmap.
parent
8be21bb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
groupConnectivity.pyx
View file @
cd4ed502
...
...
@@ -139,7 +139,7 @@ def subdivisionIterator(G, edges = None):
def
generateSubdivisions
(
file
,
G
,
edges
=
None
,
function
=
lambda
H
:
H
.
graph6_string
(),
parallel
=
0
,
chunksize
=
1
):
parallel
=
0
,
chunksize
=
1
,
q_size
=
3
):
f
=
open
(
file
,
'w+'
)
f
.
write
(
"# Subdivisions of edges '%s' of graph '%s' (%s)
\n
"
%
(
edges
,
G
.
graph6_string
(),
G
))
...
...
@@ -148,7 +148,7 @@ def generateSubdivisions(file, G, edges = None,
iterator
=
map
(
function
,
subdivisionIterator
(
G
,
edges
))
else
:
iterator
=
parmap
(
function
,
subdivisionIterator
(
G
,
edges
),
nprocs
=
parallel
,
chunksize
=
chunksize
)
nprocs
=
parallel
,
chunksize
=
chunksize
,
queue_size
=
q_size
)
for
line
in
iterator
:
f
.
write
(
line
)
...
...
parmap.py
View file @
cd4ed502
...
...
@@ -32,11 +32,11 @@ def worker_fun(f, q_in, q_out):
break
q_out
.
put
((
i
,
[
f
(
x
)
for
x
in
chunk
]))
def
parmap
(
f
,
X
,
nprocs
=
None
,
chunksize
=
1
):
def
parmap
(
f
,
X
,
nprocs
=
None
,
chunksize
=
1
,
queue_size
=
3
):
if
nprocs
is
None
:
nprocs
=
multiprocessing
.
cpu_count
()
q_in
=
multiprocessing
.
Queue
(
100
)
q_in
=
multiprocessing
.
Queue
(
queue_size
)
q_out
=
multiprocessing
.
Queue
()
proc
=
[
multiprocessing
.
Process
(
...
...
Write
Preview
Supports
Markdown
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