Skip to content

Instantly share code, notes, and snippets.

@Mikulas
Last active January 18, 2020 01:52
Show Gist options
  • Save Mikulas/2c9acb5f7bd716dff6cedfecf6592a60 to your computer and use it in GitHub Desktop.
Save Mikulas/2c9acb5f7bd716dff6cedfecf6592a60 to your computer and use it in GitHub Desktop.
import bpy
# https://blender.stackexchange.com/questions/5281/blender-sets-compute-device-cuda-but-doesnt-use-it-for-actual-render-on-ec2
bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
bpy.context.user_preferences.addons['cycles'].preferences.devices[0].use = True
bpy.context.scene.cycles.device = 'GPU'
bpy.data.scenes["Scene"].render.filepath = "/tmp/output.png"
bpy.ops.render.render(write_still=True)
BLEND="/tmp/foo.blend"
/home/ec2-user/blender --background "$BLEND" \
--use-extension 1 \
-noaudio -nojoystick \
-E CYCLES -t 0 \
-P "config.py"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment