Skip to content

Commit

Permalink
BUG: Num processes exceeds number of slices (#444)
Browse files Browse the repository at this point in the history
This patch prevents extra python processes from being spawned when the amount of work to be done is less than the number of processes.
  • Loading branch information
malte-storm authored and carterbox committed Aug 16, 2019
1 parent cb774ef commit 1a5efd8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions source/tomopy/util/mproc.py
Expand Up @@ -141,8 +141,7 @@ def get_ncore_nchunk(axis_size, ncore=None, nchunk=None):

def get_ncore_slices(axis_size, ncore=None, nchunk=None):
# default ncore to max (also defaults ncore == 0)
if not ncore:
ncore = mp.cpu_count()
ncore = min(mp.cpu_count() if not ncore else ncore, axis_size)
if nchunk is None:
# calculate number of slices to send to each GPU
chunk_size = axis_size // ncore
Expand Down

0 comments on commit 1a5efd8

Please sign in to comment.