Skip to content
Snippets Groups Projects
Commit 5473738a authored by Radek Hušek's avatar Radek Hušek
Browse files

parmap.py: no subprocesses when nprocs == 1

parent 4659afda
Branches
No related tags found
No related merge requests found
...@@ -87,6 +87,10 @@ def parmap(f, X, nprocs = None, chunksize = 1, chunks_in_flight = None, ...@@ -87,6 +87,10 @@ def parmap(f, X, nprocs = None, chunksize = 1, chunks_in_flight = None,
if nprocs is None: if nprocs is None:
nprocs = multiprocessing.cpu_count() nprocs = multiprocessing.cpu_count()
if nprocs == 1:
if multimap: return chain.from_iterable(map(f, X))
else: return map(f, X)
if in_order: if in_order:
out_chunksize = None out_chunksize = None
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment