Skip to content

Add a chapter about common performance recommendations #40

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

Add a chapter about common performance recommendations #40
Vika-F wants to merge 14 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 system 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.


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?

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

```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.

Comment thread software/scikit-learn-intelex/README.md Outdated
@@ -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.

Comment thread software/scikit-learn-intelex/README.md Outdated
Comment thread software/scikit-learn-intelex/README.md Outdated
Comment thread software/scikit-learn-intelex/README.md Outdated
Comment thread software/scikit-learn-intelex/README.md Outdated
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 thread software/scikit-learn-intelex/README.md Outdated
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 Outdated
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 Outdated
- [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

Comment thread software/scikit-learn-intelex/README.md Outdated
@@ -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.

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

Copilot reviewed 1 out of 7 changed files in this pull request and generated 7 comments.

Comment thread software/common/README.md
Comment on lines +1 to +4
# Introduction

Here are the common recommendations about your system configuration that are beneficial for getting maximum performance from the workloads.

Comment thread software/common/README.md Outdated

## Hyper-threading (HT)

Hyper-threading (HT) is Intel's simultaneous multithreading implementation that can improve the parallelization of computations. When HT is enabled, for each processor core that is physically present, the operating system addresses two logical cores and shares the workload between them when possible. In this case, the logical cores located on a single physical core share the same resources. For resource-demanding workloads it is recommended to disable HT either in BIOS settings or by modifying the affinity settings of the process.
Comment thread software/common/README.md Outdated
Comment thread software/common/README.md

The number of physical and logical cores is listed in the bottom right corner of the tab. In case the number of logical cores is greater, HT is enabled:

![alt text](images/cpu-ht.png)
Comment thread software/common/README.md
Comment on lines +73 to +77
<img src="images/cpu-cores-indices-ht.png" alt="drawing" style="width:600px;"/>

To disable hyper-threading for a process, the affinity mask in binary format should look like:

<img src="images/cpu-affinity-ht.png" alt="drawing" style="width:600px;"/>
Comment thread software/common/README.md

Check the CPU specification on the Intel [products page](https://www.intel.com/content/www/us/en/products/overview.html). Here is an example for the Intel® Core™ Ultra 7 165U processor:

![alt text](images/cpu-specifications.png)
Comment thread software/common/README.md
Comment on lines +139 to +143
<img src="images/cpu-lpe-cores-indices.png" alt="drawing" style="width:600px;"/>

For the example system above, the recommended affinity mask that disables both hyper-threading and LPE cores is `2BFC`:

<img src="images/cpu-affinity-lpe-cores.png" alt="drawing" style="width:600px;"/>
@Vika-F Vika-F changed the title Add a chapter about scikit-learn-intelex Add a chapter about common performance recommendations Jul 22, 2026
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