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 (Windows only)
Your Redshift installation for Maya needs to be configured to run correctly from the command-line. This step is required for all command-line rendering with Maya and Redshift and is not directly related to command-line GPU selection. This requires that the full path to Maya's Render.exe must be part of your PATH environment variable. If you have multiple versions of Maya installed on your machine, the path to the Maya version you are rendering with must come before the path to other Maya versions.
Syntax
Render.exe -r redshift -gpu <device_id_array> <scene_file>
Where <device_id_array> is a list of the GPU device ids you wish to render with. The syntax for this array is 'mel style' - for example use {0,2} to render on devices 0 and 2.
Example
To render scene c:\path\to\ scenetorender.ma on GPU device 1 only:
Render.exe -r redshift -gpu {1} c:\path\to\scenetorender.ma
Same scene rendered using GPU device 0 and 1:
Render.exe -r redshift -gpu {0,1} c:\path\to\scenetorender.ma
On Linux and macOS, the curly braces around the GPU device id array may need to be escaped to prevent the shell from changing the syntax.
Render -r redshift -gpu \{0,1\} /path/to/scenetorender.ma
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.