jabloomf1230 Posted February 5, 2017 Report Posted February 5, 2017 I know that FSUIPC can set an affinity mask for the specific apps that it spawns via the ini file, but has there been any thought to adding an option to allow setting an AM for the host FSUIPC process? I only thought about this because I had posted something here recently about VOXATC. VOXATC consists of a gauge that has an option to allow the user to set its AM prior to run time.
Pete Dowson Posted February 5, 2017 Report Posted February 5, 2017 11 minutes ago, jabloomf1230 said: I know that FSUIPC can set an affinity mask for the specific apps that it spawns via the ini file, but has there been any thought to adding an option to allow setting an AM for the host FSUIPC process? The "host" process being FSX or P3D, you mean? What's wrong with the CFG file parameter for it? Why try to change it after it is running, if you even can? 12 minutes ago, jabloomf1230 said: VOXATC consists of a gauge that has an option to allow the user to set its AM prior to run time. Prior to run time? So it has no effect until you restart the simulator. I suppose it just edits the Prepar3D or FSX CFG file for you. Or do you mean the VOXATC process? Don't forget FSUIPC is just a little DLL running inside the sim, it isn't a separate process. Pete
jabloomf1230 Posted February 5, 2017 Author Report Posted February 5, 2017 Pete, No, VOXATC sets the AM for just its DLL (GAU). I didn't think that a DLL could set its own affinity mask independent of the app that references the library , but I looked it up and according to Microsoft documentation, it is doable without too much fuss. Maybe the option in VOXATC doesn’t really work, because there is no easy way of checking what cores it uses.
Pete Dowson Posted February 5, 2017 Report Posted February 5, 2017 3 minutes ago, jabloomf1230 said: No, VOXATC sets the AM for just its DLL (GAU). I didn't think that a DLL could set its own affinity mask independent of the app that references the library , but I looked it up and according to Microsoft documentation, it is doable without too much fuss. Really? But DLL's are just collections of functions which can be called from anywhere and call functions anywhere else. They are just collections of functions which can be separately loaded instead of bound in like LIBs. So I don't see how you can separate them off to run in a different core, Also, FSUIPC doesn't do anything for long. I mean it has no functions which would occupy a core for long enough to be worth any selection or switching process. It isn't as if it is continuously doing anything. It isn't in a loop polling values anywhere. The joystick scanning is on a timer call, and all the offsets are populated from SimConnect callbacks when the data changes sufficiently. What would you hope to gain? Pete
jabloomf1230 Posted February 5, 2017 Author Report Posted February 5, 2017 Hah, actually I'm not sure, but FSUIPC does handle controller inputs and now does allow for management of AI traffic levels. Again, since FSUIPC is a DLL, there is no easy way to know (at least for me) how it affects CPU load. But keeping it off the first physical core might help P3d. It was just an idle suggestion for future consideration.
Luke Kolin Posted February 5, 2017 Report Posted February 5, 2017 6 hours ago, jabloomf1230 said: according to Microsoft documentation, it is doable without too much fuss. Do you have the link? Cheers!
jabloomf1230 Posted February 8, 2017 Author Report Posted February 8, 2017 Luke, Pete doesn't seem too keen on adding this functionality, probably due to reasons that he stated. I'm pretty sure that any process can be assigned an affinity mask. As to a DLL, any thread that it creates can be assigned to a logical core. My guess is that is how VOXATC does it with its DLL. The assignment is not dynamic but rather it happens via the DLL reading a configuration file (created prior to running the sim by a separate setup utility that determines the number of logical cores and allows the user to set the AM).and then the DLL knows what cores to use. Based on what Pete stated above, it really doesn't seem worth it. Jay
Pete Dowson Posted February 8, 2017 Report Posted February 8, 2017 5 hours ago, jabloomf1230 said: Pete doesn't seem too keen on adding this functionality, probably due to reasons that he stated. I'm pretty sure that any process can be assigned an affinity mask. Yes, but FSUIPC is NOT a process. It runs inside FSX or P3D. THAT's the Process, and can already be assigned affinity. 5 hours ago, jabloomf1230 said: As to a DLL, any thread that it creates can be assigned to a logical core. That's a bit different. A lot of FSUIPC's interfacing to FS cannot be in a separate thread, only in the main FS one. Separate threads are used for each Lua plug-in, and for some other things like button and axis scanning. I suppose, if I found out how, I could restrict all those threads to a given different AM. The standard ones, normal in FSUIPC without plug-ins, probably would make no difference, but I suppose badly written or heavy Lua plug-ins -- especially those using other external libraries -- might give a little benefit. BTW, I don't have VoxATC, but I thought it was a separate process, an EXE, not an internal FS DLL? Do you still have a link, Jabloomf1230? Ah, no. it's okay . I asume you meant "SetThreadAffinityMask". I already use "SetProcessAffinityMask", of course, for the AM= facilirt in the [Programs] section. For now I'll try allowing users to set two different masks -- one for the assorted odd-job threads FSUIPC creates, and one for all of the Lua plug-ins. I could, I suppose, allow Lua threads to set their own via a new function, but that seems a bit overboard. Pete
jabloomf1230 Posted February 8, 2017 Author Report Posted February 8, 2017 Pete, I'm sorry I didn't get back to you right away, but I just got home from a weeks vacation and our boiler's propane tank had run out of gas, so we had no heat. VOXATC is a GAU file which is added to the user's aircraft. The only exes that come with it are utilities for fine tuning the voice recognition and overall settings for the panel (text color, etc.). As to the link, your assumption is correct ( "SetThreadAffinityMask".). I apologize because I'm also trying "reverse engineer" in my head what the developer of VOXATC did to get a DLL to have a user settable affinity mask. VOXATC 7 is still in beta and version 7.2 is a free time-limited (60 days) download if you want to test it out, but you need a microphone on your PC. It's actually quite a clever piece of software, as it uses the built-in Windows speech synthesis and speech recognition for its ATC. It also creates its own AI aircraft and controls them. It scans all the AI traffic BGLs and then generates the AI Traffic. It works with My Traffic 6, WOAI and and UT2 . The only drawback is that it is thus not compatible with SuperTrafficBoard. As I said above, there is no way for a user to tell which threads of an app use which cores, unless it's like the time when LM staff broadly explained on their forum how they arranged the P3d threads on various cores. Jay
Pete Dowson Posted February 8, 2017 Report Posted February 8, 2017 FSUIPC 4.962, now released, allows you to set two affinity masks for FSUIPC. One for all of its own little threads -- probably the more demanding of which would be those associated with WideServer -- and another for all lua plug-ins. See the Changes document included. Pete
jannier Posted February 9, 2017 Report Posted February 9, 2017 Pete not sure I am using it correctly? I have a 6 core Intel 6850K CPU with Hyper threading Enabled. P3D.cfg is set to use AffinityMask=340 ( Binary = 101010100 ) So using processors 2,3,4,5 Logical cores only and not their Hyper Threads. For FSUIPC I want to use the 1st and 6th Core + Thread so I set fsuipc.ini as follows [General] ThreadAffinityMask=3075 [ Binary = 110000000011 ] And fsuipc changes it to xC03 But I get this error in the log: 1750 ### Failed to set FSUIPC general thread affinity mask to 3075 [xC03], Error = 87 What am I doing wrong?
Pete Dowson Posted February 9, 2017 Report Posted February 9, 2017 15 minutes ago, jannier said: But I get this error in the log: 1750 ### Failed to set FSUIPC general thread affinity mask to 3075 [xC03], Error = 87 Well, error 87 is documented as ERROR_INVALID_PARAMETER 87 (0x57) The parameter is incorrect. Looking up the facility to set the affinity I see: If the thread affinity mask requests a processor that is not selected for the process affinity mask, the last error code is ERROR_INVALID_PARAMETER. So, effectively, you can only select cores already selected for the Process (i.e. for P3D). All you can do is keep my stuff off whichever P3D uses most of. I didn't notice that before, but I'll put it into the documentation for the facility. Pete
Luke Kolin Posted February 9, 2017 Report Posted February 9, 2017 It does beg the question of why we need the feature in the first place. ;) Cheers! Luke
Pete Dowson Posted February 9, 2017 Report Posted February 9, 2017 9 minutes ago, Luke Kolin said: It does beg the question of why we need the feature in the first place. ;) Yes, I'd tend to agree. But I suppose if you do see that the sim was using one core much more than others, you could remove FSUIPC threads from that core -- even if their load would be hardly measurable (which I think I did say in the first place). I only added the facility because it was an easy thing to do, and I am a big softie! ;-) I suppose the same must apply to that VoxATC DLL. Pete
jannier Posted February 10, 2017 Report Posted February 10, 2017 18 hours ago, Pete Dowson said: Well, error 87 is documented as ERROR_INVALID_PARAMETER 87 (0x57) The parameter is incorrect. Looking up the facility to set the affinity I see: If the thread affinity mask requests a processor that is not selected for the process affinity mask, the last error code is ERROR_INVALID_PARAMETER. So, effectively, you can only select cores already selected for the Process (i.e. for P3D). All you can do is keep my stuff off whichever P3D uses most of. I didn't notice that before, but I'll put it into the documentation for the facility. Pete Thanks Pete for the information, I got it working now and no more error codes. All I had to do was select at least 1 of the cores that form part of the main Process in this case P3D. So P3D is set to use cores 2-3-4-5, AM=340 (No Hyper threads used) I set FSUIPC to use cores + Hyper treads of 1-5-6, AM=3843 Jannie FSUIPC4.log
Pete Dowson Posted February 10, 2017 Report Posted February 10, 2017 55 minutes ago, jannier said: All I had to do was select at least 1 of the cores that form part of the main Process in this case P3D. So P3D is set to use cores 2-3-4-5, AM=340 (No Hyper threads used) I set FSUIPC to use cores + Hyper treads of 1-5-6, AM=3843 But I suspect that FSUIPC will only be using 5. I think it won't be allowed on cores not allowed for the encompassing process. I might be able to get the actual affinity mask being used back, and log that too, just to check. I'll take a look. Pete
Pete Dowson Posted February 10, 2017 Report Posted February 10, 2017 Following on from my previous message, it seems that I was wrong. Provided the mask you offer features at least one processor which is also in the Process affinity mask, then it accepts and sets the new ones. Here, I added a little more logging (4.962a, which I'll put on the Download Links forum later today): 46863 ### Changed FSUIPC thread affinity mask from 15 [x0F] to 9 [x09] That was with FSX affinity set to 14, so it appears to have successfully added the first processor, x01. However, I still have doubts as to whether it actually uses it. Not sure how to check that. Pete
jabloomf1230 Posted February 11, 2017 Author Report Posted February 11, 2017 10 hours ago, Pete Dowson said: However, I still have doubts as to whether it actually uses it. Not sure how to check that. Pete Yep, That's the problem that I was having trying to understand how VOXATC does it. I suppose one could create a debug version of the DLL that had a looping thread that artificially creates a lot of CPU use. That might be a way of testing the AM. As to the VOXATC GAU DLL it is fairly CPU intensive in bursts as it utilizes the built-in Windows speech synthesis and speech recognition. On a recent CPU like my i7-6700k, AM doesn't seem to really matter though for speech stuff. Running the gauge on a single HT logical core, does seem to slow down the response time but it could also be my imagination. Also see this VC extension (Concurrency Visualizer): https://msdn.microsoft.com/en-us/library/dd537632.aspx Jay
Sabrefly Posted February 17, 2017 Report Posted February 17, 2017 Guys, could you please help me with these 2 settings in FSUIPC4.ini: ThreadAffinityMask=x0 LuaAffinityMask=x0 I have i7 6700k HT off, so I would like to assign ThreadAffinityMask to Core2 and LuaAffinityMask to Core3. So what should be the values, please: ThreadAffinityMask=x0 LuaAffinityMask=x0 Thanks!
Pete Dowson Posted February 18, 2017 Report Posted February 18, 2017 On 2/17/2017 at 1:26 AM, Sabrefly said: I have i7 6700k HT off, so I would like to assign ThreadAffinityMask to Core2 and LuaAffinityMask to Core3. So what should be the values, please: ThreadAffinityMask=x0 LuaAffinityMask=x0 If you count the cores 0, 1, 2, 3 then core 2 is bit 2 or 2^2 = 2x2 = 4, so decimal 4 or hex x4. Likewise core 3 is bit 3 or 2^3 = 2 x 2 x 2 = 8, so decimal 8 or hex x8. If you count the cores 1, 2, 3, 4 then core 2 is bit 1 or 2^1 = 2, so decimal 2 or hex x2. Likewise core 3 is bit 2 or 2^2 = 2 x 2 = 4, so decimal 4 or hex x4. There's a FAQ thread about numbers, bytes and bits. Pete
Sabrefly Posted February 21, 2017 Report Posted February 21, 2017 On 2/18/2017 at 0:36 PM, Pete Dowson said: If you count the cores 0, 1, 2, 3 then core 2 is bit 2 or 2^2 = 2x2 = 4, so decimal 4 or hex x4. Likewise core 3 is bit 3 or 2^3 = 2 x 2 x 2 = 8, so decimal 8 or hex x8. If you count the cores 1, 2, 3, 4 then core 2 is bit 1 or 2^1 = 2, so decimal 2 or hex x2. Likewise core 3 is bit 2 or 2^2 = 2 x 2 = 4, so decimal 4 or hex x4. Pete, how does FSUIPC count cores? 0,1,2,3 or 1,2,3,4? Depending on that I'll set the values for my task. ProcessLasso that I use counts cores 0,1,2,3 I assume FSUIPC does the same, does it not? Thanks, Igor.
Pete Dowson Posted February 21, 2017 Report Posted February 21, 2017 2 hours ago, Sabrefly said: Pete, how does FSUIPC count cores? 0,1,2,3 or 1,2,3,4? Depending on that I'll set the values for my task. It doesn't count them. It uses a bit mask, as in fact in the quote you included Please read that. It tells you how to make the mask either way you like to count them! Pete
jabloomf1230 Posted May 2, 2017 Author Report Posted May 2, 2017 On 2/10/2017 at 9:54 AM, Pete Dowson said: However, I still have doubts as to whether it actually uses it. Not sure how to check that. Pete Yep, That's the problem that I was having trying to understand how VOXATC does it. I suppose one could create a debug version of the DLL that had a looping thread that artificially creates a lot of CPU use. That might be a way of testing the AM. As to the VOXATC GAU DLL it is fairly CPU intensive in bursts as it utilizes the built-in Windows speech synthesis and speech recognition. On a recent CPU like my i7-6700k, AM doesn't seem to really matter though for speech stuff. Running the gauge on a single HT logical core, does seem to slow down the response time but it could also be my imagination. Jay
jabloomf1230 Posted May 2, 2017 Author Report Posted May 2, 2017 Well, as it turns out, the VOXATC panel gauge DLL might not use an affinity mask. That setting is used by the VOXATC ATC server which is an EXE file. I only figured this out recently when P3d CTDed and the ATC server was still running.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now