Skip to content

Instantly share code, notes, and snippets.

@charly-vega
Last active May 10, 2020 22:45
Show Gist options
  • Save charly-vega/8ac2617275755191501bae700c1180bf to your computer and use it in GitHub Desktop.
Save charly-vega/8ac2617275755191501bae700c1180bf to your computer and use it in GitHub Desktop.

Instance type

g4dn.xlarge

AMI ID

ami-078a7f1dda72c0775

force_gpy.py

import bpy

preferences = bpy.context.preferences
cycles_preferences = preferences.addons['cycles'].preferences
cuda_devices, opencl_devices = cycles_preferences.get_devices()

cycles_preferences.compute_device_type = "CUDA"

for device in cuda_devices:
    print(f'Activating {device.name}')
    device.use = True

Docker command

nvidia-docker run -ti -v $PWD:/media nytimes/blender:2.80-gpu-ubuntu18.04

Render

blender -b blendfile.blend -o //render_ -P force_gpu.py -f 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment