Recent changes to Cycles device selection broke Auto Tile Size add-on #49959

Closed
opened 2016-11-07 19:28:36 +01:00 by Mikhail Rachinskiy · 17 comments

Blender Version
Broken: blender/blender@dd921238d9
Worked: before blender/blender@dd921238d9

Short description of error
This commit blender/blender@dd921238d9 breaks Auto Tile Size device detection code.

Exact steps for others to reproduce the error (UPDATED)

  • Switch to Cycles render
  • In Cycles add-on settings change Cumpute Device from None to CUDA
  • In render settings change Device from CPU to GPU Compute
  • Activate the Auto Tile Size add-on

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'

**Blender Version** Broken: blender/blender@dd921238d9 Worked: before blender/blender@dd921238d9 **Short description of error** This commit blender/blender@dd921238d9 breaks Auto Tile Size device detection code. **Exact steps for others to reproduce the error (UPDATED)** - Switch to Cycles render - In Cycles add-on settings change Cumpute Device from `None` to `CUDA` - In render settings change Device from `CPU` to `GPU Compute` - Activate the Auto Tile Size add-on # 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' ```
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @MikhailRachinskiy

Added subscriber: @MikhailRachinskiy

Added subscriber: @dfelinto

Added subscriber: @dfelinto

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?)

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?)

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Dalai Felinto self-assigned this 2016-11-07 19:57:14 +01:00
Author
Member

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

  • Switch to Cycles render
  • In Cycles settings change Cumpute Device from None to CUDA
  • In render settings change Device from CPU to GPU Compute
  • Activate the Auto Tile Size add-on

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 am so sorry about that, here is complete steps to reproduce the error: - Switch to Cycles render - In Cycles settings change Cumpute Device from `None` to `CUDA` - In render settings change Device from `CPU` to `GPU Compute` - Activate the Auto Tile Size add-on # 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.

Added subscriber: @VukGardasevic

Added subscriber: @VukGardasevic

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.

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.
Dalai Felinto removed their assignment 2016-11-07 20:51:10 +01:00
Lukas Stockner was assigned by Dalai Felinto 2016-11-07 20:51:10 +01:00
Author
Member

Changed status from 'Resolved' to: 'Open'

Changed status from 'Resolved' to: 'Open'
Author
Member

@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.

@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.

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.
Member

Added subscribers: @GregZaal, @LukasStockner, @JulianEisel

Added subscribers: @GregZaal, @LukasStockner, @JulianEisel
Lukas Stockner was unassigned by Julian Eisel 2016-11-09 04:40:50 +01:00
Greg Zaal was assigned by Julian Eisel 2016-11-09 04:40:50 +01:00
Member

Add-on errors should preferably be handled by authors, IIRC that was @GregZaal?

Add-on errors should preferably be handled by authors, IIRC that was @GregZaal?

Added subscriber: @RainerTrummer

Added subscriber: @RainerTrummer

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

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

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

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

  1. Changes on the cycles side:
    60409841a4b9

  2. Changes in the add-on:
    71daaea8cd

Please test the fix by downloading the latest build.

Should be resolved by the commits by Brecht from November 17th: 1) Changes on the cycles side: 60409841a4b9 2) Changes in the add-on: 71daaea8cd68 Please test the fix by downloading the latest build.
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#49959
No description provided.