Jump to content
Sign in to follow this  
mazelda

Sorry another affinity mask question

Recommended Posts

Hi all,

Apologies first, for another of these affinity mask questions but most of the other ones have been based on an intel cpu.

I'm running a 5950x cpu and have smt on in the bios so I have 16 cores and 32 threads.

I always test at UK2000 EGLL in the PMDG 747 with aig ai on, and use ai companion to limit the number of ai to 200 within a 20 mile limit I also use activesky on as well.

Currently flying from 27R I get about 24fps and from 09L about 20fps but things are smooth  I'm running a 2k monitor and have a 3090 ftw gpu.

This is what P3d gave me when updating to the latest version and the fps are shown above with most of my graphic settings almost all to the right and I've not done anything in nvidia control panel regarding settings so that's at whatever it was installed with.

[JobScheduler]
P3DCoreAffinityMask=65535
MainThreadScheduler=0
RenderThreadScheduler=2
FrameWorkerThreadScheduler=4
AffinityMask=65535

Which looks like its disabling the logical threads. As having all the threads enabled should give me 4294967295

using ryzen master it tells me that core 4 and 13 are my best cores and the second best are 6 and 14 

With the above job scheduler settings and using the performance tab of task manager I'm getting these figures

Core 0 running 100%

Core 1 running 40%

Core 2 running 20% 

Core 3 running and spiking to 50% on both parts

Core 5 running about 20%

Core 9 running  spiking to 100% briefly but on a regular basis

All of the other cores are running between 0-10% 

I'm not very good at figuring out how to adjust these figures but I feel i may be able to get a bit more fps out of the machine I understand binary a bit 

Would changing the figures to 4294967295 in P3DCoreAffinityMask be benificial ie using ever core and thread  or changing to AffinityMask=4294967292 which should take everything off Core 0.

Also how would i make better use of my better Cores for  the main,render,and frame worker schedulers, to make better use of my best cores

Hopefully someone can offer some ideas to try especially if Rob Ainscough or Stevew  read this 

Many thanks and apologies for another affinity post.

Edited by mazelda
Numbered cores wrong initially

Pete Little

Share this post


Link to post

You could try this. Core 0 kept free, core 6, 8 & 13 for the 3 main theads with their HT threads off. 


[JobScheduler]
AffinityMask=4294967295
P3DCoreAffinityMask=4160740860
MainThreadScheduler=6
RenderThreadScheduler=9
FrameWorkerThreadScheduler=22

 

See this link and have play. A bit of trial and error required to get the best out of the cpu. 
 

http://izn-flightsim.s3-website-us-east-1.amazonaws.com/affinity.html?cores=16&threads=32&affinity=4294967295&coreAffinity=4160740860&mainThread=6&renderThread=9&frameThread=22#presetAnchor

You could also check Rob Ainscough’s YouTube video, but that did not work well for me on my 3900x, definitely better for me with many core running. 

Cheers Bully. 

Edited by djbully

AMD Ryzen 3900X - Asus Crosshair VI Hero - G.Skill 32GB (2x16GB) 3000 C14 DDR4 @ 3600 14-14-15-14-28-42

AMD Red Devil Radeon 6900XT  2700/2112 1125mv - 3 x Iiyama G-Master GB2888UHSU 4k @ 11560x2160

Saitek X-55 Rhino - Track IR5 - Obutto Sim Cockpit + Triple Monitor Stand - Fancy some Techno? https://www.mixcloud.com/dj_bully/

Share this post


Link to post

// HT Enabled 16 core
// 15,14,13,12,11,10,09,08,07,06,05,04,03,02,01,00=core number
// 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11=AffinityMask = 4294967295
// 11,11,01,11,11,11,11,11,11,01,11,01,11,11,11,00=P3DCoreAffinityMask = 4160740860
// 00,00,00,00,00,00,00,00,00,00,00,01,00,00,00,00=MainThreadScheduler = 6
// 00,00,00,00,00,00,00,00,00,01,00,00,00,00,00,00=RenderThreadScheduler = 9
// 00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00=FrameWorkerThreadScheduler = 22


That's not too bad but the obvious mistake here is to use all ones in AffinityMask which allows processes launched by the sim to occupy the sister Logical Processors of the three main tasks on LPs 9, 13 and 27. Anything sharing those cores will reduce the performance so it is essential to keep those out of AffinityMask, easiest is to use the same value for AffinityMask as we do P3DCoreAffinityMask. If no processes are launched by the sim it doesn't matter but even so there is no logical reason to allow the opportunity of something running on a sister LP of a main task..

Avoiding core zero does not make any difference, it is a myth, but we still ensure that exe apps run alongside the sim are corralled onto cores away from those three main tasks with Process Lasso or simply run from a .BAT.

Instead with this example I would go 4160740860, 4160740860, 6,9,22 because it is important to be sure to disallow other sim processes onto those sister LPs.

For a simplified explanation: 4294967253,4294967253,0,1,2 is easier to grasp:

// HT Enabled 16 core
// 15,14,13,12,11,10,09,08,07,06,05,04,03,02,01,00=core number
// 11,11,11,11,11,11,11,11,11,11,11,11,11,01,01,01=AffinityMask = 4294967253
// 11,11,11,11,11,11,11,11,11,11,11,11,11,01,01,01=P3DCoreAffinityMask = 4294967253
// 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01=MainThreadScheduler = 0
// 00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,00=RenderThreadScheduler = 1
// 00,00,00,00,00,00,00,00,00,00,00,00,00,01,00,00=FrameWorkerThreadScheduler = 2

If we do want to avoid core zero then we can move the '01's up and why not allow background tasks onto core zero since they are not millisecond time critical:

// HT Enabled 16 core
// 15,14,13,12,11,10,09,08,07,06,05,04,03,02,01,00=core number
// 11,11,11,11,11,11,11,11,11,11,11,11,01,01,01,11=AffinityMask = 4294967127
// 11,11,11,11,11,11,11,11,11,11,11,11,01,01,01,11=P3DCoreAffinityMask = 4294967127
// 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00=MainThreadScheduler = 2
// 00,00,00,00,00,00,00,00,00,00,00,00,00,01,00,00=RenderThreadScheduler = 3
// 00,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00=FrameWorkerThreadScheduler = 4

Some systems might not need so many cores used for the background tasks so we can reduce the number by doing:

// HT Enabled 16 core
// 15,14,13,12,11,10,09,08,07,06,05,04,03,02,01,00=core number
// 11,11,11,11,11,11,11,11,11,11,11,11,01,01,01,11=AffinityMask = 4294967127
// 00,00,00,00,11,11,11,11,11,11,11,11,01,01,01,11=P3DCoreAffinityMask = 16777047
// 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00=MainThreadScheduler = 2
// 00,00,00,00,00,00,00,00,00,00,00,00,00,01,00,00=RenderThreadScheduler = 3
// 00,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00=FrameWorkerThreadScheduler = 4

This allows 12 cores for the sim tasks and there are 4 cores for processes launched by the sim and avoids allowing those onto the important cores and no possibility of time critical tasks sharing cores.

I use 4294967253,4294967253,0,1,2 and have tested other combinations to no discernable difference. However the sheer number of background tasks operating might detract from the overall system bandwidth on some systems so reduce the core count. Start with 12 cores as above and in Task Manager LP graph view see how much the background tasks are using up and if they are hitting 100 % add more cores.

 


Steve Waite: Engineer at codelegend.com

Share this post


Link to post

In the last two examples I missed a demonstrative 'one' showing the task location from the lines // 00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,00=MainThreadScheduler = 2, shown in bold underline.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post
4 hours ago, mazelda said:

using ryzen master it tells me that core 4 and 13 are my best cores and the second best are 6 and 14 

So if we use the Ryzen Master best cores 4, 13 and 14 we can write out the logical processor map:

// HT Enabled 16 core
// 15,14,13,12,11,10,09,08,07,06,05,04,03,02,01,00=core number
// 11,01,01,11,11,11,11,11,11,11,11,01,11,11,11,11=AffinityMask = 3623878143
// 11,01,01,11,11,11,11,11,11,11,11,01,11,11,11,11=P3DCoreAffinityMask = 3623878143
// 00,00,00,00,00,00,00,00,00,00,00,01,00,00,00,00=MainThreadScheduler = 8
// 00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00=RenderThreadScheduler = 25
// 00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00=FrameWorkerThreadScheduler = 26

3623878143,3623878143,8,25,26

[JobScheduler]
AffinityMask=3623878143
P3DCoreAffinityMask=3623878143
MainThreadScheduler=8
RenderThreadScheduler=25
FrameWorkerThreadScheduler=26
 

Testing this there is no activity on LPs 9, 27 and 29 which is correct. Works well.

By the way, it is best to keep the order of the special tasks Main, Render and FrameWorker in that ABC order or odd results and even CTDs can happen.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post

Many thanks all,

Especially you Steve ( i was hoping you might answer with some advice.) I will have a good read through all of this. Not sure I understand it all yet but will hopefully at some point.

Do these suggestions take into account my best cores ref Ryzen master? 

That suggests that cores 4 and 13 are my best and the next best are 6 and 14 they are numbered 1-16 in Ryzen master so presumeably that in affinity mask terms would be 3 and 12 as the best cores and 5 and 13 the second best cores

Thanks again

  • Like 1

Pete Little

Share this post


Link to post
1 minute ago, mazelda said:

That suggests that cores 4 and 13 are my best and the next best are 6 and 14 they are numbered 1-16 in Ryzen master so presumeably that in affinity mask terms would be 3 and 12 as the best cores and 5 and 13 the second best cores

Ahh yes, the cores are counted from core 1 to 16 in Ryzen Master, but in P3D we count from zero and only count the ones in P3DCoreAffinityMask.

In that case we can write out the LP map again using cores 4,13,14 and keeping our ABC order

// HT Enabled 16 core
// 16,15,14,13,12,11,10,09,08,07,06,05,04,03,02,01=core number in Ryzen Master
// 11,11,01,01,11,11,11,11,11,11,11,11,01,11,11,11=AffinityMask = 4127195007
// 11,11,01,01,11,11,11,11,11,11,11,11,01,11,11,11=P3DCoreAffinityMask = 4127195007
// 00,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00=MainThreadScheduler = 6
// 00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00=RenderThreadScheduler = 23
// 00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00=FrameWorkerThreadScheduler = 24

[JobScheduler]
AffinityMask=4127195007
P3DCoreAffinityMask=4127195007
MainThreadScheduler=6
RenderThreadScheduler=23
FrameWorkerThreadScheduler=24
 

  • Upvote 1

Steve Waite: Engineer at codelegend.com

Share this post


Link to post

thanks again quick question regarding the scheduler numbers if i understand it correctly 

I get mainscheduler as being 8  because all threads are showing a 1

renderscheduler is 25 because core 4 also has a 0 in it  therefore in total there are 25 1's before core 13 and frameworker is 26 as core 13 also has a 0 in it.

 

 


Pete Little

Share this post


Link to post

We only count the 'ones' in P3DCoreAffinityMask starting from zero on the right. So the first main task, MainThreadScheduler, is on the 6th 'one', and continue counting only the 'ones' gives 23 and 24.

  • Upvote 1

Steve Waite: Engineer at codelegend.com

Share this post


Link to post

[JobScheduler]
AffinityMask=4127195007
P3DCoreAffinityMask=4127195007
MainThreadScheduler=6
RenderThreadScheduler=23
FrameWorkerThreadScheduler=24

Remember we only count the ones from right to left in P3DCoreAffinityMask starting from zero:

11,11,01,01,11,11,11,11,11,11,11,11,01,11,11,11=P3DCoreAffinityMask = 4127195007

In bold underline we count the ones to 6, 23, and 24

So I have been testing that: 4127195007,4127195007,6,23,24 and this shows that LPs 7,25,27 are inactive which is exactly what we want. Main is on LP6, render is on LP24 and Frame is on LP 26.

  • Upvote 1

Steve Waite: Engineer at codelegend.com

Share this post


Link to post

The reason to have no activity on the sister LP of the main task cores is this:

Since a single core can only "do" 100% throughput, what does it mean when both LPs of that core show 100% in Task Manager graphs? Well, that means they are each only getting 50% of that possible throughput. That would not be any good for the MainThreadScheduler to only get 50% instead of 100%.

If we have one LP at say 90% and the other at say 40% we can do the math: 100% (capacity) divide by 90 + 40 = 130 (total shown) which is 100 / 130=0.77.

So we can say approximately, that the 90% LP is actually 90 x 0.77 = 69.2% and the 40% LP is actually 40 x 0.77 = 30.8%

  • Like 2

Steve Waite: Engineer at codelegend.com

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...