On Ubuntu 16.04 (used as a headless renderer with dual GTX 970 STRIX GPUs) after upgrading to blender 2.78b I'm now seeing:
$ blender -b Lightsaber.blend -o //Lightsaber-tst-1_ -E CYCLES -F PNG -x 1 -P cuda0.py -f 1
AL lib: (WW) alc_initconfig: Failed to initialize backend "pulse"
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
read blend: /home/shady/usermaatre/School/Lightsaber.blend
Traceback (most recent call last):
File "/home/shady/usermaatre/School/cuda0.py", line 4, in <module>
bpy.context.user_preferences.system.compute_device_type = 'CUDA'
The cuda0.py script is simple (it comes from BlenderArtists):
$ cat cuda0.py
import bpy, _cycles
bpy.context.scene.cycles.device = 'GPU'
bpy.context.user_preferences.system.compute_device_type = 'CUDA'
# this is different in each cuda[x].py file, CUDA_0, CUDA_1, CUDA_2, CUDA_3
bpy.context.user_preferences.system.compute_device = 'CUDA_0'
I had been running NVIDIA-Linux-x86_64-367.44.run and cuda_7.5.18_linux.run so we tried upgrading to the latest NVIDIA-Linux-x86_64-375.39.run and cuda_8.0.61_375.26_linux.run but that did not help.
I figured maybe the CUDA card has been renamed, so I tried running the script at How do I get Cycles to use GPU on a linux server? and I get a similar result:
$ blender -b -P compute_device_type.py
AL lib: (WW) alc_initconfig: Failed to initialize backend "pulse"
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
Traceback (most recent call last):
File "/home/steven/usermaatre/School/compute_device_type.py", line 7, in <module>
devt = sysp.compute_device_type
AttributeError: 'UserPreferencesSystem' object has no attribute 'compute_device_type'
Blender quit
I'm thinking that something has changed in the naming of the card? Is there a simple way to determine the card attributes? And should the 8.0 drivers work on a headless system or should I go back to 7.5? I'd really rather not have to drop back to 2.78a which had worked...
compute_device_typeis an enum - so if you trycompute_device_type = 'XXX'you will get a TypeError message that lists the valid enum values. – sambler Feb 21 '17 at 04:48enum "XXX" not found in ('NONE', 'CUDA')so settingprefs.compute_device_type = 'CUDA'works and both cards are used. I would also like to be able to address GPU0 & GPU1 separately, butprefs.compute_device = 'CUDA_0'fails. – Shady Puck Feb 21 '17 at 23:35compute_device_type = 'CUDA'and then useaddons['cycles'].preferences.devices[0].use = Falseto disable the first device anddevices[1]for the second. Each device has id, name, type and use properties. – sambler Feb 22 '17 at 00:45prefs.devices[0].use = Falseworked! The above loop printed out<bpy_struct, CyclesDeviceSettings("GeForce GTX 970")>twice but I was not able to determine the deeper structure. How did you determine to set.use = False(where the old way was.compute_device = 'CUDA_0')? I wonder what other options might exist? – Shady Puck Feb 22 '17 at 20:46