8000 [MRG] Fix OpenMP runtime error on mac by jeremiedbb · Pull Request #13294 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG] Fix OpenMP runtime error on mac #13294

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

Merged
merged 3 commits into from
Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions build_tools/azure/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ if [[ "$UNAMESTR" == "Darwin" ]]; then
export CXXFLAGS="$CXXFLAGS -I/usr/local/opt/libomp/include"
export LDFLAGS="$LDFLAGS -L/usr/local/opt/libomp/lib -lomp"
export DYLD_LIBRARY_PATH=/usr/local/opt/libomp/lib

# avoid error due to multiple OpenMP libraries loaded simultaneously
export KMP_DUPLICATE_LIB_OK=TRUE
fi

make_conda() {
Expand Down
3 changes: 0 additions & 3 deletions build_tools/travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ then
export CXXFLAGS="$CXXFLAGS -I/usr/local/opt/libomp/include"
export LDFLAGS="$LDFLAGS -L/usr/local/opt/libomp/lib -lomp"
export DYLD_LIBRARY_PATH=/usr/local/opt/libomp/lib

# avoid error due to multiple OpenMP libraries loaded simultaneously
export KMP_DUPLICATE_LIB_OK=TRUE
fi

make_conda() {
Expand Down
12 changes: 12 additions & 0 deletions sklearn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import re
import warnings
import logging
import os

from ._config import get_config, set_config, config_context

Expand Down Expand Up @@ -47,6 +48,17 @@
__version__ = '0.21.dev0'


# On OSX, we can get a runtime error due to multiple OpenMP libraries loaded
# simultaneously. This can happen for instance when calling BLAS inside a
# prange. Setting the following environment variable allows multiple OpenMP
# libraries to be loaded. It should not degrade performances since we manually
# take care of potential over-subcription performance issues, in sections of
# the code where nested OpenMP loops can happen, by dynamically reconfiguring
# the inner OpenMP runtime to temporarily disable it while under the scope of
# the outer OpenMP parallel section.
os.environ.setdefault("KMP_DUPLICATE_LIB_OK", "True")


try:
# This variable is injected in the __builtins__ by the build
# process. It is used to enable importing subpackages of sklearn when
Expand Down
0