bpy.context.scene.render.engine = 'CYCLES' bpy.context.scene.cycles.device = 'GPU' bpy.context.user_preferences.addons["cycles"].preferences.compute_device_type = 'CUDA'

bpy.context.scene.render.engine = 'CYCLES' bpy.context.scene.cycles.device = 'GPU' bpy.context.user_preferences.addons["cycles"].preferences.compute_device_type = 'CUDA'