Managing several GPUs


Let’s assume that I have two GPUs installed on my PC: one with CUDA and one with OpenCL. I’d like to write a script that checks all GPUs and sets CUDA GPU as active rendering device if it’s available whereas OpenCL GPU should be the second best option to choose.

How can I get all devices and their types in 2.8? In previous versions I used compute_device_type, but it’s outdated now.

The list of device property groups is at:


The suggested command returns me an armful of of None entries. This one works:

Just out of curiosity, what will this be used for? Will admit rarely do I see mixed systems. And usually if one has, one would start two versions with two saved files for both type of GPU’s to run … though that is annoying :slight_smile:

Still I’m only AMD now, but with RTX Optix support, that might change in the future, hence the query.

Yes, that appears to be the cleaner way of using the property group.
The path I suggested works as follows.

>>> bpy.context.preferences.addons['cycles'].preferences['devices'][0]['name']
'Intel Core i5-7300HQ CPU @ 2.50GHz'
>>> bpy.context.preferences.addons['cycles'].preferences['devices'][0]['id']

It’s just addressing the property group as a dictionary. I don’t think it’s functionally different, but perhaps less intuitive.

1 Like