Skip to content

Commit 00878d0

Browse files
adelrjnothman
authored andcommitted
[MRG+1] DOC Mention MKL multithreading in FAQ
1 parent ece341c commit 00878d0

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

doc/faq.rst

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ For bug reports or feature requests, please make use of the
5959

6060
There is also a `scikit-learn Gitter channel
6161
<https://gitter.im/scikit-learn/scikit-learn>`_ where some users and developers
62-
might be found.
62+
might be found.
6363

6464
**Please do not email any authors directly to ask for assistance, report bugs,
6565
or for any other issue related to scikit-learn.**
@@ -80,10 +80,10 @@ How can I load my own datasets into a format usable by scikit-learn?
8080
--------------------------------------------------------------------
8181

8282
Generally, scikit-learn works on any numeric data stored as numpy arrays
83-
or scipy sparse matrices. Other types that are convertible to numeric
83+
or scipy sparse matrices. Other types that are convertible to numeric
8484
arrays such as pandas DataFrame are also acceptable.
8585

86-
For more information on loading your data files into these usable data
86+
For more information on loading your data files into these usable data
8787
structures, please refer to :ref:`loading external datasets <external_datasets>`.
8888

8989
.. _new_algorithms_inclusion_criteria:
@@ -105,7 +105,7 @@ numpy array or sparse matrix, are accepted.
105105
The contributor should support the importance of the proposed addition with
106106
research papers and/or implementations in other similar packages, demonstrate
107107
its usefulness via common use-cases/applications and corroborate performance
108-
improvements, if any, with benchmarks and/or plots. It is expected that the
108+
improvements, if any, with benchmarks and/or plots. It is expected that the
109109
proposed algorithm should outperform the methods that are already implemented
110110
in scikit-learn at least in some areas.
111111

@@ -128,8 +128,8 @@ The package relies on core developers using their free time to
128128
fix bugs, maintain code and review contributions.
129129
Any algorithm that is added needs future attention by the developers,
130130
at which point the original author might long have lost interest.
131-
See also :ref:`new_algorithms_inclusion_criteria`. For a great read about
132-
long-term maintenance issues in open-source software, look at
131+
See also :ref:`new_algorithms_inclusion_criteria`. For a great read about
132+
long-term maintenance issues in open-source software, look at
133133
`the Executive Summary of Roads and Bridges
134134
<https://www.fordfoundation.org/media/2976/roads-and-bridges-the-unseen-labor-behind-our-digital-infrastructure.pdf#page=8>`_
135135

@@ -280,6 +280,25 @@ program: Insert the following instructions in your main script::
280280
You can find more default on the new start methods in the `multiprocessing
281281
documentation <https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods>`_.
282282

283+
Why does my job use more cores than specified with n_jobs under OSX or Linux?
284+
-----------------------------------------------------------------------------
285+
286+
This happens when vectorized numpy operations are handled by libraries such
287+
as MKL or OpenBLAS.
288+
289+
While scikit-learn adheres to the limit set by ``n_jobs``,
290+
numpy operations vectorized using MKL (or OpenBLAS) will make use of multiple
291+
threads within each scikit-learn job (thread or process).
292+
293+
The number of threads used by the BLAS library can be set via an environment
294+
variable. For example, to set the maximum number of threads to some integer
295+
value ``N``, the following environment variables should be set:
296+
297+
* For MKL: ``export MKL_NUM_THREADS=N``
298+
299+
* For OpenBLAS: ``export OPENBLAS_NUM_THREADS=N``
300+
301+
283302
Why is there no support for deep or reinforcement learning / Will there be support for deep or reinforcement learning in scikit-learn?
284303
--------------------------------------------------------------------------------------------------------------------------------------
285304

0 commit comments

Comments
 (0)