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
Due to the nature of the fixed command-line parameters available for 3dsmaxcmd.exe, GPU selection for command-line rendering requires the GPU selection to be coded into a pre-render script, which is then passed to 3dsmaxcmd.exe and executed prior to rendering.
Syntax
3dsmaxcmd.exe <scene_file> -preRenderScript:<script_file>
Where <script_file> is the relative path to a MaxScript file containing a call to the command rsSetCudaDevices. The rsSetCudaDevices command takes a single array parameter in MaxScript synyax. The creation of the MaxScript file can be done directly from the command-line as shown in the examples below.
Example
To render scene c:\path\to\scenetorender.max on GPU device 1 only:
echo rsSetCudaDevices #(1) > rsSetCudaDevices.ms3dsmaxcmd.exe c:\path\to\scenetorender.ma –preRenderScript: rsSetCudaDevices.ms
Same scene rendered using GPU device 0 and 1:
echo rsSetCudaDevices #(0,1) > rsSetCudaDevices.ms3dsmaxcmd.exe c:\path\to\scenetorender.ma –preRenderScript: rsSetCudaDevices.ms
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.