Skip to content

Commit

Permalink
use available procs for process
Browse files Browse the repository at this point in the history
  • Loading branch information
EricDeveaud committed Jan 26, 2023
1 parent 9777fe6 commit 8270e2d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/megahit
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,12 @@ def check_and_correct_option():
raise Usage('--low-local-ratio should be in (0, 0.5].')
if opt.cleaning_rounds <= 0:
raise Usage('--cleaning-rounds must be >= 1')
if opt.num_cpu_threads > multiprocessing.cpu_count():
logger.warning('Maximum number of available CPU thread is %d.' % multiprocessing.cpu_count())
logger.warning('Number of thread is reset to the %d.' % multiprocessing.cpu_count())
opt.num_cpu_threads = multiprocessing.cpu_count()
if opt.num_cpu_threads > len(os.sched_getaffinity(0)):
logger.warning('Maximum number of available CPU thread is %d.' % len(os.sched_getaffinity(0)))
logger.warning('Number of thread is reset to the %d.' % len(os.sched_getaffinity(0)))
opt.num_cpu_threads = len(os.sched_getaffinity(0))
if opt.num_cpu_threads == 0:
opt.num_cpu_threads = multiprocessing.cpu_count()
opt.num_cpu_threads = len(os.sched_getaffinity(0))
if opt.prune_depth < 0 and opt.prune_level < 3:
opt.prune_depth = opt.min_count
if opt.bubble_level < 0:
Expand Down

0 comments on commit 8270e2d

Please sign in to comment.