Skip to content

Instantly share code, notes, and snippets.

@balbinus
Created August 9, 2017 22:53
Show Gist options
  • Save balbinus/8cafe43cd72ccec4d649fc1d7cf6387e to your computer and use it in GitHub Desktop.
Save balbinus/8cafe43cd72ccec4d649fc1d7cf6387e to your computer and use it in GitHub Desktop.
import bpy
bpy.context.user_preferences.system.compute_device_type = 'CUDA'
bpy.context.user_preferences.system.compute_device = 'CUDA_0'
bpy.context.scene.cycles.device = 'GPU'
print(bpy.context.scene.cycles.device)
#!/bin/bash
# it's super important to give the script AFTER the Blender file so that the scene can be set to GPU.
blender -noaudio --background file.blend \
--python gpurender.py \
--render-output /tmp/ --render-anim --frame-start 1 --frame-end 140 \
--engine CYCLES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment