Skip to content

Commit

Permalink
Merge pull request #349 from EricDeveaud/master
Browse files Browse the repository at this point in the history
use available processor for process not all on host
  • Loading branch information
aquaskyline authored Feb 14, 2023
2 parents e0f0eca + bb7ebf1 commit 5f329c6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/megahit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# -------------------------------------------------------------------------
# MEGAHIT
Expand All @@ -19,7 +19,6 @@
# -------------------------------------------------------------------------


from __future__ import print_function

import getopt
import json
Expand Down Expand Up @@ -375,7 +374,7 @@ def parse_option(argv):
elif option == '--max-tip-len':
opt.max_tip_len = int(value)
elif option == '--merge-level':
(opt.merge_len, opt.merge_similar) = map(float, value.split(','))
(opt.merge_len, opt.merge_similar) = list(map(float, value.split(',')))
opt.merge_len = int(opt.merge_len)
elif option == '--prune-level':
opt.prune_level = int(value)
Expand Down Expand Up @@ -553,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 5f329c6

Please sign in to comment.