Jump to content
Sign in to follow this  
MammyJammy

New P3D 5.3+ Affinity Mask Calculator

Recommended Posts

…Ah, yes! I do have Riva Tuner up and running. Maybe that is it. Should I turn it off or just remove it from my computer?

 

 

 


i913900KF (5.8GHz) | Case: Fractal PopAir RGB I MSI Z790-VC | MSI Gaming RTX 4070Ti Super 16GB | Kingston Fury Beast 32GB DDR5 | SOLIDIGM P41 Plus 2TB NVMe M.2 SSD | Samsung SSD 870 EVO 2TB | Thermalright Frozen Notte 240 MM Liquid Cooling | Samsung 41" Monitor 1920 x 1080 60Hz | Honeycomb Alpha & Bravo | Logitech G Pro pedals | Tobii EyeTracker

Share this post


Link to post

I suppose it's easy enough to reinstall if it's not the issue, so perhaps removing for a test would be the thing to try if turning it off doesn't help.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post
3 hours ago, SteveW said:

I suppose it's easy enough to reinstall if it's not the issue, so perhaps removing for a test would be the thing to try if turning it off doesn't help.

OK I uninstalled Riva Tuner, re-ran  the sim and I still get a wide fluctuation in FPS, something like down to 24 up to 40+ and readings in between. My previous job scheduler seemed to hold a constant 30 fps. I had P3D Display vSync set to OFF though and Max Frame Rate in 3D settings in NCP set to 30 along with vertical sync set to Adaptive half-refresh rate. I'll give that a try and see what happens.

*Update- I am still using your Scenerio 1 above:

[JobScheduler]
AffinityMask=4053
P3DCoreAffinityMask=4053
MainThreadScheduler=0
RenderThreadScheduler=1
FrameWorkerThreadScheduler=2

The only difference I have is, instead of P3D Display vSync=ON, I switched it to OFF and left the Slider Unlocked. The only thing I have done in 3D settings in NCP is the "Max Frame Rate" is set to 30 and "Vertical sync" is set to  "use the 3D application setting". It is now running at a smooth 30 FPS in both Full Screen & Windowed Modes. So, I have the best of both worlds, using your Job Scheduler recommendation and I am getting a very satisfying Display Performance. Thanks so much for your time.

Regards,

Tom

 

Edited by TomCYYZ
  • Like 1
  • Upvote 1

i913900KF (5.8GHz) | Case: Fractal PopAir RGB I MSI Z790-VC | MSI Gaming RTX 4070Ti Super 16GB | Kingston Fury Beast 32GB DDR5 | SOLIDIGM P41 Plus 2TB NVMe M.2 SSD | Samsung SSD 870 EVO 2TB | Thermalright Frozen Notte 240 MM Liquid Cooling | Samsung 41" Monitor 1920 x 1080 60Hz | Honeycomb Alpha & Bravo | Logitech G Pro pedals | Tobii EyeTracker

Share this post


Link to post

That's great Tom, good work. So I presume you didn't get it going properly with half vsync 30fps in windowed and fullscreen, but works OK with 30 fps limit. If you could get it to half vsync it would be slightly better, but for some reasons that doesn't always work on some systems.

  • Like 1

Steve Waite: Engineer at codelegend.com

Share this post


Link to post
On 2/23/2022 at 11:27 AM, Ray Proudfoot said:

But on the resultant colour boxes VPs 0 and 1 are still shown in light blue. I would have expected them to be grey - (not used for P3D)

Hi @Ray Proudfoot - The new affinity mask settings in 5.3 give some extra flexibility for how to manage the primary P3D threads separate from other threads it may spawn, such as EXE or DLLs associated with add-ons (through an add-on.xml or exe.xml/dll.xml configurations).  This means you can still give extra cores to the P3D process space to keep those things away from the primary cores.  In another thread, Rob Ainscough did some testing and found that reducing the basic AffinityMask didn't make a difference, and my findings have been similar.

So what does First Core Free mean in the tool?  It means that it will mask off the first core from the primary P3D threads/tasks.  These are the heavier hitters of P3D, including the Main, Render, and FrameWorker ThreadSchedulers as well as all the other threads that support them such as scenery loading.  The first core can still be used by other stuff and you can force affinity for things with FSUIPC, Process Lasso, Task Manager, etc. that still need to run within the P3D process space.

 

On 2/23/2022 at 11:27 AM, Ray Proudfoot said:

When I start P3D and it's stabilised I open Task Manager - Details tab and right-click the Prepar3d.exe and choose Set Affinity.

Task Manager will show the affinity of the primary AffinityMask, but not the P3DCoreAffinityMask, which is where the heavy workloads are.

 

On 2/23/2022 at 11:27 AM, Ray Proudfoot said:

If I calculate the AffinityMask manually the sum of 4+8+16+32+64+128+256+1024+2048 is 4092. That means cores 0 and 1 should have little usage but they're just as busy as the remaining cores.

Hmmm....Interesting - That has not been my observation, but I can give it a test over the weekend.  I am running a similar setup on a 12900K (the first processor in many years I've run with hyperthreading on) with the first core free and FSUIPC's [Programs] section handling startup for a bunch of other stuff like ActiveSky, PFPX, and Navigraph Charts affinitized to the first core.  My first core usage (both the physical core and the logical processor that go with it) hovers around 16% when P3D is running.  If I'm recalling a past test correctly, it's somewhere in the 9% range with just the OS and the first core fully masked off from P3D via the AffinityMask setting.  My current test count using a saved scenerio on approach to EGLL with Orbx TrueEarth and Aerosoft Heathrow is somewhere above 83 - Lots of affinity mask and Nvidia settings testing.

 

The only other performance observation I've had with 5.3 and a processor with hyperthreading on is to make sure the cores with the ThreadScheduler, primarily the MainThreadScheduler, has the logical processor masked off.  This gives you the advantage of all the other logical cores with hyperthreading but gives the MainThreadScheduler all the physical compute for that core.  For your CPU, something like this:

https://izn-flightsim.s3.amazonaws.com/affinity.html?cores=6&threads=12&affinity=4095&coreAffinity=4084&mainThread=0&renderThread=1&frameThread=3#presetAnchor

[JobScheduler]
AffinityMask=4095
P3DCoreAffinityMask=4084
MainThreadScheduler=0
RenderThreadScheduler=1
FrameWorkerThreadScheduler=3

The calculator will also be handy for making sure the ThreadSchedulers are numbered correctly, as it is the zero-indexed count of cores within the P3DCoreAffinityMask that indicate where they will run.  If you have hyperthreading on, make sure they are running on physical cores, not logical processors.

Share this post


Link to post

Sorry to point this out, but this is wrong if I understand you correctly:

29 minutes ago, MammyJammy said:

In another thread, Rob Ainscough did some testing and found that reducing the basic AffinityMask didn't make a difference, and my findings have been similar.

There is no logical reason for leaving all the ones in "AffinityMask" and not masking the sister LPs of the main task cores as we do in "P3DCoreAffinityMask" is not so good because add-ons running from within the sim are allowed onto those LPs. It will make a difference if you have an add-on process strong enough and I have tested that and it becomes a problem if that add-on does not do affinity. So in short it is recommended to mask the same main core LPs In "AffinityMask" as we do in "P3DCoreAffinityMask". If we have more than enough cores we can expand the "AffinityMask" over those cores, but not over the main task cores.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post

11,11,11,01,01,01=AffinityMask - expanded over core 5 but not over cores 0,1,2
00,11,11,01,01,01=P3DCoreAffinityMask

11,11,11,11,11,11=AffinityMask - expanded over all cores is wrong - sorry to insist on this.
00,11,11,01,01,01=P3DCoreAffinityMask


Steve Waite: Engineer at codelegend.com

Share this post


Link to post

...I am just testing that again - and with the AffinityMask all ones some threads of a sim launched process go onto those sister LPs increasing work on the main cores unnecessarily. With the expanded region set up in the "AffinityMask" with the sister LPs masked on the main cores, those threads start on those expanded LPs - case closed there.

In any case since the "AffinityMask" contains ones in the same places as the main task LPs there are also threads of a sim launched process starting on those. To really do it justice, it is better to start the add-on process outside of the sim entirely with a batch file or Process Lasso etc.

  • Upvote 1

Steve Waite: Engineer at codelegend.com

Share this post


Link to post

@MammyJammy, what I failed to understand from “first core free” is that is where additional executables should be run. I thought it was purely to keep P3D away from the OS.

I meant no criticism of your excellent calculator. I just think I had a blind spot when using it. It was only when Joe spelt out the JobScheduler entries and the purpose of each the penny dropped.

I’m now using these...

11,11,11,01,01,01=AffinityMask = 4053
11,11,11,01,01,01=P3DCoreAffinityMask = 4053
00,00,00,00,00,01=MainThreadScheduler = 0 = core 0 
00,00,00,00,01,00=RenderThreadScheduler = 1 = core 1 
00,00,00,01,00,00=FrameWorkerThreadScheduler = 2 = core 2

Showing the cores actually used for each command helped clear the fog.

Ignore my addition in my earlier post. I can’t add up!

Your calculator remains extremely helpful to many. I just needed help in a different way.

  • Like 1
  • Upvote 1

Ray (Cheshire, England).
System: P3D v5.3HF2, Intel i9-13900K, MSI 4090 GAMING X TRIO 24G, Crucial T700 4Tb M.2 SSD, Asus ROG Maximus Z790 Hero, 32Gb Corsair Vengeance DDR5 6000Mhz RAM, Win 11 Pro 64-bit, BenQ PD3200U 32” UHD monitor, Fulcrum One yoke.
Cheadle Hulme Weather

Share this post


Link to post
On 2/24/2022 at 7:59 AM, Ray Proudfoot said:

Presumably after setting them PL is no longer needed. But where are those settings stored and how are they implemented?

Hi Ray,

Here's a link to all the details of Process Lasso:

https://bitsum.com/processlasso-docs/

When using Process Lasso you launch the app and it launches a "Management Console (GUI)" and a "Core Engine (Governor) Startup".

The GUI app allows you adjust any settings you like. Once you have established all your preferences you actually don't need it anymore however you must have the "Governor" running for Process Lasso to make Affinity changes or anything else you use it for. In the GUI you can go to Options>General>Configure Startup and disable the GUI but must keep the Governor set to lauch at startup I use "Start at login for all users". The "Governor" runs in the back ground with no discernable impact and will handle all the settings adjustments to affinity masks automatically as apps are launched. You don't have to disable the GUI at startup and when I am optimizing or debugging I use the GUI for useful data gathering and it also has no discernable impact on performance. I also coral Process Lasso itself to the desired cores I want it to use in it's GUI as I do with all the other processes.

Hope this helps

Joe

  • Like 1

Joe (Southern California)

SystemI9-9900KS @5.1Ghz/ Corsair H115i / Gigabyte A-390 Master / EVGA RTX 2080 Ti FTW3 Hybrid w 11Gb / Trident 32Gb DDR4-3200 C14 / Evo 970 2Tb M.2 / Samsung 40inch TV 40ku6300 4K w/ Native 30 hz capability  / Corsair AX850 PS / VKB Gunfighter Pro / Virpil MongoosT-50 Throttle / MFG Crosswind Pedals /   LINDA, VoiceAttack, ChasePlane, AIG AI, MCE, FFTF, Pilot2ATC, HP Reverb G2

Share this post


Link to post

Joe, thanks for the background on PL. After some thought I’ve decided not to bother with it just to control two executables. Neither is particularly resource hungry so changing which cores they run on won’t make any meaningful difference.

If I wasn’t using SimStarterNG it would definitely be useful.

  • Upvote 1

Ray (Cheshire, England).
System: P3D v5.3HF2, Intel i9-13900K, MSI 4090 GAMING X TRIO 24G, Crucial T700 4Tb M.2 SSD, Asus ROG Maximus Z790 Hero, 32Gb Corsair Vengeance DDR5 6000Mhz RAM, Win 11 Pro 64-bit, BenQ PD3200U 32” UHD monitor, Fulcrum One yoke.
Cheadle Hulme Weather

Share this post


Link to post
1 hour ago, Ray Proudfoot said:

@MammyJammy, what I failed to understand from “first core free” is that is where additional executables should be run. I thought it was purely to keep P3D away from the OS.

No worries @Ray Proudfoot - I've been playing around with setups for those additional programs myself (I'm using the [Programs] section of FSUIPC as I don't want to run yet another thing like Process Lasso) and I have the processes running on the first core.  I haven't seen the utilization of either the OS or any of the add-ons create any bottlenecks or thread interrupts across the first physical core and logical processor.  My observations of the newer P3D versions, particularly 5.3, is that it really does benefit from as many cores as you can give it.  I originally had some mask-offs of some of the efficiency cores for those extra programs, such as leaving the last E-core open for add-ons, but found it made a negligible difference in performance vs. giving that extra core to P3D for things like scenery loading, etc.

The only issue I still have RE CPU performance with 5.3 HF2 is the loading stutters related to large BGL files.  The two areas where I have scenarios to reliably test these issues are the Heathrow example I mentioned earlier, and a departure from LAX (Orbx TE Southern CA + FSDT KLAX).  I'm hopeful a fix comes at some point from LM as it's really the last performance issue I'm having with my sim environment.

  • Upvote 1

Share this post


Link to post
8 hours ago, Ray Proudfoot said:

If I wasn’t using SimStarterNG it would definitely be useful

that’s a binary view, Ray

I use SimStarterNG & Process Lasso together - no drama… 

Share this post


Link to post
3 hours ago, craigeaglefire said:

that’s a binary view, Ray

I use SimStarterNG & Process Lasso together - no drama… 

What executables do you control via PL?


Ray (Cheshire, England).
System: P3D v5.3HF2, Intel i9-13900K, MSI 4090 GAMING X TRIO 24G, Crucial T700 4Tb M.2 SSD, Asus ROG Maximus Z790 Hero, 32Gb Corsair Vengeance DDR5 6000Mhz RAM, Win 11 Pro 64-bit, BenQ PD3200U 32” UHD monitor, Fulcrum One yoke.
Cheadle Hulme Weather

Share this post


Link to post

I have 10700k with these settings

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

 

My core2 is still running at 100% utilization.  I tried moving ActiveSky, Lorby, GoFlight, vpilot, RealityXP GTN  to 12 to 14 with ProcessLasso.  P3D is not set in PL, just via the config above.

Any ideas?


10700k / Gigabyte 3060

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