Core Isolating Single-Thread Constrained processes (ie. Rhino) using batch/Powershell

windows

#1

Hi all, Please feel free to move this is appropriate.

This started with Revit; which is 80% of my CAD, but applies to any single-thread constrained application.

A while ago I started experimenting with thread isolating my drawing/modelling applications to a single core(2 threads) so that I got snappier performance:
I initially tried just setting a crazy priority; but I theorized that if another thread had already started on my ‘rhino’ core when rhino needed resources it would be less effective to pause those other threads/make rhino ‘wait’ for the resource to free up/shuffle threads out of the way.
So then I tried setting the affinity for the preferred application to one core and for all other processes I excluded that core.
Initial results were a totally non-definitive anecdotal feeling that it was snappier and I had less hangs…hehe (hangs = Revit)

So I started to do this regularly, but found the process of changing affinity was mind numbing and likely stole any/all/more time than any perceived reduction in click-wait times.
Enter Powershell via some late night googling.
below is what I came up with, but it was some time ago and it was at the limits of my hacking ability, so it all looks foreign again:

part 1: Powershell

$Instances=Get-Process
foreach ($I in $Instances){$I.ProcessorAffinity=1}

Part 2: Batch file: runs the ps1 above, then runs Revit/Rhino with affinity & priority then runs another powershell to put all processes back on all cores after Rhino/Rhino is closed:

$Instances=Get-Process
foreach ($I in $Instances){$I.ProcessorAffinity=15}

Can anyone help?
Ideally it could self-adapt to different total number of cores,
and maybe handle new processes - but that seems like a stretch - hence my question: someone might have a solution…

Also, I’ve heard all the standard stuff about: “just buy a faster CPU, windows if pretty good at managing resources etc”.
All are good points: I already buy the fastest mhz CPU I can (&then overclock on my desktops)
but I imagine the resource management ore oriented to ensuring continuity of all ‘user’ initiated process & load balancing with a little emphasis on user experience rather than windows knowing that a program is thread-constrained and dynamically giving it as much space as possible to run.

Wish you could tell windows: ‘for the next n time application x is critical, keep itunes, antivirus, updates, outloook server sync, chrome, etc ALL out of its way’ similar to that crazy little ‘Adjust for best performance of: Programs / background processes’ setting…


(Dale Fugier) #2

Hi @Prehabitat,

Have you seen this?

– Dale


#3

sorry, forgot to paste my batch file; already doing that…
batch file:

Powershell -file “C:\Users\Andrew\Dropbox\Resources\API\Scripting\CPULimit12.ps1”

START “Revit 2015” /C /high /affinity C /W “C:\Program Files\Autodesk\Revit 2015\Revit.exe” /language ENU

Powershell -file “C:\Users\Andrew\Dropbox\Resources\API\Scripting\CPUfullPower1234.ps1”


#4

maybe i could do some testing with/without this trickery using the rhino bnchmark… ill report back