Skip to content

Commit

Permalink
Update parallelize.py
Browse files Browse the repository at this point in the history
  • Loading branch information
IncubatorShokuhou authored Oct 13, 2020
1 parent 6291a08 commit d0ee6e4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions parallelize.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from itertools import islice
import os
import multiprocessing
__version__ = '1.0.0.0_qb'
__version__ = '1.0.0.2'
def get_per_cpu(seq,n_jobs= "half"):
if isinstance(n_jobs, int):
n_jobs_in = n_jobs
Expand All @@ -23,9 +23,8 @@ def get_per_cpu(seq,n_jobs= "half"):
raise
if n_jobs_in > multiprocessing.cpu_count():
print("n_jobs is too large. Turn into max cpu count.")
n_jobs_in1 = min(n_jobs_in,multiprocessing.cpu_count())
n_jobs_in = cpu_number_in1
#print("cpu number:",cpu_number_in)
n_jobs_in = multiprocessing.cpu_count()

def per_cpu(seq,n_jobs_in):
return (islice(seq, cpu, None, n_jobs_in) for cpu in range(n_jobs_in))
return per_cpu(seq,n_jobs_in)
Expand Down

0 comments on commit d0ee6e4

Please sign in to comment.