Setting a thread limit on rendering


Occasionally I’m asked whether there is some way to limit XSI/xsibatch to just one CPU, so that while a rendering is going on, the user can use the other CPUs for something else.

XSI does have a -thread command-line switch that limits the number of threads created by mental ray for rendering.

For example, if you turn on Progress diagnostics for a scene and then render from the command line:

xsibatch -thread 1 -render "%XSI_HOME%\Data\XSI_SAMPLES\Scenes\red_jaiqua.scn" -verbose on -frames 1-3

Then you will see progress messages like this:

//..
// INFO : JOB  0.5  progr:    91.0%    rendered on EXAMPLE.3
// INFO : JOB  0.7  progr:    91.3%    rendered on EXAMPLE.3
// INFO : JOB  0.4  progr:    91.5%    rendered on EXAMPLE.3
// INFO : JOB  0.5  progr:    91.8%    rendered on EXAMPLE.3
// INFO : JOB  0.6  progr:    92.1%    rendered on EXAMPLE.3
//...

In those progress messages, EXAMPLE is the computer name, and 3 is the thread number. So you can see that the render is using just one thread.

If you were to use -thread 4, then four threads are created:

// INFO : JOB  0.5  progr:    91.0%    rendered on MTL-P1917.5
// INFO : JOB  0.7  progr:    91.3%    rendered on MTL-P1917.7
// INFO : JOB  0.4  progr:    91.5%    rendered on MTL-P1917.4
// INFO : JOB  0.5  progr:    91.8%    rendered on MTL-P1917.5
// INFO : JOB  0.6  progr:    92.1%    rendered on MTL-P1917.6

2 thoughts on “Setting a thread limit on rendering

    • Right-click the icon and click Properties. On the Shortcut tab, add
      ” -threads 1″ so that the shortcut is “XSI.bat -threads 1”.

      XSI.bat passes any arguments directly to xsi.exe

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s