8000 FIX Missing num_threads in some HGBT pranges (#22566) · scikit-learn/scikit-learn@5c7dac0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c7dac0

Browse files
FIX Missing num_threads in some HGBT pranges (#22566)
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
1 parent 998e8f2 commit 5c7dac0

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

doc/whats_new/v1.1.rst

+6
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,12 @@ Changelog
330330
:class:`ensemble.ExtraTreesClassifier`.
331331
:pr:`20803` by :user:`Brian Sun <bsun94>`.
332332

333+
- |Fix| Removed a potential source of CPU oversubscription in
334+
:class:`ensemble.HistGradientBoostingClassifier` and
335+
:class:`ensemble.HistGradientBoostingRegressor` when CPU resource usage is limited,
336+
for instance using cgroups quota in a docker container. :pr:`22566` by
337+
:user:`Jérémie du Boisberranger <jeremiedbb>`.
338+
333339
:mod:`sklearn.feature_extraction`
334340
.................................
335341

sklearn/ensemble/_hist_gradient_boosting/splitting.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ cdef class Splitter:
335335

336336
# map indices from sample_indices to left/right_indices_buffer
337337
for thread_idx in prange(n_threads, schedule='static',
338-
chunksize=1):
338+
chunksize=1, num_threads=n_threads):
339339
left_count = 0
340340
right_count = 0
341341

@@ -377,7 +377,7 @@ cdef class Splitter:
377377
# sample_indices. This also updates self.partition since
378378
# sample_indices is a view.
379379
for thread_idx in prange(n_threads, schedule='static',
380-
chunksize=1):
380+
chunksize=1, num_threads=n_threads):
381381
memcpy(
382382
&sample_indices[left_offset[thread_idx]],
383383
&left_indices_buffer[offset_in_buffers[thread_idx]],

0 commit comments

Comments
 (0)
0