You are not logged in.

#1 2021-12-03 19:41:40

Dying_Watchdogs
Member
Registered: 2021-11-22
Posts: 39

[Solved] Can I tell a program to not use specific cpu cores?

Hello,

I have a 12th generation intel cpu. It has two different types of cores (P- and E-cores, with the P-cores being the more powerful) with different clock speeds. Currently, the Linux kernel is not optimized to deal with this and I noticed some programs use the E-cores, while the P-cores would be more suited.

These are single-threaded programs (namely Blender), which would benefit from using the P-cores (we're talking about 4.5 vs. 3.7 GHz in turbo mode here). For most programs, I don't really mind, as they are either not particularly computing-power-hungry or multi-threaded, but for Blender, I'd prefer it using the P-cores.

Is there a way to tell Blender to not use certain cores, or, ideally, to prioritize certain cores when running single-threaded (some actions in Blender run multi-threaded and would benefit from being able to use all cores; although most of them are render-type work that can be done by the gpu)?


TIA

Last edited by Dying_Watchdogs (2021-12-03 21:34:50)

Offline

#2 2021-12-03 20:47:46

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 631

Re: [Solved] Can I tell a program to not use specific cpu cores?

Don't know any specifics but I think the term your looking for is "affinity".

Like "processor affinity" or "core affinity".

Offline

#3 2021-12-03 21:25:28

loqs
Member
Registered: 2014-03-06
Posts: 17,884

Re: [Solved] Can I tell a program to not use specific cpu cores?

numactl and taskset can bind a process to a list of cores.  Not sure if it is possible to weight core selection.

Offline

#4 2021-12-03 21:29:22

Dying_Watchdogs
Member
Registered: 2021-11-22
Posts: 39

Re: [Solved] Can I tell a program to not use specific cpu cores?

Zod wrote:

Don't know any specifics but I think the term your looking for is "affinity".

Like "processor affinity" or "core affinity".


Indeed. Seems like the answer is taskset.

loqs wrote:

numactl and taskset can bind a process to a list of cores.  Not sure if it is possible to weight core selection.

Yeah, doesn't look like it. According to the manual, I can set preferred memory in numactl, but it doesn't look like there's an option for cpu preference.

I'll mark it as solved, I don't think it'll get better than this.

Thanks guys_gals.

Last edited by Dying_Watchdogs (2021-12-03 21:34:29)

Offline

#5 2021-12-04 09:35:37

rowdog
Member
From: East Texas
Registered: 2009-08-19
Posts: 118

Re: [Solved] Can I tell a program to not use specific cpu cores?

taskset --cpu-list <list> <command> [options]

is the easiest way I know of but if you find yourself using that command a lot, you might want to look into using a cpuset that consists of all your P cores so you can migrate tasks onto only those cores. If you have trouble finding out which cpus are  E cores and P cores, the hwloc package provides the lstopo command which should be useful.

https://www.kernel.org/doc/html/latest/ … usets.html
https://man.archlinux.org/man/cpuset.7

https://man.archlinux.org/man/lstopo-no-graphics.1.en

Offline

#6 2021-12-04 19:54:20

Rayhem
Member
Registered: 2021-12-01
Posts: 15

Re: [Solved] Can I tell a program to not use specific cpu cores?

Just make sure you know how to back out of any changes you make...

A few months ago I was messing around with things like 'taskset -cp 1-3 <pid>' and testing them with stress -c 16

I also tried 'systemctl set-properly user.slice CPUQuota=50%' and thought I could easily revert by changing it back to 100%... Nope.  Later found out it changes the cpu.cfs_quota_us (I think) file. 
I tried to manually revert the value back to -1 (default)... Nope 
I tried systemctl set-property user.slice CPUQuota='-1'... Nope. 

As usual the answer was very easy, 'systemctl revert user.slice'.

Im only telling you this just to make sure you read the docs and know what youre doing before you get started.

Offline

Board footer

Powered by FluxBB