Hi,
I’m having trouble with gpu rendering a blend file with python script. I have one aws g5 server with Nvidia Tesla A10g GPU. I installed Cuda 11.6 with driver 510 and later on downgraded to Cuda 11.4 with driver 470.
print("devices: ",bpy.context.preferences.addons['cycles'].preferences.devices)
print("get_devices(): ",bpy.context.preferences.addons['cycles'].preferences.get_devices())
print("Compute device type: ",bpy.context.preferences.addons['cycles'].preferences.get_devices_for_type('CUDA'))
print("devices: ",bpy.context.preferences.addons['cycles'].preferences.devices)
print("get_devices(): ",bpy.context.preferences.addons['cycles'].preferences.get_devices())
print("devices: ",bpy.context.preferences.addons['cycles'].preferences.devices)
print("get_devices(): ",bpy.context.preferences.addons['cycles'].preferences.get_devices())
print("DEVICE USAGE: ")
for device in bpy.context.preferences.addons['cycles'].preferences.devices:
print(" - " + device.name + " : " + str(device.use))
print(" - " + device.name + " : " + str(device.use))
I tried to run my python script using blender 2.8.2 (sudo snap install blender --channel=2.82/stable --classic), it perfectly worked fine and printed this:
Blender 2.82 (sub 7) (hash 375c7dc4caf4 built 2020-03-12 05:30:40)
/run/user/1000/gvfs/ non-existent directory
found bundled python: /snap/blender/37/2.82/python
devices: <bpy_collection[0], CyclesPreferences.devices>
get_devices(): ([<bpy_struct, CyclesDeviceSettings("NVIDIA A10G")>, <bpy_struct, CyclesDeviceSettings("AMD EPYC 7R32")>], [<bpy_struct, CyclesDeviceSettings("AMD EPYC 7R32")>])
Compute device type: [<bpy_struct, CyclesDeviceSettings("NVIDIA A10G")>, <bpy_struct, CyclesDeviceSettings("AMD EPYC 7R32")>]
devices: <bpy_collection[3], CyclesPreferences.devices>
get_devices(): ([<bpy_struct, CyclesDeviceSettings("NVIDIA A10G")>, <bpy_struct, CyclesDeviceSettings("AMD EPYC 7R32")>], [<bpy_struct, CyclesDeviceSettings("AMD EPYC 7R32")>])
devices: <bpy_collection[3], CyclesPreferences.devices>
get_devices(): ([<bpy_struct, CyclesDeviceSettings("NVIDIA A10G")>, <bpy_struct, CyclesDeviceSettings("AMD EPYC 7R32")>], [<bpy_struct, CyclesDeviceSettings("AMD EPYC 7R32")>])
DEVICE USAGE:
- NVIDIA A10G : True
- AMD EPYC 7R32 : False
- NVIDIA A10G : True
Blender quit
I tried to run my python script using blender 3.0.1 (sudo snap install blender --channel=3.0/stable --classic), it couldn’t detect the gpus in get_devices(). Notice that when I call devices field, at the beginning it gives bpy_collection[0]
, no device at all. After I run get_devices_for_type('CUDA')
, devices field gives bpy_collection[3]
.
Blender 3.0.1 (hash dc2d18018171 built 2022-01-26 01:01:59)
/run/user/1000/gvfs/ non-existent directory
devices: <bpy_collection[0], CyclesPreferences.devices>
get_devices(): None
Compute device type: [<bpy_struct, CyclesDeviceSettings("NVIDIA A10G") at 0x7f22249b6508>, <bpy_struct, CyclesDeviceSettings("AMD EPYC 7R32") at 0x7f22249b6590>]
devices: <bpy_collection[3], CyclesPreferences.devices>
get_devices(): None
devices: <bpy_collection[3], CyclesPreferences.devices>
get_devices(): None
DEVICE USAGE:
- NVIDIA A10G : True
- AMD EPYC 7R32 : False
- NVIDIA A10G : True
Blender quit
I also tried lots of different versions like 3.1 beta and 3.2 with different cuda configurations. Also, I built two versions of blender from scratch with optix and cycles enabled (tried optix 7.3 and optix 7.4) and docker builts for blender 3.0.1. Couldn’t make it work.
Can you help me fix this? I don’t know why blender 2.82 works fine and versions greater than 3 don’t use the GPU. I have a blend file which I’m rendering for testing. However, it needs at least version 3.0.1. When I use blender 3.0.1, I check it with nvidia-smi. It doesn’t use any gpu.
My Configurations:
Machine: AWS G5.xlarge instance
OS: ubuntu 20.04
Blender Version: 3.0.1, 3.1, 3.2 (those versions don’t use GPU)
GPU: NVIDIA A10G
CUDA: Tried 11.4 (nvidia driver 470) and 11.6 (nvidia driver 510)