I'm trying to launch a script in Blender that creates a trajectory for the camera, and renders several images of an object (in sequence).
I tried to enable GPU rendering thinking it would be a lot faster, but I noticed that:
- If i use GPU rendering on my laptop (Intel core i7-7700 HQ and Nvidia Geforce GTX 1050), it is about 4/5 times slower than CPU rendering.
- If i enable GPU rendering on google Colab Pro (with a Tesla T4 GPU), the rendering is still slower than my CPU.
I use the following script to render with the GPU:
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 d in bpy.context.preferences.addons["cycles"].preferences.devices:
d["use"] = 1 # Using all devices, include GPU and CPU
print(d["name"], d["use"])
Does anybody have any clue about the problem?