Skip to content

sc.external.pp.magic: what is n_jobs's default _really_? #2387

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

Open
alexlenail opened this issue Dec 27, 2022 · 2 comments
Open

sc.external.pp.magic: what is n_jobs's default _really_? #2387

alexlenail opened this issue Dec 27, 2022 · 2 comments
Milestone

Comments

@alexlenail
Copy link

scanpy docs:

n_jobs : Optional[int] (default: None)
Number of threads to use in training. All cores are used by default.

magic docs:

n_jobs (integer, optional, default: 1) – The number of jobs to use for the computation. If -1 all CPUs are used. If 1 is given, no parallel computing code is used at all, which is useful for debugging.

scanpy code:

n_jobs = settings.n_jobs if n_jobs is None else n_jobs

n_jobs=1,

I'm guessing the scanpy docs are wrong when they say "All cores are used by default." ?

@jpmcga
Copy link

jpmcga commented Mar 11, 2025

^^I've empirically confirmed this; been seeing multi-fold speedups when I set n_jobs=-1 corresponding to the number of cores, versus running with the default. From what I can tell, running without specifying n_jobs results in 1 core being used.

@flying-sheep flying-sheep modified the milestones: 1.12.0, 1.11.1 Mar 11, 2025
@flying-sheep
Copy link
Member

Yeah, we definitely need to improve this. #2390 is also relevant here

@flying-sheep flying-sheep modified the milestones: 1.11.1, 1.11.2 Mar 31, 2025
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

3 participants