How to render blender with Vast.AI

This guide goes through the steps needed to using Vast.AI to render a blender sequence.

We will be using the demo file provided by

It assumes you have the following knowledge.

  • You have set up a Vast account that is funded.
  • Knows how to SSH to an instance.
  • You have some experience with Ubuntu. How to use wget or rclone to get the files in and out of the instance.
  • The blender file will be using CYCLES rendering, not EEVEE as you don’t have a display and EEVEE needs a display.
  • You can use Tmux commands

Select an OS Image. I used nvidia/cuda:10.0-base-ubuntu 16.04.

All host run 16.04 so it makes sense to use the same. You can run newer but your on your own if you run into trouble.

Use the filters to find the system you want to use. Preferably one with a couple of GTX 1080TI’s or better. Rent it as on-demand. Interruptible can result in you losing access to the instance at any moment. Make sure you select host with hight reliability(+97%) and with enough PCI-E lines. x8 is a minimum.

Make sure you select enough free space. Do not be excessive as you also pay for space as well.

Go to CLIENT-> Instances and wait for the system to finish loading.

Once the connect button is blue hit it
If you use Ubuntu you can use the above command to ssh into the instance. You should have set up your certificates.

If connected you should see a thermal

Use this bash script to install what is needed.

$bash -c 'apt -y update; apt -y upgrade apt install -y libglu1-mesa-dev ;apt-get install -y libxi6 libgconf-2-4; apt-get install  -y  libfontconfig1 libxrender1; apt-get install  -y libxxf86vm-dev; apt-get install -y libxfixes-dev;  apt install -y libgl1-mesa-glx; apt-get install -y curl; apt-get install -y wget; apt-get install -y p7zip-full; apt-get install xz-utils; apt-get install nano; wget; xz -d blender-2.82a-linux64.tar.xz; tar -xvf blender-2.82a-linux64.tar; apt -y upgrade'

$cd blender-2.82a-linux64
$mkdir output
$mkdir media

The media folder is where you would download your belender file and any other media needed. The output folder is where you will send the rendered images.

It is a good idea to set up a background task to upload the images as they are created to a cloud storage. This is beyond this guide but you can use rclone copyto with google drive. The mount function is not possible in a docker. J

WARNING: The host of the Vastai system has access to all your files. If you do use cloud storage like google drive do not use your private account as the token stored will allow them full access to all your google drive documents.

To use the GPU’s we will need to create python script.


import re
import bpy
import time
scene = bpy.context.scene
scene.cycles.device = 'GPU'
prefs = bpy.context.preferences
cprefs = prefs.addons['cycles'].preferences
for compute_device_type in ('CUDA', 'OPENCL', 'NONE'):
    cprefs.compute_device_type = compute_device_type
    print('Device found',compute_device_type)
  except TypeError:
for device in cprefs.devices:
    device.use = True
    device.use = (device.type != 'CPU')

We will be using the bmw27_gpu.blend car demo that you can find

To run the blender file

$./blender -b media/bmw27_gpu.blend -E CYCLES -P -o output/output -a

The screen should look some thing like this

To see if it is running hit crt +b c to create a new tmux window.

Browse to the output folder to check the files being created or use nvidia-smi to watch power usage

A shout out to Rick The Dick for the help in getting this to work