New Job Scheduler Entries

Any issues, problems or troubleshooting topics related to the Prepar3D client application.
MD-82
Posts: 6
Joined: Wed Feb 06, 2019 2:45 pm

New Job Scheduler Entries

Post by MD-82 »

Hello,

when can we expect un updated "Advanced Configuration" site, which explains the new JobScheduler entries?

[JOBSCHEDULER]
P3DCoreAffinityMask=xxxx
MainThreadScheduler=x
RenderThreadScheduler=x
FrameWorkerThreadScheduler=x

Many thanks,

Xander
User avatar
Beau Hollis
Lockheed Martin
Posts: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Re: New Job Scheduler Entries

Post by Beau Hollis »

Sorry about that. We initially held back on documenting it while getting feedback from beta testers. Here is the info I provided to our beta team:

After you run v5.3, you'll see some new entries in the prepar3d.cfg. If you just want to move P3D's main thread off of core 0, you should be able to achieve that by changing just the MainThreadScheduler field.

The values below were written out on a system with an 8 core i7 (16 logical cores)
[JobScheduler]
//This has been upgraded to a full 64-bit value to support systems with more than 32 logical cores.
AffinityMask = 65535

//This is new. This mask tells Prepar3D what cores to use for our job schedulers. It should be a subset of
//the process mask. Masking off some cores from this will leave them open for 3rd party add-ons,
//and middleware dll which share processes space with Prepar3D.exe.
P3DCoreAffinityMask = 65535

//For each bit flipped in the P3DCoreAffinityMask P3D will create a job scheduler which works within
//a thread tied to that logical core by thread affinity. Using these values, you can assign P3D's special
//purpose work loads to different logical cores. Moving the main thread scheduler will also set the
//main thread affinity which will affectively move P3D's main application loop and simulation work
//to this logical core. This core will likely be utilized at or near 100 %
MainThreadScheduler = 0

//This thread does rendering jobs such as building and submitting d3d12 command lists.
RenderThreadScheduler = 2

//This thread does per - frame rendering optimization work such as instancing and sorting of objects
FrameWorkerThreadScheduler = 4
There rest of the job schedulers handle things like terrain loading and batch building so utilization will vary based on what you're doing.

If you want to also test out the new P3D core affinity mask, you can set that with similar values that you might have used before with AffinityMask. This new core mask will largely have the same effect in terms of moving P3D's workloads onto those cores but without preventing other thread outside of our job system from using them. The ideal use case for this would be for a heavy add-on such as PMDG that may want to thread off some work. In this case. You could do something like this.

Here is an example using 8 logical cores:
// Use all cores for Prepar3d.exe affinity mask 0x11111111 = 255
AffinityMask = 255
// Let P3D core work with 6 cores 0b00111111 = 63
P3DCoreAffinityMask = 63
//Or you could keep p3d work (and the main thread by extension)
//off the first 2 cores instead 0x11111100 = 252
P3DCoreAffinityMask = 252
If you want to convert binary to decimal this site is useful:
https://www.mathsisfun.com/binary-decim ... erter.html

On thing to note if you use the scheduler settings, is that those index values are relative to
the list of available cores. With a p3d core mask of 0b00111111, thread scheduler 0 is on core 0, 1 is on 1 etc. In the case of 0b11111100, thread scheduler 0 is now on core 2 because the first two cores were excluded from the mask.

If you have a C++ add-on and you want to try threading some work within the add-on. If you went with a core mask of 252 above that means the first to cores 3 (0b11) are safe to use without conflicting with p3d work. I modified a sample from www.cplusplus.com to show how the affinity mask can be set from code.

https://www.cplusplus.com/reference/thread/thread/

Code: Select all

// thread example
#include <iostream>       // std::cout
#include <thread>         // std::thread
 
void foo() 
{
  // do stuff...
}

void bar(int x)
{
  // do stuff...
}

int main() 
{
  std::thread first (foo);     // spawn new thread that calls foo()
  std::thread second (bar,0);  // spawn new thread that calls bar(0)
  
  // Set thread affinity mask on windows 3 will use only first two cores 
  SetThreadAffinityMask(first.native_handle(), 3);
  SetThreadAffinityMask(second.native_handle(), 3);
  
  std::cout << "main, foo and bar now execute concurrently...\n";

  // synchronize threads:
  first.join();                // pauses until first finishes
  second.join();               // pauses until second finishes

  std::cout << "foo and bar completed.\n";

  return 0;
}

Note that for practical use inside a p3d callback, you wouldn't want to create and join your threads in the same function or you'll stall p3d's thread waiting for yours to complete.
Beau Hollis
Prepar3D Software Architect
MD-82
Posts: 6
Joined: Wed Feb 06, 2019 2:45 pm

Re: New Job Scheduler Entries

Post by MD-82 »

Thank You !!! Reading up now.
grandfred29
Posts: 19
Joined: Tue Nov 26, 2013 9:37 pm

Re: New Job Scheduler Entries

Post by grandfred29 »

Good day

Thanks for these informations
Although how i can set this for the new alder lake 12900k.
Should i consider this cpu as a 8 core ht on or more?
Thanks
User avatar
Beau Hollis
Lockheed Martin
Posts: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Re: New Job Scheduler Entries

Post by Beau Hollis »

If you clear out the affinity mask settings from your config, Prepar3D should populate it with defaults based on the number of logical cores detected. That should give you a decimal number with one bit per core. (eg 65535 is generated for 16 logical cores on an 8 core i7 with hyperthreading enabled). For there you can convert to binary and mask of bits if you want to remove some cores from the application mask or the new p3dCoreAffintiy mask. If you swap out processors, or change hyperthreading settings, you may want to remove those cfg entries and let them regenerate.

Thanks
Beau Hollis
Prepar3D Software Architect
CaptainGaming
Posts: 20
Joined: Thu May 02, 2019 5:31 am

Re: New Job Scheduler Entries

Post by CaptainGaming »

ok i have a I9 11900k, i have hyperthreading on, but affinity mask says 65535, am i lost here?

and can someone explain the affinity mask in laymen terms.

thirdly, can i spread the main thread scheduler to use multiple cores? as well as the other schedulers? like i want render to use threads 2 and 3.

thanks
Ray Proudfoot
Posts: 518
Joined: Thu May 18, 2017 8:19 am

Re: New Job Scheduler Entries

Post by Ray Proudfoot »

I recently turned off Hyperthreading on my 6 core i7-8086K as it introduces extra heat.

I ran Asus Suite to overclock the individual cores and it resulted in 3 @ 5.2 and 3 @ 4.9. A decent improvement over 4.7 on the 12 logical cores previously.

This had improved performance by a small but noticeable amount.

Do LM recommend HT be on for v5.3 irrespective of the number of cores or should I retain my current settings?
Ray (Cheshire, England).

System: P3D v5.3HF2, Intel i9-13900K o/c to 5.8GHz, Nvidia RTX 4090 24Gb, 32Gb Corsair DDR5 RAM, Asus ROG STRIX HERO mobo, Crucial T700 4Tb SSD, Win 11 Pro, BenQ 32” UHD monitor, Fulcrum One Yoke
User avatar
Fresjay76
Posts: 12
Joined: Wed May 29, 2019 3:23 am

Re: New Job Scheduler Entries

Post by Fresjay76 »

So this new feature is possibly one of the most exciting to me. Yet I have some brushing up to do as I haven't messed with affinity mask stuff since I was on FSX. I am currently on v5.2HF1 and the sim runs amazing. But this feature has me itching to move to 5.3. I also recently upgraded my CPU and would love to use some of its 32 logical cores beyond the 1-2 currently used. Even though it currently runs very well, there is room for improvement which is why this feature is so interesting. Are there any plans to post a reference guide per CPU core count to have a as a basis to start from? Or is it going to be a trial and error kind of thing based on the info already provided?

Thanks,
Jason
P3D v5.2HF1, ORBX, Aerosoft, FlyTampa, Flightbeam, FSDT, REX, AS, QW Carenado, PMDG, FSL
System:
Ryzen 9 5950X
ASUS RTX 3080
32Gb DDR4 3600
1Tb Sabrent Rocket (System), 2TB 980 PRO (P3D), 3x1Tb Samsung SSD (Programs), 16TB IronWolf NAS
erikschlijper
Posts: 59
Joined: Thu Apr 16, 2020 5:29 pm

Re: New Job Scheduler Entries

Post by erikschlijper »

I have an Ryzen 5 5600G, 6 cores. According to https://www.gfsg.co.uk/affinitymask.asp ... m=utilties easy mode, all cores enabled that gives me a value of 4092. Is this correct? Cause when I use the expert mode, also all 6 cores + HT it gives me a value of 4095. These two are close apart, but I am just wondering if one of these 2 are the correct values to enter.

Sincerely,

Erik
tedporter
Posts: 3
Joined: Sun Mar 25, 2012 3:07 pm

Re: New Job Scheduler Entries

Post by tedporter »

Hi Erik,

The results you have are correct. In Easy Mode the calculator automatically masks out core 0 and thread 0 = Affinity Mask [ Binary = 111111111100 ] = 4092

What you have done in the Advanced Mode is select all 6 cores with hyperthreading so you get all cores enabled = Affinity Mask [ Binary = 111111111111 ] = 4095

To achive the same result as in the Easy Mode you need to deselect Core[00] and HT[00] in the Advance Mode. I hope this makes sense.

Kind Regards,


Ted.
Saldo
Posts: 428
Joined: Thu Sep 18, 2014 7:26 am

Re: New Job Scheduler Entries

Post by Saldo »

Beau Hollis wrote: Thu Dec 02, 2021 7:19 pm If you clear out the affinity mask settings from your config, Prepar3D should populate it with defaults based on the number of logical cores detected. That should give you a decimal number with one bit per core. (eg 65535 is generated for 16 logical cores on an 8 core i7 with hyperthreading enabled). For there you can convert to binary and mask of bits if you want to remove some cores from the application mask or the new p3dCoreAffintiy mask. If you swap out processors, or change hyperthreading settings, you may want to remove those cfg entries and let them regenerate.

Thanks
Beau, Windows uses cores that are not taxed to the max, so what benefit does this give us ?

If I am correct the Rendering thread already used another core than the main thread so both were on different cores.

A 14 core 7940X or 16 core 12900K has enough cores so what will do this that improves fps ?

Thanks in advance
erikschlijper
Posts: 59
Joined: Thu Apr 16, 2020 5:29 pm

Re: New Job Scheduler Entries

Post by erikschlijper »

tedporter wrote: Fri Dec 03, 2021 2:34 pm Hi Erik,

The results you have are correct. In Easy Mode the calculator automatically masks out core 0 and thread 0 = Affinity Mask [ Binary = 111111111100 ] = 4092

What you have done in the Advanced Mode is select all 6 cores with hyperthreading so you get all cores enabled = Affinity Mask [ Binary = 111111111111 ] = 4095

To achive the same result as in the Easy Mode you need to deselect Core[00] and HT[00] in the Advance Mode. I hope this makes sense.

Kind Regards,


Ted.
Thanks Ted! That totally makes sense to me. But what value should I enable for 5.3? Should I set AffinityMask=4095, and the other one to, about p3d core, to 4092?

Sincerely

Erik
tedporter
Posts: 3
Joined: Sun Mar 25, 2012 3:07 pm

Re: New Job Scheduler Entries

Post by tedporter »

erikschlijper wrote: Fri Dec 03, 2021 2:59 pm
tedporter wrote: Fri Dec 03, 2021 2:34 pm Hi Erik,

The results you have are correct. In Easy Mode the calculator automatically masks out core 0 and thread 0 = Affinity Mask [ Binary = 111111111100 ] = 4092

What you have done in the Advanced Mode is select all 6 cores with hyperthreading so you get all cores enabled = Affinity Mask [ Binary = 111111111111 ] = 4095

To achive the same result as in the Easy Mode you need to deselect Core[00] and HT[00] in the Advance Mode. I hope this makes sense.

Kind Regards,


Ted.
Thanks Ted! That totally makes sense to me. But what value should I enable for 5.3? Should I set AffinityMask=4095, and the other one to, about p3d core, to 4092?

Sincerely

Erik
Hi Erik,

That is not so easy to determine as 5.3GHz is the CPU's collective frequency and regardless of the speed you really need to see which core(s) are being driven the hardest using Task Manger and then using the Advance Mode to create a mask to try and spread the load more. Sorry I cannot give you an exacting answer.

Kind Regards,


Ted.
erikschlijper
Posts: 59
Joined: Thu Apr 16, 2020 5:29 pm

Re: New Job Scheduler Entries

Post by erikschlijper »

tedporter wrote: Fri Dec 03, 2021 3:09 pm
erikschlijper wrote: Fri Dec 03, 2021 2:59 pm
tedporter wrote: Fri Dec 03, 2021 2:34 pm Hi Erik,

The results you have are correct. In Easy Mode the calculator automatically masks out core 0 and thread 0 = Affinity Mask [ Binary = 111111111100 ] = 4092

What you have done in the Advanced Mode is select all 6 cores with hyperthreading so you get all cores enabled = Affinity Mask [ Binary = 111111111111 ] = 4095

To achive the same result as in the Easy Mode you need to deselect Core[00] and HT[00] in the Advance Mode. I hope this makes sense.

Kind Regards,


Ted.
Thanks Ted! That totally makes sense to me. But what value should I enable for 5.3? Should I set AffinityMask=4095, and the other one to, about p3d core, to 4092?

Sincerely

Erik
Hi Erik,

That is not so easy to determine as 5.3GHz is the CPU's collective frequency and regardless of the speed you really need to see which core(s) are being driven the hardest using Task Manger and then using the Advance Mode to create a mask to try and spread the load more. Sorry I cannot give you an exacting answer.

Kind Regards,


Ted.
Hi Ted,

With 5.3 I meant P3DV5.3, my CPU is at stock speed, HT on. No OC to any frequency. I'll do as you've advised! Thanks
User avatar
kevinfirth
Posts: 191
Joined: Wed May 15, 2013 11:24 am
Location: Kidderminster, UK
Contact:

Re: New Job Scheduler Entries

Post by kevinfirth »

Beau Hollis wrote: Thu Dec 02, 2021 2:51 pm If you want to also test out the new P3D core affinity mask, you can set that with similar values that you might have used before with AffinityMask. This new core mask will largely have the same effect in terms of moving P3D's workloads onto those cores but without preventing other thread outside of our job system from using them. The ideal use case for this would be for a heavy add-on such as PMDG that may want to thread off some work. In this case. You could do something like this.

Here is an example using 8 logical cores:
// Use all cores for Prepar3d.exe affinity mask 0x11111111 = 255
AffinityMask = 255
// Let P3D core work with 6 cores 0b00111111 = 63
P3DCoreAffinityMask = 63
//Or you could keep p3d work (and the main thread by extension)
//off the first 2 cores instead 0x11111100 = 252
P3DCoreAffinityMask = 252
Beau, I tried this on my i9 10850K, with the following

NGXu, default scenario, default airport, default weather, no traffic, same settings, not GPu limited, vsync off, unlimited

So, I tried the following two sets of settings. My thinking bearing in mind your statement above that, "The ideal use case for this would be for a heavy add-on such as PMDG that may want to thread off some work.", was that this gives me the first three cores assigned solely to the 3 scheduler threads, 5x physical cores solely for terrain threads, and 2 physical cores for addons and dll's within the sim AM.

[JOBSCHEDULER]
AffinityMask=349525
P3DCoreAffinityMask=21845
MainThreadScheduler=0
RenderThreadScheduler=2
FrameWorkerThreadScheduler=4

52fps - https://ibb.co/8Pqspq8

Then with my previous AM 21845 applied to both:

[JOBSCHEDULER]
AffinityMask=21845
P3DCoreAffinityMask=21845
MainThreadScheduler=0
RenderThreadScheduler=2
FrameWorkerThreadScheduler=4

52fps - https://ibb.co/1RRtspG

As you can see, my test results below with the PMDG NGXu shows zero difference. Am I missing something here please? Under what circumstances might the use of the new P3D AM settings generate performance benefits with an addon like the NGXu which relies heavily on DLL's "which share process space with Prepar3D.exe" please?
Post Reply