Skip to content

Commit

Permalink
BLD Add missing OpenMP dependencies in relevant meson.build (scikit-l…
Browse files Browse the repository at this point in the history
  • Loading branch information
lesteve authored Aug 29, 2024
1 parent 142d824 commit 602aaaa
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions doc/whats_new/v1.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Version 1.5.2

**release date of 1.5.2**

Changes impacting many modules
------------------------------

- |Fix| Fixed performance regression in a few Cython modules in
`sklearn._loss`, `sklearn.manifold`, `sklearn.metrics` and `sklearn.utils`,
which were built without OpenMP support.
:pr:`29694` by :user:`Loïc Estèvce <lesteve>`.

Changelog
---------

Expand Down
1 change: 1 addition & 0 deletions sklearn/_loss/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ _loss_pyx = custom_target(
py.extension_module(
'_loss',
_loss_pyx,
dependencies: [openmp_dep],
cython_args: cython_args,
install: true,
subdir: 'sklearn/_loss',
Expand Down
2 changes: 1 addition & 1 deletion sklearn/manifold/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ py.extension_module(
py.extension_module(
'_barnes_hut_tsne',
'_barnes_hut_tsne.pyx',
dependencies: [np_dep],
dependencies: [np_dep, openmp_dep],
cython_args: cython_args,
subdir: 'sklearn/manifold',
install: true
Expand Down
4 changes: 2 additions & 2 deletions sklearn/metrics/_pairwise_distances_reduction/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ _argkmin_classmode_pyx = custom_target(
_argkmin_classmode = py.extension_module(
'_argkmin_classmode',
_argkmin_classmode_pyx,
dependencies: [np_dep],
dependencies: [np_dep, openmp_dep],
override_options: ['cython_language=cpp'],
cython_args: cython_args,
# XXX: for some reason -fno-sized-deallocation is needed otherwise there is
Expand All @@ -199,7 +199,7 @@ _radius_neighbors_classmode_pyx = custom_target(
_radius_neighbors_classmode = py.extension_module(
'_radius_neighbors_classmode',
_radius_neighbors_classmode_pyx,
dependencies: [np_dep],
dependencies: [np_dep, openmp_dep],
override_options: ['cython_language=cpp'],
cython_args: cython_args,
subdir: 'sklearn/metrics/_pairwise_distances_reduction',
Expand Down
1 change: 1 addition & 0 deletions sklearn/metrics/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ _dist_metrics = py.extension_module(
py.extension_module(
'_pairwise_fast',
['_pairwise_fast.pyx', metrics_cython_tree],
dependencies: [openmp_dep],
cython_args: cython_args,
subdir: 'sklearn/metrics',
install: true
Expand Down
2 changes: 1 addition & 1 deletion sklearn/utils/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ utils_extension_metadata = {
'sparsefuncs_fast':
{'sources': ['sparsefuncs_fast.pyx']},
'_cython_blas': {'sources': ['_cython_blas.pyx']},
'arrayfuncs': {'sources': ['arrayfuncs.pyx']},
'arrayfuncs': {'sources': ['arrayfuncs.pyx'], 'dependencies': [openmp_dep]},
'murmurhash': {
'sources': ['murmurhash.pyx', 'src' / 'MurmurHash3.cpp'],
},
Expand Down

0 comments on commit 602aaaa

Please sign in to comment.