Author Topic: Use all CPU's on a machine from Maya Job Type  (Read 9357 times)

jbrandibas

  • Sr. Member
  • ****
  • Posts: 35
Use all CPU's on a machine from Maya Job Type
« on: January 22, 2008, 11:54:40 PM »
How do I tell the renderer to use all of the CPU's in the machine to render a frame using the Maya Job Type GUI inside of Maya.  This would be the same as Using all threads (for MR) or Use all processors (Maya SW).  I just discovered that the renders are not utilizing all the cpu's when they are submitted and there is no option to add any flags in the Maya GUI.

This would be the equivalent of using the "-n 0" command on the command line to use all available processors on the machine.

« Last Edit: January 23, 2008, 12:24:21 AM by jbrandibas »

jbrandibas

  • Sr. Member
  • ****
  • Posts: 35
Re: Use all CPU's on a machine from Maya Job Type
« Reply #1 on: January 23, 2008, 12:35:34 AM »
Let me clarify.  I need mental ray to utilize all available CPU's, which is the renderer we use 90% of the time.  Apparently the Maya SW renderer utilizes all available processors by default.
« Last Edit: January 23, 2008, 12:42:54 AM by jbrandibas »

jbrandibas

  • Sr. Member
  • ****
  • Posts: 35
Re: Use all CPU's on a machine from Maya Job Type
« Reply #2 on: January 23, 2008, 01:21:56 AM »
Ok, I just got off the phone with support, and they told me that since the jobtype is basically opening maya and rendering frames, it would use whatever cpu setting is defined in teh render globals.  However, mental ray has no global setting for how many cpu's, or threads, to use.  That is defined in a batch render.   I know that if I interactively render a mental ray frame it does use all processors by default, so I am wondering if maybe there is an issue with the way qube is running on our servers.  I am running OSX on a bank of XServe Quad Xeon machines.  Is there a setting in the qube installation that may be causing the qube process to not use all available processing power?

Maybe a worker setting that I need to change?

shinya

  • Administrator
  • *****
  • Posts: 227
Re: Use all CPU's on a machine from Maya Job Type
« Reply #3 on: January 23, 2008, 10:39:56 AM »
Hi jbrandibas,

I've done some looking into, and found out that the "-n" option for the command-line renderer is a maya software renderer-specfic option.  However, I also found that the mental ray for Maya renderer supports the following option on the command line renderer.

  -art/autoRenderThreads  Automatically determine the number of rendering threads.

Which I believe would do what you describe.

This option internally translates to the following two lines of mel:

  global int $g_mrBatchRenderCmdOption_NumThreadAutoOn = true;
  global int $g_mrBatchRenderCmdOption_NumThreadAuto = true;

So, to work around the issue, you can modify the UniversalMayaRenderJob.pm file found in the maya jobtype folder, and add the above statements.

More specifically, in the subroutine processWork(), in the "elsif" block of code that starts with:

         } elsif ($renderer eq "mentalRay") {

you can add the next two lines of code.

  $self->melexec('global int $g_mrBatchRenderCmdOption_NumThreadAutoOn = true;');
  $self->melexec('global int $g_mrBatchRenderCmdOption_NumThreadAuto = true;');


I'll see about adding a control for this in a future version of our jobtype, but I hope this information helps for now.

-shinya.

jbrandibas

  • Sr. Member
  • ****
  • Posts: 35
Re: Use all CPU's on a machine from Maya Job Type
« Reply #4 on: January 30, 2008, 08:44:26 PM »
Thank you, that worked perfectly.

However, one thing you could add to the maya plugin part of the job type that would probably help a lot of people would be a text field where we could put in our own render flags.

shinya

  • Administrator
  • *****
  • Posts: 227
Re: Use all CPU's on a machine from Maya Job Type
« Reply #5 on: January 30, 2008, 10:27:13 PM »
Hi-

Glad to hear that did the trick.

It would be a bit hard for us to support every command-line option
to the renderer, as we'll need to be able to translate the options into
mel code.  This is because we do not use the "Render" command in our
back-end code to run the renders-- we launch "maya -prompt", and
feed it mel commands to initialize (load scene, etc.), and then
go into a loop where the maya process asks the system for
the next available frame to work on, and renders the frame
(by calling the mel procedure, "mayaBatchRenderProcedure()").

When you specify "batch mode" at submission, the jobtype
does indeed use the "render" command, so in that specific
case we can probably support arbitrary command-line options.

"batch mode", however, lacks many of the advantages of
the regular mode, so it's really meant to be used sparingly,
such as when there's memory leak issues with Maya that
the render requires a fresh instance of maya at every frame.