8
$\begingroup$

I would like to render an animation on a remote compute cluster with several GPUs. The machine I configure the .blend file on is a laptop on which I cannot enable the User Settings>System GPU compute device setting

enter image description here

It does seem as if I can select GPU render in the render properties: enter image description here

on my laptop. But unfortunately this doesn't seem to have any effect on the remote cluster: Rendering doesn't use the GPU (I checked with nvidia-smi) but uses all available CPU threads. I figured the GPU compute option is greyed out since the laptop I set the scene up with doesn't have a supported GPU to run on. But the machine I render on does.

Unfortunately there is also no way for me to start a graphical session on the remote cluster (blender in GUI mode) so I could change the User settings or confirm the render settings before I render.

I understand that I cannot set GPU rendering from the command line but is there maybe some other way I can setup a .blend file on a machine without GPU to render on the GPU when it is executed? For example: is there a way to start the render with a python script that forces the GPU option before starting the render process?

Thanks a lot for any hints on this!

$\endgroup$
1
$\begingroup$

As far as I understood, you manually put your .blend file on the server without using any third-party software. This answer so may help you:

How do I force the netrender to render everything on GPU?

This consists of running blender from the command line while also passing him a python script to set the GPU device (code from the link above):

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

This way you CAN set GPU rendering from the command line using, in the python script, bpy.context.scene.cycles.device = 'GPU'.

$\endgroup$
0
$\begingroup$

The last I saw on this was a dev note for 2.6. https://wiki.blender.org/index.php/Dev:Source/Render/Cycles/Network_Render which has no discussion. I have not seen any comment or publication that would suggest that baked in network rendering is available and some explicit comments that it will not. However...

Use secondary computer for rendering

has some possible third-party solutions. I do understand your desires in the current GUI as well as the concerns about running headless on the remote. YMMV with the above solutions.

$\endgroup$
0
$\begingroup$

Well you can use scripts that automatically load your blend file (if you like code for that let me know) set the Gpu-settings and render it. You can start the script from cmd and let it run in the background..

Here some codesnippets that work for me

# [8] Enable CUDA and activate GPU
# code from https://developer.blender.org/T54099

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

prefs = bpy.context.user_preferences
cprefs = prefs.addons['cycles'].preferences   

# Attempt to set GPU device types if available
for compute_device_type in ('CUDA', 'OPENCL', 'NONE'):
    try:
        cprefs.compute_device_type = compute_device_type
        break
    except TypeError:
        pass

# Enable all CPU and GPU devices
for device in cprefs.devices:
    device.use = True
$\endgroup$
0
$\begingroup$

Building on the solution above, here's how to run the code snippet as a script on the command line with blender so that your GPU cluster will render using GPUs. Since you can't run a blender UI, you'll need to use the -P option in blender's command line interface to specify a script to be run before rendering.

First save your blend file with GPU compute set (even if its greyed out). This will ensure the file is configured to use GPUs.

Then you'll need to run the script given in the answer above as part of the command to render. Assuming you were on windows:

blender.exe -b -P *path_to_GPU_enable_script* (followed by all other options for rendering)

This command should be run from the location of the blender executable. A similar pattern applies for linux and MacOS.

./blender -b -P *path_to_GPU_enable_script* (followed by all other options for rendering)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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