Skip to content

Commit

Permalink
Use scheduler's CPU count when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
rrwick committed Mar 13, 2023
1 parent 6d86509 commit c084ad9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion trycycler/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ def load_fasta(fasta_filename, include_full_header=False):


def get_default_thread_count():
return min(multiprocessing.cpu_count(), 16)
try:
num_cpus = len(os.sched_getaffinity(0)) # available on some *nix platforms
except AttributeError:
num_cpus = multiprocessing.cpu_count() # available everywhere
return min(num_cpus, 16)


def write_seq_to_fasta(seq, name, filename):
Expand Down

0 comments on commit c084ad9

Please sign in to comment.