[SOLVED] Question on CPU Cores and Threads and CPU priority / affinity

May 7, 2021
1
0
10
I am running pretty intensive data processing with Ryzen 7 5800X8-core 16-thread processor , 64GB of memory on ASUS PRIME x570 PRO MB. Hyper V is enabled but not virtualization. I have not set the DORP - so 3200 MHz memory is running at 2133 MHz. (I tried the MB setting but seemed the BIOS were restarting).

The data processing goes in 6 blocks (f, p 1 - 4, copy). The second block (p 1_ is the only one that can multi thread ie where threads can be specified. Looking at processing data the biggest factor influencing throughput seems to the CPU%. The higher the CPU% (around 240+%) seems to get better throughput especially on p 1.

Question:
  1. is there a way I can target a particular CPU% usage? (if i can do it for a certain time or for a certain portion that would be great)
  2. I have not tried CPU prioritization or CPU affinity.
  3. What is the best method to determine how many parallel processing ? I assumed 12 threads out of 16 to be safe with 25% for other system processes (file copy, browser etc). and with multi threading I could to 2 parrallel with 6 threads or 3 parallel with 4 threads each or 6 parallel with 2 thread. I was advised that I could go higher some thing like 12 parallel with 2 threads (( 8 cores + 16 Threads)/2). While I am looking to increase throughput I want stability as well.

thank you all in advance for giving your best advice
 
Solution
The data processing goes in 6 blocks (f, p 1 - 4, copy). The second block (p 1_ is the only one that can multi thread ie where threads can be specified. Looking at processing data the biggest factor influencing throughput seems to the CPU%. The higher the CPU% (around 240+%) seems to get better throughput especially on p 1.

Question:
  1. is there a way I can target a particular CPU% usage? (if i can do it for a certain time or for a certain portion that would be great)
Well specifying threads for p 1_ is the way to target a specific CPU% usage.

In very very general you should always give a multithreading app all available threads of the CPU and let windows figure it out, MS makes great work on their task...

kanewolf

Titan
Moderator
I am running pretty intensive data processing with Ryzen 7 5800X8-core 16-thread processor , 64GB of memory on ASUS PRIME x570 PRO MB. Hyper V is enabled but not virtualization. I have not set the DORP - so 3200 MHz memory is running at 2133 MHz. (I tried the MB setting but seemed the BIOS were restarting).

The data processing goes in 6 blocks (f, p 1 - 4, copy). The second block (p 1_ is the only one that can multi thread ie where threads can be specified. Looking at processing data the biggest factor influencing throughput seems to the CPU%. The higher the CPU% (around 240+%) seems to get better throughput especially on p 1.

Question:
  1. is there a way I can target a particular CPU% usage? (if i can do it for a certain time or for a certain portion that would be great)
  2. I have not tried CPU prioritization or CPU affinity.
  3. What is the best method to determine how many parallel processing ? I assumed 12 threads out of 16 to be safe with 25% for other system processes (file copy, browser etc). and with multi threading I could to 2 parrallel with 6 threads or 3 parallel with 4 threads each or 6 parallel with 2 thread. I was advised that I could go higher some thing like 12 parallel with 2 threads (( 8 cores + 16 Threads)/2). While I am looking to increase throughput I want stability as well.
thank you all in advance for giving your best advice
We can't answer your parallelization question. Your software and data are unique. Only by benchmarking the same data set(s) with different processing parameters can YOU determine what is best.
It may turn out that disabling hyperthreading in the BIOS and using 8 physical cores is most efficient.
Do you have the source code to the software or are you using a commercial package?
 
1. is there a way I can target a particular CPU% usage? (if i can do it for a certain time or for a certain portion that would be great)
No, because apps have no concept of what CPU% usage is. At best what you can do is use libraries to ping how many logical processors there are and spawn as many threads based around that.

2. I have not tried CPU prioritization or CPU affinity.
Apps also can't set this, because it'd be absolutely dangerous if they could. Every app would just give themselves the highest priority.

3. What is the best method to determine how many parallel processing ? I assumed 12 threads out of 16 to be safe with 25% for other system processes (file copy, browser etc). and with multi threading I could to 2 parrallel with 6 threads or 3 parallel with 4 threads each or 6 parallel with 2 thread. I was advised that I could go higher some thing like 12 parallel with 2 threads (( 8 cores + 16 Threads)/2). While I am looking to increase throughput I want stability as well.
Start with one thread as a baseline to see how much performance you can get out of that. Then go with as many threads as your processor can support. You don't need to leave CPU threads open for other things, the OS handles context swapping and such automagically. It's like when you run Cinebench or Prime95, the computer doesn't freeze even though the CPU is at 100% utilization. Besides, every OS reports % Utilization as "how long the CPU didn't run the system idle task"

In any case, if you're not seeing a decent increase in performance with multiple threads, then you'll have to start identifying areas that are holding processing back. Though keep in mind that you'll almost never approach N times the performance unless the problem was proven to be embarrassingly parallel.
 
The data processing goes in 6 blocks (f, p 1 - 4, copy). The second block (p 1_ is the only one that can multi thread ie where threads can be specified. Looking at processing data the biggest factor influencing throughput seems to the CPU%. The higher the CPU% (around 240+%) seems to get better throughput especially on p 1.

Question:
  1. is there a way I can target a particular CPU% usage? (if i can do it for a certain time or for a certain portion that would be great)
Well specifying threads for p 1_ is the way to target a specific CPU% usage.

In very very general you should always give a multithreading app all available threads of the CPU and let windows figure it out, MS makes great work on their task scheduler.

If your working data set doesn't give p 1_ enough work to do then nothing you can do will give you better performance, except for maybe overclocking all the cores.
Apps also can't set this, because it'd be absolutely dangerous if they could. Every app would just give themselves the highest priority.
Yes they can and they do it all the time, often they do it very wrongly like far cry 4 that spawned its first thread on core 3 causing it to not start on dual cores.
Others, like OBS, allow the user to set the priority for themselves from within the program. Most just start with a priority of normal and let windows and/or the user configure it further.
 
Solution
Out of topic but you really need to sort that ram speed out.

You're worrying about parallel processing and thread workloads but in essence getting your ram upto speed is going to have such a performance boost that that worry will become negligible.

Set dpcp on and set ram speed to 2933, that will generally work with the minimum of fuss without messing with timings etc.
 
Yes they can and they do it all the time, often they do it very wrongly like far cry 4 that spawned its first thread on core 3 causing it to not start on dual cores.
Others, like OBS, allow the user to set the priority for themselves from within the program. Most just start with a priority of normal and let windows and/or the user configure it further.
I dug around and found Windows API does let you do both. So I'll give you that

But I mean I think it's reasonable to assume that allowing that much control in a program is a dumb thing, because again, people would just make their programs high priority by default. (https://devblogs.microsoft.com/oldnewthing/?p=13753)
 
I dug around and found Windows API does let you do both. So I'll give you that

But I mean I think it's reasonable to assume that allowing that much control in a program is a dumb thing, because again, people would just make their programs high priority by default. (https://devblogs.microsoft.com/oldnewthing/?p=13753)
If you restrict too much you end up with an OS that nobody wants to use...
Also there would be so much backlash from an app working badly or causing the OS to freeze up that it's a non-matter, it gets resolved by itself, real quick.