When rendering from the command-line of your 3d app with Redshift, you can specify the GPU devices to use for the rendering job. When specifying the GPU devices from the command-line, the Redshift preferences.xml file is not updated, so running your 3d app in interactive mode will still use the GPU devices that you specified in the System tab of the Redshift render options.
Several render managers including Deadline and Royal Render natively support GPU selection when rendering with Redshift. Selecting only a subset of available GPUs for a job is useful for example to render multiple frames simultaneously on a single machine for optimal scaling.
Prerequisites
When running xsibatch, you should run from the XSI command prompt. You can do this by choosing the "Softimage Command Prompt" shortcut from the start menu. Alternatively, you can open a regular command prompt and "initialize" the required XSI environment variables by executing the following command:
call "C:\Program Files\Autodesk\Softimage 2015 SP2\Application\bin\setenv.bat"
Substitute the path above based on your Softimage version.
Syntax
xsibatch.exe -render <scene_file> -script C:\ProgramData\Redshift\Logic\RedshiftSelectCudaDevices.py -main RedshiftSelectCudaDevices -args -deviceIds <device_id_array>
Where <device_id_array> is a list of the GPU device ids you wish to render with. The syntax for this array is 'python style' - for example use [0,2] to render on devices 0 and 2.
Example
To render scene c:\path\to\scenetorender.scn on GPU device 1 only:
xsibatch.exe -render c:\path\to\scenetorender.scn -script C:\ProgramData\Redshift\Logic\RedshiftSelectCudaDevices.py -main RedshiftSelectCudaDevices -args -deviceIds [1]
Same scene rendered using GPU device 0 and 1:
xsibatch.exe -render c:\path\to\scenetorender.scn -script C:\ProgramData\Redshift\Logic\RedshiftSelectCudaDevices.py -main RedshiftSelectCudaDevices -args -deviceIds [0,1]
How do I determine my GPU device ids?
There are a number of ways to determine the device ids associated with each of your GPUs.
One option is to open prefences.xml from C:\ProgramData\Redshift in a text editor and inspect the value of "AllCudaDevices". For example:
<preference name="AllComputeDevices" type="string" value="0:Quadro K5000,1:Quadro 6000," />
In this case the Quadro K5000 is device 0, while the Quadro 6000 is device 1.