I have a shared server with 8 RTX A5000s and am trying to enable GPUs allocated via CUDA_VISIBLE_DEVICES=...
when running blender. The code I have so far is:
def enable_gpus():
# Enable CUDA
bpy.context.preferences.addons['cycles'].preferences.compute_device_type = "CUDA"
# Enable GPUs
for device in bpy.context.preferences.addons['cycles'].preferences.devices:
print(device['name'])
which should just list out the available GPUs that blender is detecting, however this comes back blank with no print statements because there are supposedly no devices blender is finding to iterate through. Any ideas on how I can get this to work? I've tried making sure that cycles is enabled, and have tried different configurations of GPUs to make visible, and am not quite sure where to go from here to troubleshoot. On my own PC without CUDA_VISIBLE_DEVICES
this code is correctly finding my GPUs.
d
defined when you use itprint(d['name'])
. I think you meantdevice
instead ofd
$\endgroup$