-
-
Notifications
You must be signed in to change notification settings - Fork 26k
MAINT Replace deprecated cython conditional compilation #25654
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
ogrisel
merged 24 commits into
scikit-learn:main
from
jeremiedbb:cython-compile-time-conditional-deprecated
Feb 25, 2023
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
fdbfd07
try using _OPENMP
jeremiedbb d187922
debug
jeremiedbb ff01278
debug [azure parallel]
jeremiedbb ebe95c1
iter [azure parallel]
jeremiedbb 0233a6e
iter [azure parallel]
jeremiedbb e6f577e
iter [azure parallel]
jeremiedbb 067086b
iter [azure parallel]
jeremiedbb d5769c5
iter [azure_parallel]
jeremiedbb fef52d4
iter [azure parallel]
jeremiedbb 0f422b3
iter [azure parallel]
jeremiedbb caed01d
iter [azure parallel]
jeremiedbb dc542a7
wip
jeremiedbb eecbf54
finalize + update docs
jeremiedbb 8fe4c07
remove DEF as well
jeremiedbb 808f19e
Merge remote-tracking branch 'upstream/main' into cython-compile-time…
jeremiedbb b74d503
even better noops: use full macros
jeremiedbb 714ae33
[cd build]
jeremiedbb 815052e
Update doc/developers/performance.rst
jeremiedbb c7e6f90
Merge branch 'main' into cython-compile-time-conditional-deprecated
jeremiedbb 1daa422
[scipy-dev]
jeremiedbb 4d1b27b
Update sklearn/linear_model/_sgd_fast.pyx
jeremiedbb 2364042
Update sklearn/linear_model/_sgd_fast.pyx
jeremiedbb 3d9e5f1
[scipy-dev]
jeremiedbb a7fc943
Merge branch 'main' into cython-compile-time-conditional-deprecated
ogrisel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -344,27 +344,18 @@ Using OpenMP | |
Since scikit-learn can be built without OpenMP, it's necessary to protect each | ||
direct call to OpenMP. | ||
|
||
There are some helpers in | ||
The `_openmp_helpers` module, available in | ||
`sklearn/utils/_openmp_helpers.pyx <https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/utils/_openmp_helpers.pyx>`_ | ||
that you can reuse for the main useful functionalities and already have the | ||
necessary protection to be built without OpenMP. | ||
provides protected versions of the OpenMP routines. To use OpenMP routines, they | ||
must be cimported from this module and not from the OpenMP library directly:: | ||
|
||
If the helpers are not enough, you need to protect your OpenMP code using the | ||
following syntax:: | ||
|
||
# importing OpenMP | ||
IF SKLEARN_OPENMP_PARALLELISM_ENABLED: | ||
cimport openmp | ||
|
||
# calling OpenMP | ||
IF SKLEARN_OPENMP_PARALLELISM_ENABLED: | ||
max_threads = openmp.omp_get_max_threads() | ||
ELSE: | ||
max_threads = 1 | ||
from sklearn.utils._openmp_helpers cimport omp_get_max_threads | ||
max_threads = omp_get_max_threads() | ||
Comment on lines
+352
to
+353
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks much clearer than before. |
||
|
||
.. note:: | ||
|
||
Protecting the parallel loop, ``prange``, is already done by cython. | ||
The parallel loop, `prange`, is already protected by cython and can be used directly | ||
from `cython.parallel`. | ||
|
||
|
||
.. _profiling-compiled-extension: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.