Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuziyi616 committed Dec 16, 2022
1 parent 56815b9 commit a852a4b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions kubric/renderer/blender.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,14 @@ def use_gpu(self, value: bool):
self.blender_scene.cycles.device = "GPU" if value else "CPU"
if value:
# call get_devices() to let Blender detect GPU devices
bpy.context.preferences.addons["cycles"].preferences.get_devices()
devices_used = [d.name for d in bpy.context.preferences.addons["cycles"].preferences.devices
if d.use]
logger.info("Using the following GPU Device(s): %s", devices_used)

preferences = bpy.context.preferences
cycles_preferences = preferences.addons['cycles'].preferences
cuda_devices, opencl_devices = cycles_preferences.get_devices()
cycles_preferences.compute_device_type = "CUDA"

for device in cuda_devices:
logger.info("Activating: %s", device.name)
device.use = True

def set_exr_output_path(self, path_prefix: Optional[PathLike]):
"""Set the target path prefix for EXR output.
Expand Down

0 comments on commit a852a4b

Please sign in to comment.