Got the affinity working, but priority still says normal when I look in the Task Manager details despite using /high in the arguments? Or is there somewhere else I should look to see its priority?
Here's a PowerShell solution. You can short this into one line. [System.Diagnostics.Process]::Start("skse64_loader.exe").WaitForExit(); $p = [System.Diagnostics.Process]::GetProcessesByName("SkyrimSE")[0]; $p.PriorityClass = 0x80; $p.ProcessorAffinity = 0xFF5;
boring3, is your powershell solution possible to run within MO2? I tried replacing the arguments with your example (changed to my system drive letters etc), and it just hangs with an open command prompt window. So I thought maybe I need to replace the binary field with the Powershell .exe location, but then it just opens and closes powershell and the game never runs.
I don't think there's any thing you need to modify in the code snippet. But yes. It's bit complicated if you want to run in Mo2 or Vortex. Still. Not hard anyway.
I would like to share my experience here too. The methods with CMD don't work for me, the SKSE plugin also didn't work, probably some problem with my machine since it works for so many people, interestingly the method with PowerShell works very well. It suddenly occurred to me that more people might have this problem so I came here to tell you what I did.
I already had a script that I used to start Skyrim with High Priority as well as set Affinity and after seeing the thppysnek's method using CMD I thought it might be possible to do the same with Powershell, and thanks to Talos I was absolutely right, in general it's exactly the same thing, you just need to change the CMD executable to PowerShell that is in: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
In this case the afinicade is adjusted following the xrayy's method for a 16-thread processor, which is my case, but if someone has more or less threads it is possible to adjust easily by changing the 4th line ($mask = '1111111111110101';) , here it is possible to see sixteen numbers ranging between 0 and 1 between '', each of these numbers represents a thread, 1 means that the SkyrimSE process can use the thread, 0 means the opposite, if your processor has more threads you should add 1 until the number of characters between '' equals the number of available threads, if you have less, just delete 1 until equaling the amount. That is, for a 12-thread processor the 4th line would look like this: $mask = '111111110101';
If you have 20 threads it would look like this: $mask = '11111111111111110101';
That's it, after adjusting the amount of threads you just need to copy and paste the code into Arguments.
Result:
Sorry if it got too confused, I'm not very good at explaining things and English isn't my native language so I'm turning to Google Translate. If anyone wants to make a tutorial in order to make it clearer feel free to use any content from this post.
so I've read the comments on here mentioning the CPU affinity calculator and that for someone with 12 cores it's 0-11 you check, then you uncheck 1 and 3. however after trying to figure out myself how to do a 24 core CPU that has 8 P-cores and 16 E-cores and failing miserably to find an answer. does anyone know how to do that? I think it should be 0-23 checked but that's where I get stuck is what to do after that. hoping someone can help, thanks in advance to whoever can.
I! yes I, shall gladly accept your thanks! Per xrayy's guide, with the help of this CPU Affinity Calculator, and with your setup, you should have this:
These are the same instructions for boring3's Skyrim Priority SE AE - skse plugin. His solution is a plugin whereas here we're using powershell (this works no matter the Skyrim version/SKSE version).
Yes. Actually, likely no. What we're doing here is using powershell to implement what xrayy describes in his mod, xrayys optimized skyrim cpu balance. He states that his cpu balancing trick works "if you own a cpu with at least 4 physical cores/8 logical cores". Refer to his mod first, then use the techniques here to implement it.
Oops, my bad, I misread your CPU description. You stated you have 4 physical/4 logical, so xrayy's method may not work for you as he stated you would need 8 logical cores.
Please use the link to the hexidecimal calculator to convert values.
From Katarsi's comment below: CPU Affinity Mask Calculator Check the boxes in the calculator table starting from 0. If you have 12 threads (logical processors), check 0-11. Then uncheck 1 and 3. The result in the CPU Affinity Bitmask (hex) box below the table will tell you. For example, mine is 0x0000000000000FF5.
12900k has 8 performance cores 8 efficiency cores (16 cores in total) and 24 threads.
So on any CPU it's a matter of unchecking core 1+3? I happen to own Processor Lasso- I guess I could just disable 1+3 there in a Skyrim SE profile and then I'd be good to go?
There is no code per se with this, it's a batch file approach (or powershell) that uses OS commands to set how your Skyrim program is handled in memory. The new Skyrim Priority mod uses the SKSE and other utilities to do the same thing but as a SKSE mod. Use one or the other but not both.
I have a solid pc but not the best in the world and I've been running rudy enb and dyndolod for some time, I have been searching for something like this for a very long time as I just needed a tiny push to get 60 FPS everywhere almost and ths did it. Thanks man.
If you use Skyrim Priority, then no, you don't need this. However, if there's another game update and throws the SKSE addresses off thus outmoding the Skyrim Priority, you can always come back to using this approach.
Sorry, haven't reviewed comments in a while. You need to launch the game through whatever configures the priority and availability. So, if you use the batch file approach, use the batch file always.
All these technicalities are a little bit over my head but I'm willing to figure it out. I have a rather good processor in my laptop, 6 cores 12 threads. I installed Process Lasso. I'm using xrayys principle too. Well, I didn't actually start using anything, I'm just preparing. Right now I'm at setting up the Executable in my MO2. I'm stuck at figuring out the hexadecimal equivalent of CPU priority. I take it FF5 isn't the one for me, but how do I see which one is? It actually is FF5, figured out how to look it up in Process Lasso.
CPU Affinity Mask Calculator Check the boxes in the calculator table starting from 0. If you have 12 threads (logical processors), check 0-11. Then uncheck 1 and 3. The result in the CPU Affinity Bitmask (hex) box below the table will tell you. For example, mine is 0x0000000000000FF5.
79 comments
windows - Is process priority inherited? - Stack Overflow
Here's a PowerShell solution.
You can short this into one line.
[System.Diagnostics.Process]::Start("skse64_loader.exe").WaitForExit();
$p = [System.Diagnostics.Process]::GetProcessesByName("SkyrimSE")[0];
$p.PriorityClass = 0x80;
$p.ProcessorAffinity = 0xFF5;
Priority Classes:
https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass#parameters
To use with arguments
[System.Diagnostics.Process]::Start("skse64_loader.exe", "arg1 arg2").WaitForExit();
But yes. It's bit complicated if you want to run in Mo2 or Vortex.
Still. Not hard anyway.
And next version of Skyrim Priority will able to set Affinity and have TES6 Redfall Support.
Sorry there's still some other competitor. I can't stop my step.
thanks!
The methods with CMD don't work for me, the SKSE plugin also didn't work, probably some problem with my machine since it works for so many people, interestingly the method with PowerShell works very well. It suddenly occurred to me that more people might have this problem so I came here to tell you what I did.
I already had a script that I used to start Skyrim with High Priority as well as set Affinity and after seeing the thppysnek's method using CMD I thought it might be possible to do the same with Powershell, and thanks to Talos I was absolutely right, in general it's exactly the same thing, you just need to change the CMD executable to PowerShell that is in:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
And paste this code into Arguments:
Start-Process skse64_loader.exe;
$nid = (Get-Process skse64_loader).id;
Wait-Process -Id $nid;
$mask = '1111111111110101';
$bits = [Convert]::ToInt32($mask, 2);
$Process = Get-Process SkyrimSE;
$Process.ProcessorAffinity = $bits;
$Process.PriorityClass = 'high'
In this case the afinicade is adjusted following the xrayy's method for a 16-thread processor, which is my case, but if someone has more or less threads it is possible to adjust easily by changing the 4th line ($mask = '1111111111110101';) , here it is possible to see sixteen numbers ranging between 0 and 1 between '', each of these numbers represents a thread, 1 means that the SkyrimSE process can use the thread, 0 means the opposite, if your processor has more threads you should add 1 until the number of characters between '' equals the number of available threads, if you have less, just delete 1 until equaling the amount. That is, for a 12-thread processor the 4th line would look like this:
$mask = '111111110101';
If you have 20 threads it would look like this:
$mask = '11111111111111110101';
That's it, after adjusting the amount of threads you just need to copy and paste the code into Arguments.
Result:
Sorry if it got too confused, I'm not very good at explaining things and English isn't my native language so I'm turning to Google Translate. If anyone wants to make a tutorial in order to make it clearer feel free to use any content from this post.
Per xrayy's guide, with the help of this CPU Affinity Calculator, and with your setup, you should have this:
These are the same instructions for boring3's Skyrim Priority SE AE - skse plugin. His solution is a plugin whereas here we're using powershell (this works no matter the Skyrim version/SKSE version).
Yes. Actually, likely no. What we're doing here is using powershell to implement what xrayy describes in his mod, xrayys optimized skyrim cpu balance.He states that his cpu balancing trick works "if you own a cpu with at least 4 physical cores/8 logical cores". Refer to his mod first, then use the techniques here to implement it.
From Katarsi's comment below:
CPU Affinity Mask Calculator
Check the boxes in the calculator table starting from 0. If you have 12 threads (logical processors), check 0-11. Then uncheck 1 and 3. The result in the CPU Affinity Bitmask (hex) box below the table will tell you. For example, mine is 0x0000000000000FF5.
12900k has 8 performance cores 8 efficiency cores (16 cores in total) and 24 threads.
So on any CPU it's a matter of unchecking core 1+3? I happen to own Processor Lasso- I guess I could just disable 1+3 there in a Skyrim SE profile and then I'd be good to go?
I have a rather good processor in my laptop, 6 cores 12 threads. I installed Process Lasso. I'm using xrayys principle too. Well, I didn't actually start using anything, I'm just preparing. Right now I'm at setting up the Executable in my MO2.
I'm stuck at figuring out the hexadecimal equivalent of CPU priority.
I take it FF5 isn't the one for me, but how do I see which one is?It actually is FF5, figured out how to look it up in Process Lasso.Check the boxes in the calculator table starting from 0. If you have 12 threads (logical processors), check 0-11. Then uncheck 1 and 3. The result in the CPU Affinity Bitmask (hex) box below the table will tell you. For example, mine is 0x0000000000000FF5.