6
$\begingroup$

I have a server with an Nvidia GPU card and I want to render my images using Cycles on it. I set up Master and Slave instances on the server and a Client instance on my laptop.

The rendering works, but the server renders the net tasks on CPU, instead of GPU.

If I just run Cycles render locally on the server - GPU works. If I run a client on the server itself and before switching to the netrender choose "GPU Compute" in the render properties - GPU works.

But I cannot select "GPU Compute" on my laptop, because there is no Nvidia GPU card on it.

How do I force the netrender to use GPU instead? Also, is it possible to use different tile sizes for the local render and the netrender, as switching them from preview to final render is too tedious every time.

$\endgroup$
6
$\begingroup$

Network Render plugin does not have this functionality.

Render the scene remotely via the command line. You can run your own script with it to set proper rendering device or render tile-size.

blender -b file.blend -E CYCLES -t 0 -o //file -P script.py

In the script.py:

import bpy

bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
bpy.context.user_preferences.addons['cycles'].preferences.devices[0].use= True

bpy.context.scene.cycles.device = 'GPU'

bpy.context.scene.render.tile_x = 256
bpy.context.scene.render.tile_y = 256

bpy.ops.render.render(write_still=True)

Blender 2.8+

There's an API change for Blender versions 2.8+, it's only bpy.context.preferences (not user_preferences anymore)

| improve this answer | |
$\endgroup$
  • $\begingroup$ So I have to copy my blend file to the server and copy the result back after rendering by hand. That is not what I expected from the Network Render.... $\endgroup$ – galadog Apr 15 '15 at 17:09
  • $\begingroup$ @galadog well yes, you are right. That's the manual way, but you can automate that also with bash for example or with some other code (to distribute the blends and to set the frame ranges automatically). and have all the servers render to the same network location where you will collect the frames. $\endgroup$ – Jaroslav Jerryno Novotny Apr 15 '15 at 17:46
  • 3
    $\begingroup$ A forked network render addon has the ability to overwrite computing device on each slave. See github.com/WARP-LAB/Blender-Network-Render-Additions for the addon. So it is even possible with this to render simultaneously on CPU and GPU. $\endgroup$ – HCW70 Jul 7 '16 at 8:31
0
$\begingroup$

In case it's useful, this version of the script works for me to render with blender 2.8x in a headless machine with a CUDA compatible card:

import bpy

bpy.context.preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'

#calling get_devices() first will populate the devices list
#otherwise the script might find it empty, even when compatible devices are present
bpy.context.preferences.addons['cycles'].preferences.get_devices()
bpy.context.preferences.addons['cycles'].preferences.devices[0].use= True

bpy.context.scene.cycles.device = 'GPU'

#Use auto tile size to automatically set the tile size
#that better takes advantage of your GPU
bpy.ops.preferences.addon_enable(module="render_auto_tile_size")
bpy.context.scene.ats_settings.is_enabled = True

bpy.ops.render.render(animation=True)
| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.