Windows PS script to specify proc affinity on mayabatch

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 10 October 2012   #1
Windows PS script to specify proc affinity on mayabatch

Hello guys,

I'm trying to create a little script that I could dump in my taskbar and use as a shortcut to free a couple of processors when I want to work while batch rendering...

my problem is that I suck at hexadecimal...

I got to this point :

$process = Get-Process -name mayabatch
$process.ProcessorAffinity = 0x0001

following this example

I have a 12 cores machine, meaning 24 threads... and I can't find the hexadecimal value to use 22 out of the total...

If a kind soul passing by would help me out here, that would make my day.
 
Old 10 October 2012   #2
Cant help you with powerShell, but if you want to share my experience with working all day on render slaves: first you should be able to set the priority of a task permanently. For windows 7 there is a free little tool called prio.exe its a task manager extension that allows you to store the priority you give a certain process. Second, despite setting to idle you will have some lag while working with other apps so the next thing is to set the cores for the task you want to work with while rendering to a single core (prio also saves that) or two ht cores on intel machines (the two virtual cores representing a "true" core, eg 0,1 / 2,3 / 4,5). Should be sufficient for the tasks inside a nowadays 3D app because most of the built in procedures still are single threaded thus it makes no much difference if you crop the affinity to a single core. This sounds like a strange setup but works fine on all machines (XP to Win7) i tested this so far.

Last edited by zaskar : 10 October 2012 at 08:48 AM.
 
Old 10 October 2012   #3
Thanks for your help zaskar, this is very interesting.
I didnt know prio.exe and will check it out.

But the thing is that I don't really want Windows to remember the setting.
Ultimately, I think I'd like to write a toggle script that allocates all cores or frees up two of them.

Maybe I should cross-post this in the programming thread...
 
Old 10 October 2012   #4
Btw if you get this working i would be happy if you could post the script.
 
Old 10 October 2012   #5
If you were to use ProcessLasso or another extensive "Task Manager" type application, you could do this with a simply mouse-click anytime and not have to worry about it. Not only affinity, but throttling, priorities, all of that. Just an idea for you, although writing new scripts can be fun too!
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."
 
Old 10 October 2012   #6
Originally Posted by kAzIDamUI:
$process = Get-Process -name mayabatch
$process.ProcessorAffinity = 0x0001

following this example

I have a 12 cores machine, meaning 24 threads... and I can't find the hexadecimal value to use 22 out of the total...


Here is how to figure out these bit masks as hexadecimal numbers.

Start the windows calculator
Click View->Programmer
Click the "Bin" button
type "1" 22 times (1 meaning use this processor, 0 meaning do not use it)
Click the "hex" button
you can now see that this number 3FFFFF in hexadecimal
Even better, you can see the string of "1" and "0" that this equals to right below just to confrim

if you wanted to assign something to the remaining two cores, you'd type instead
1100 0000 0000 0000 0000 0000
which is C00000 in hexadecimal
 
Old 10 October 2012   #7
Originally Posted by luceric: Here is how to figure out these bit masks as hexadecimal numbers.

Start the windows calculator
Click View->Programmer
Click the "Bin" button
type "1" 22 times (1 meaning use this processor, 0 meaning do not use it)
Click the "hex" button
you can now see that this number 3FFFFF in hexadecimal
Even better, you can see the string of "1" and "0" that this equals to right below just to confrim

if you wanted to assign something to the remaining two cores, you'd type instead
1100 0000 0000 0000 0000 0000
which is C00000 in hexadecimal


Nice !!
I just tested it and it works perfectly.

Now I just need to dig a little more into powerShell to see if I can turn this into a toggle.

Thank you very much sir
 
Old 10 October 2012   #8
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:51 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.