Page MenuHome

Recent changes to Cycles device selection broke Auto Tile Size add-on
Closed, ResolvedPublic

Description

Blender Version
Broken: rBdd921238d922
Worked: before rBdd921238d922

Short description of error
This commit rBdd921238d922 breaks Auto Tile Size device detection code.

Exact steps for others to reproduce the error (UPDATED)

  1. Switch to Cycles render
  2. In Cycles add-on settings change Cumpute Device from None to CUDA
  3. In render settings change Device from CPU to GPU Compute
  4. Activate the Auto Tile Size add-on
  5. Look into console

Where you'll see this error:

File "C:\Users\Mikhail\Downloads\b\2.78\scripts\addons\render_auto_tile_size.py", line 149, in engine_is_gpu
    return engine == 'CYCLES' and device == 'GPU' and userpref.system.compute_device_type != 'NONE'
AttributeError: 'UserPreferencesSystem' object has no attribute 'compute_device_type'

Details

Type
Bug

Event Timeline

I don't see any error here. Please write down the error you get on the console. Also what is your OS, and if any extra step is required to reproduce the error (e.g., open the Performance panel? click settings?)

Dalai Felinto (dfelinto) closed this task as Resolved.Nov 7 2016, 7:57 PM
Dalai Felinto (dfelinto) triaged this task as Needs Information from User priority.
Dalai Felinto (dfelinto) claimed this task.

I am so sorry about that, here is complete steps to reproduce the error:

  1. Switch to Cycles render
  2. In Cycles settings change Cumpute Device from None to CUDA
  3. In render settings change Device from CPU to GPU Compute
  4. Activate the Auto Tile Size add-on
  5. Look into console

I guess if you'll use OpenCL instead of CUDA it would result in the same error, but I cannot check this.

I can confirm the issue with dd92123 on win 7

line 149, in engine_is_gpu
    return engine == 'CYCLES' and device == 'GPU' and userpref.system.compute_device_type != 'NONE'
AttributeError: 'UserPreferencesSystem' object has no attribute 'compute_device_type'

The same problem was reported on https://developer.blender.org/D2338#54191

The userpref.system.compute_device_type check needs to be changed.

Mikhail Rachinskiy (alm) raised the priority of this task from Needs Information from User to Confirmed, Medium.
Mikhail Rachinskiy (alm) updated the task description. (Show Details)

@Dalai Felinto (dfelinto) I hope you don't mind that I reopened and updated the task?
Also I can take the assignment if you guys have your hands full.

I have some code that solves the current bug, however the function get_threads will fail too

gpu_device_str = userpref.system.compute_device
if 'MULTI' in gpu_device_str:
    threads = int(gpu_device_str.split('_')[-1])
else:
    threads = 1

The number of threads is calculated by splitting the string from the end.
I'm not sure where to look in this case, so any pointers are welcomed.

would propose the following fixes:

method engine_is_gpu in line 149:

def engine_is_gpu(engine, device, userpref):
	if hasattr(userpref.system, 'compute_device_type'):
		_devType = userpref.system.compute_device_type
	else:
		_devType = userpref.addons.get('cycles').preferences.compute_device_type
	return engine == 'CYCLES' and device == 'GPU' and  _devType != 'NONE'

method get_threads in line 206:

def get_threads(context, device):
	render = context.scene.render
	engine = render.engine
	userpref = context.user_preferences

	if engine_is_gpu(engine, device, userpref):
		if hasattr(userpref.system, 'compute_device_type'):
			gpu_device_str = userpref.system.compute_device
			if 'MULTI' in gpu_device_str:
				threads = int(gpu_device_str.split('_')[-1])
			else:
				threads = 1
		else:
			threads = len([x for x in userpref.addons.get('cycles').preferences.devices if x.use])
	else:
		threads = render.threads

	return threads

However, only tested on a multi-CUDA-GPU rig, don't have OpenCL devices at hand here

Should be resolved by the commits by Brecht from November 17th:

  1. Changes on the cycles side:

60409841a4b9

  1. Changes in the add-on:

71daaea8cd68

Please test the fix by downloading the latest build.