Skip to content

Commit cdeb5ca

Browse files
committed
Merge pull request scikit-learn#5635 from ogrisel/ogrisel-joblib-0.9.3
[MRG] Update joblib to 0.9.3
2 parents 425407b + efe93d4 commit cdeb5ca

File tree

4 files changed

+23
-27
lines changed

4 files changed

+23
-27
lines changed

doc/whats_new.rst

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,15 @@ Enhancements
227227
- RCV1 dataset loader (:func:`sklearn.datasets.fetch_rcv1`).
228228
By `Tom Dupre la Tour`_.
229229

230-
- Upgraded to joblib 0.9.2 to benefit from the new automatic batching of
230+
- Upgraded to joblib 0.9.3 to benefit from the new automatic batching of
231231
short tasks. This makes it possible for scikit-learn to benefit from
232232
parallelism when many very short tasks are executed in parallel, for
233233
instance by the :class:`grid_search.GridSearchCV` meta-estimator
234234
with ``n_jobs > 1`` used with a large grid of parameters on a small
235235
dataset. By `Vlad Niculae`_, `Olivier Grisel`_ and `Loic Esteve`_.
236236

237-
- Joblib 0.9.2 also enables the ``forkserver`` start method for
238-
multiprocessing by default under non-Windows platforms for Python 3.4
239-
and later in order to avoid possible crash with some version of BLAS such
240-
as vecLib / Accelerate under OSX for instance. By `Olivier Grisel`_.
241-
242-
- For more details about changes in joblib 0.9.2 see the release notes:
243-
https://github.com/joblib/joblib/blob/master/CHANGES.rst#release-092
237+
- For more details about changes in joblib 0.9.3 see the release notes:
238+
https://github.com/joblib/joblib/blob/master/CHANGES.rst#release-093
244239

245240
- Improved speed (3 times per iteration) of
246241
:class:`decomposition.DictLearning` with coordinate descent method

sklearn/externals/joblib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
116116
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
117117
#
118-
__version__ = '0.9.2'
118+
__version__ = '0.9.3'
119119

120120

121121
from .memory import Memory, MemorizedResult

sklearn/externals/joblib/parallel.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,13 @@
4949
# on a single worker while other workers have no work to process any more.
5050
MAX_IDEAL_BATCH_DURATION = 2
5151

52-
# Under Python 3.4+ use the 'forkserver' start method by default: this makes it
53-
# possible to avoid crashing 3rd party libraries that manage an internal thread
54-
# pool that does not tolerate forking
55-
if hasattr(mp, 'get_start_method'):
56-
method = os.environ.get('JOBLIB_START_METHOD')
57-
if (method is None and mp.get_start_method() == 'fork'
58-
and 'forkserver' in mp.get_all_start_methods()):
59-
method = 'forkserver'
52+
# Under Linux or OS X the default start method of multiprocessing
53+
# can cause third party libraries to crash. Under Python 3.4+ it is possible
54+
# to set an environment variable to switch the default start method from
55+
# 'fork' to 'forkserver' or 'spawn' to avoid this issue albeit at the cost
56+
# of causing semantic changes and some additional pool instanciation overhead.
57+
if hasattr(mp, 'get_context'):
58+
method = os.environ.get('JOBLIB_START_METHOD', '').strip() or None
6059
DEFAULT_MP_CONTEXT = mp.get_context(method=method)
6160
else:
6261
DEFAULT_MP_CONTEXT = None

sklearn/utils/testing.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -711,26 +711,28 @@ def func(*args, **kwargs):
711711
def if_safe_multiprocessing_with_blas(func):
712712
"""Decorator for tests involving both BLAS calls and multiprocessing
713713
714-
Under Python < 3.4 and POSIX (e.g. Linux or OSX), using multiprocessing in
715-
conjunction with some implementation of BLAS (or other libraries that
716-
manage an internal posix thread pool) can cause a crash or a freeze of the
717-
Python process.
718-
719-
Under Python 3.4 and later, joblib uses the forkserver mode of
720-
multiprocessing which does not trigger this problem.
714+
Under POSIX (e.g. Linux or OSX), using multiprocessing in conjunction with
715+
some implementation of BLAS (or other libraries that manage an internal
716+
posix thread pool) can cause a crash or a freeze of the Python process.
721717
722718
In practice all known packaged distributions (from Linux distros or
723719
Anaconda) of BLAS under Linux seems to be safe. So we this problem seems to
724720
only impact OSX users.
725721
726722
This wrapper makes it possible to skip tests that can possibly cause
727-
this crash under OSX with.
723+
this crash under OS X with.
724+
725+
Under Python 3.4+ it is possible to use the `forkserver` start method
726+
for multiprocessing to avoid this issue. However it can cause pickling
727+
errors on interactively defined functions. It therefore not enabled by
728+
default.
729+
728730
"""
729731
@wraps(func)
730732
def run_test(*args, **kwargs):
731-
if sys.platform == 'darwin' and sys.version_info[:2] < (3, 4):
733+
if sys.platform == 'darwin':
732734
raise SkipTest(
733-
"Possible multi-process bug with some BLAS under Python < 3.4")
735+
"Possible multi-process bug with some BLAS")
734736
return func(*args, **kwargs)
735737
return run_test
736738

0 commit comments

Comments
 (0)