Sklearn used n_jobs
parameter in multiple functions. We can pass how many cores we want to use. For example 1 for one core and -1 for all cores. My system has six cores and I want to use [0,1,3,4] cores only. Is this possible?
Asked
Active
Viewed 233 times
1

Yahya
- 13,349
- 6
- 30
- 42

Talha Anwar
- 2,699
- 4
- 23
- 62
2 Answers
1
I've never tried nor heard about this possibility before, with scikit-learn
.
Still, as scikit-learn
uses joblib
, it might be the right direction, for you to investigate, to start looking for how to implement your custom ParallelBackendBase
, which is a helper abc that defines all methods a ParallelBackend
must implement 1, 2, 3; you might be able to implement internally CPU Affinity to pin a process to a particular CPU core.
Nevertheless, it is purely experimental.

Yahya
- 13,349
- 6
- 30
- 42
0
No, that is not possible: you can't specify specific cores, that is up to the system.

9769953
- 10,344
- 3
- 26
- 37