Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default number of CPUs #201

Open
EricDeveaud opened this issue Aug 31, 2022 · 0 comments
Open

default number of CPUs #201

EricDeveaud opened this issue Aug 31, 2022 · 0 comments

Comments

@EricDeveaud
Copy link

EricDeveaud commented Aug 31, 2022

Hello

fusioncatcher tools, eg fusioncatcher.py, blat_parallel.py, overlap.py, ... uses multiprocessing.cpu_count() to ge the numebr of available cpusbut multiprocessing.cpu_count() is the number of cpu in the machine. But this is not the same as the number of cpu available to the process. For example, you can run in a taskset context or a batch scheduler like slurm.

see:

$ nproc
96
$ taskset -c 1 nproc
1
$ taskset -c 1 python3 -c "import multiprocessing; print(multiprocessing.cpu_count())"
96

I would suggest to use len(os.sched_getaffinity(0)) instead of multiprocessing.cpu_count()

$ python3 -c "import os; print(len(os.sched_getaffinity(0)))"
96
$ taskset -c 1 python3 -c "import os; print(len(os.sched_getaffinity(0)))"
1

regards

Eric

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant