Skip to content

Add a chapter about scikit-learn-intelex#40

Open
Vika-F wants to merge 8 commits into
intel:mainfrom
Vika-F:sklex
Open

Add a chapter about scikit-learn-intelex#40
Vika-F wants to merge 8 commits into
intel:mainfrom
Vika-F:sklex

Conversation

@Vika-F

@Vika-F Vika-F commented Jun 30, 2026

Copy link
Copy Markdown

Add information about sklearnex configurations that can provide better performance.

CC @napetrov @david-cortes-intel @avolkov-intel @Alexandr-Solovev

@david-cortes-intel david-cortes-intel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments:

  • Could make it clear that OMP settings related to affinity will not have an effect.
  • Could provide commands to do all of this programmatically instead of manually listing the core IDs after looking at output.
  • This advise is not really specific to sklearnex. Maybe could be put as an additional section and then linked from all the relevant articles, like NumPy and scikit-learn.

Comment thread software/scikit-learn-intelex/README.md Outdated

To set EPB to Performance mode:
```
sudo cpupower set -b 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't explain the longevity of the effect from this command. Same for the other CPU settings.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vika-F Bumping up comment.

@Vika-F

Vika-F commented Jun 30, 2026

Copy link
Copy Markdown
Author

Could make it clear that OMP settings related to affinity will not have an effect.

Ok, will do.

Could provide commands to do all of this programmatically instead of manually listing the core IDs after looking at output.

You mean, python commands doing the same things like affinity modification?

This advise is not really specific to sklearnex. Maybe could be put as an additional section and then linked from all the relevant articles, like NumPy and scikit-learn.

Yes, I thought about it as well, but was not sure. I will restructure the pages accordingly.

@david-cortes-intel

Copy link
Copy Markdown
Contributor

You mean, python commands doing the same things like affinity modification?

I guess they'd have to be shell commands, otherwise they wouldn't have an effect on an already-launched python process.

@Vika-F

Vika-F commented Jul 1, 2026

Copy link
Copy Markdown
Author

I guess they'd have to be shell commands, otherwise they wouldn't have an effect on an already-launched python process.

I understand the idea, but it will be a multi-line script for sure. Not a single sed .... Will it be Ok? I mean, I do not see similar code in the other chapters.

@david-cortes-intel

Copy link
Copy Markdown
Contributor

I guess they'd have to be shell commands, otherwise they wouldn't have an effect on an already-launched python process.

I understand the idea, but it will be a multi-line script for sure. Not a single sed .... Will it be Ok? I mean, I do not see similar code in the other chapters.

@Vika-F isn't there any built-in numactl command do something like "run only physical cores"?

@Vika-F

Vika-F commented Jul 1, 2026

Copy link
Copy Markdown
Author

@Vika-F isn't there any built-in numactl command do something like "run only physical cores"?

No, there is no such option.

@Vika-F

Vika-F commented Jul 1, 2026

Copy link
Copy Markdown
Author

@david-cortes-intel An example of a script that runs a process only on physical nodes:
run_no_ht.sh

For me it looks too heavy for the page like this. What do you think?

@david-cortes-intel

Copy link
Copy Markdown
Contributor

@david-cortes-intel An example of a script that runs a process only on physical nodes: run_no_ht.sh

For me it looks too heavy for the page like this. What do you think?

@Vika-F How about something in a pipeline (perhaps with awk?) getting the result from lscpu with arguments, filtering, and selecting a column?


```bash
export MIN_MHZ=3000
cpus=$(lscpu -e=cpu,core,maxmhz | tail -n +2 | awk -v min="$MIN_MHZ" '$3 >= min && !seen[$2]++ {printf sep $1; sep=","}')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this MIN_MHZ could also be obtained with awk from lscpu -e=cpu,core,maxmhz.

@Vika-F Vika-F Jul 3, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that there are various SKUs available, i.e. with P-cores only; with P-cores and E-cores; with E-cores and LP E-cores, etc.

Without MIN_MHZ the solution can exclude not LPE, but another type of cores with the lowest frequency.
That's why I decided just to provide the MHz threshold.

@@ -0,0 +1,133 @@
This chapter contains information about the practices that lead to better performance of scikit-learn-intelex on Intel CPUs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs title and table of contents.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new documentation aimed at improving scikit-learn-intelex workload performance on Intel CPUs by describing recommended system/CPU configuration and process pinning practices, and links the new chapter from the repo’s main README.

Changes:

  • Add a new scikit-learn-intelex chapter covering hyper-threading and LPE-core affinity recommendations (Windows/Linux).
  • Add a shared “common” chapter with OS-level recommendations (EPB/EPP and CPU frequency scaling).
  • Link the new scikit-learn-intelex chapter from the top-level README.

Reviewed changes

Copilot reviewed 3 out of 9 changed files in this pull request and generated 6 comments.

File Description
software/scikit-learn-intelex/README.md New chapter with HT/LPE detection and affinity guidance for Windows and Linux.
software/common/README.md New common system tuning guidance (EPB/EPP and CPU frequency scaling).
README.md Adds the scikit-learn-intelex chapter to the main table of contents.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


### On Windows

Hyper-threading can be deteched by running **Task Manager**. Then navigate to **Performance** > **CPU** tab.

<img src="images/cpu-affinity-ht.png" alt="drawing" style="width:600px;"/>

Which is equivalent to `2BFF` in hexadecimal format. Run following command to disable HT on Windows:
Comment on lines +94 to +95
The recommended affinity mask that disables both hyper-threading and LPE cores would be `2BFC`:

Comment on lines +60 to +69
From the output we can see that 4 logical processors (0, 1, 2, 3) are running on two physical cores (0, 1).
To run the process on physical cores only, use one of the following commands:

```
numactl -C 0,2,4-13 python <workload.py>
```
or
```
taskset -c 0,2,4-13 python <workload.py>
```
Comment on lines +128 to +132
Run the following command to disable HT and LPE cores on Linux:

```
numactl -C 0,2,4-11 python <workload.py>
```
Comment thread software/common/README.md
Comment on lines +10 to +34
## Energy Performance Bias (EPB)

Energy Performance Bias (EPB) is an Intel Xeon hardware setting that controls the trade-off between power consumption and processing performance. For the best performance, it is recommended to set it to `0` (Performance mode).

### On Windows

Run the following command in `cmd`:

```
powercfg -setacvalueindex scheme_current sub_processor PERFEPP 0
```

[More info about `powercfg`](https://learn.microsoft.com/en-us/windows-hardware/customize/power-settings/options-for-perf-state-engine-perfenergypreference).

### On Linux

To check the current value of EPB, run:
```
sudo cpupower info
```

To set EPB to Performance mode:
```
sudo cpupower set -b 0
```
Comment thread README.md
- [Redis](software/similarity-search/redis/README.md)
- [Spark](software/spark/README.md)
- [scikit-learn](software/scikit-learn/README.md)
- [scikit-learn-intelex](software/scikit-learn-intelex/README.md)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose that this PR is changed to live completely in the Software->Common directory

@@ -0,0 +1,140 @@
# Introduction

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contents for the scikit-learn-intelex README don't seem specific to scikit-learn-intelex. I recommend merging this README with the one you created in the "common" directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants