AWS Thinkbox Discussion Forums

Constraining # of threads for Maya / MtoA rendering

When we used a different renderfarm management system, I was able to limit the number of concurrent threads used by a single render task by injecting "-ai:threads " into the command-line parameters. (To be clear, we’re using MtoA for rendering, not the default Maya software renderer.)

It appears that one can do this in the Maya “Submit Job To Deadline” dialog, in the “Maya Render Job” section, by changing the parameter of the “Threads” slider from 0 to . (Let’s say is 8.)

Is there some file I can edit in the Deadline Repository so that, by default, that Threads slider is set to and not to 0?

Alternatively, can I edit repository/plugins/MayaCmd/MayaCmd.py and add " -ai:threads 8 " to the rendererArguments variable with a

rendererArguments += " -ai:threads 8"

perhaps right after

rendererArguments += " -ai:lve " + str(verbosity)

Also: does any of that matter if we check the “Use MayaBatch Plugin?”

(You may wonder, why do this at all? Well, we’re having trouble with longer ( > 400 frames / shot) jobs eventually failing on the renderfarm, and they work if we break them up into smaller chunks. Free of any constraints, Maya will use ALL THE CORES and drive the load up on the renderfarm hosts. What I’m trying to do is rein that in just a bit, and find a balance between “gee, this render job takes forever” and “gee, the load average climbs into triple digits… oh, now the job’s failing.”)

Hello!

In Mayabatch plugin we create and execute a mel script to render. The Submitter added a PluginInfo entry for the MaxProcessors which has the Thread number the process can use. To have it to work, you would need to make sure that the Override CPU Affinity and Limit Threads to CPU Affinity is enabled. Here is the code from the DeadlineRepository/plugins/MayaBatch/MayaBatch.py on Line #2397:

    def GetThreadCount( self ):
        threads = self.GetIntegerPluginInfoEntryWithDefault( "MaxProcessors", 0 )
        if self.OverrideCpuAffinity() and self.GetBooleanConfigEntryWithDefault( "LimitThreadsToCPUAffinity", False ):
            affinity = len( self.CpuAffinity() )
            if threads == 0:
                threads = affinity
            else:
                threads = min( affinity, threads )
                
        return str( threads )

For the MayaCmd.py, you can add Thread to the render arguments with Maya executable. Add the below code on line #341 under DeadlineRepository/plugins/MayaCmd/MayaCmd.py:

rendererArguments += " -ai:threads " + self.GetPluginInfoEntryWithDefault( "MaxProcessors", "0" )

This will set the render argument for -ai:threads and pull the value from the pluginInfo file’s MaxProcessors field.

Thanks for the reply, Karpreet.

I’m interpreting what you are saying as (a) I don’t need to alter the MayaBatch.py file, and (b) there’s a small change I need to make to “MayaCmd.py”.

The rest I’m a little confused about.

I see an “Limit Threads to CPU Affinity” True/False option in Configure Plugins → MayaBatch - should I set that to True? (It’s False now.)

Where’s the “Override CPU Affinity” option located?

Finally, you speak of a “pluginInfo” file - where would that be located?

It appears that the “Limit Threads to CPU Affinity” is in Configure Plugins → MayaBatch, and “Override CPU Affinity” is in each renderfarm host’s Worker Configuration.

I should set both to TRUE and, in “Override CPU Affinity,” set the number of CPUs to be used?

Yep, that’ll put an upper limit on the number of cores Deadline runs Maya under.

Privacy | Site terms | Cookie preferences