Render from console only on the specified GPU devices

Sometimes, to effectively distribute the hardware load it is necessary to make a render from Blender only on certain video cards of several of them.

To do this we can use a simple script in which specify the numbers of devices to be used for rendering.

First, we need to determine in what order and with what numbers Blender sees the available video cards.

To do this, open the “Text Editor” window in Blender and paste the following script:

Click the “Run Script” button to execute it and a list of available video cards with their order numbers will be displayed in the system console (Window – Toggle System Console).

Getting the necessary numbers, create a file with the “custom_gpu_render.py” name in any text editor, paste the following script into it and save it in the right place.

In the list

in square brackets specify the numbers of the required video cards comma-separated. In the current example script will use 0 and 3 video cards.

To start the render, at the console command prompt type:

for Windows OS (all files are located in the root of drive D):

for Linux OS (all files are located in the /tmp directory):

While rendering, Blender will use only the video cards you specified.

Scripts author: Victor Mukaev.

Nikita

Author: Nikita

Blender add-ons developer and articles writer.