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 blender.com
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.
Go to CLIENT-> Instances and wait for the system to finish loading.
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 https://ftp.nluug.nl/pub/graphics/blender/release/Blender2.82/blender-2.82a-linux64.tar.xz; 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.
#nano activate_gpu.py import re import bpy import time scene = bpy.context.scene scene.cycles.device = 'GPU' prefs = bpy.context.preferences prefs.addons['cycles'].preferences.get_devices() cprefs = prefs.addons['cycles'].preferences print(cprefs) for compute_device_type in ('CUDA', 'OPENCL', 'NONE'): try: cprefs.compute_device_type = compute_device_type print('Device found',compute_device_type) break except TypeError: pass for device in cprefs.devices: print('Activating',device) device.use = True device.use = (device.type != 'CPU')
We will be using the bmw27_gpu.blend car demo that you can find https://www.blender.org/download/demo-files/
To run the blender file
$./blender -b media/bmw27_gpu.blend -E CYCLES -P activate_gpu.py -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