Created
March 4, 2024 20:41
-
-
Save Ahanio/ebe4ad7eb0fb15bd70d25f7492e31af9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
bpy.data.scenes[0].render.engine = "CYCLES" | |
# Set the device_type | |
bpy.context.preferences.addons[ | |
"cycles" | |
].preferences.compute_device_type = "CUDA" # or "OPENCL" | |
# Set the device and feature set | |
bpy.context.scene.cycles.device = "GPU" | |
# get_devices() to let Blender detects GPU device | |
bpy.context.preferences.addons["cycles"].preferences.get_devices() | |
print(bpy.context.preferences.addons["cycles"].preferences.compute_device_type) | |
for scene in bpy.data.scenes: | |
scene.cycles.device = 'GPU' | |
for d in bpy.context.preferences.addons["cycles"].preferences.devices: | |
d["use"] = 1 # Using all devices, include GPU and CPU | |
print(d["name"], d["use"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment