The Right Way to do Blender Cloud Rendering using Amazon AWS’s GPU

I just found the better way to do GPU rendering using Amazon AWS EC2.

Previously I requested the AWS Team for the access of P instances in EC2 that have a powerful Tesla K80 GPU. After two days of the process (and communication), finally, I can use the lowest version P instance: p2.xlarge.

It has 4 vCPU and 1 GPU Tesla K80 Accelerator (12 GiB).

Firstly I tried to setup the cloud with this tutorial, but it is suck.

So I was looking for another tutorial and I got these straightforward steps that work very well for my instance—although the tutorial is tested for only G2 instances.

So this is the steps:

Machine Setup

  • Setup Linux 18.04 machine
  • Increase storage to 20GB (this is not mandatory) but I did this to prevent any memory error in the future

Installing NVIDIA Drivers

sudo dpkg -i nvidia-driver-local-repo-ubuntu1804-418.87.01_1.0-1_amd64.deb
# Should say key needs to be installed
sudo apt-key add /var/nvidia-driver-local-repo-418.87.01/
sudo dpkg -i nvidia-driver-local-repo-ubuntu1804-418.87.01_1.0-1_amd64.deb

sudo apt update
sudo apt install cuda-drivers

Reboot the instance and then test with nvidia-smi command to check whether the installation is success or not.

Installing Blender

sudo snap install blender --classic
sudo apt install libgl1-mesa-glx libxi6 libxrender1

Script to Enable GPU

import bpy

prop = bpy.context.preferences.addons['cycles'].preferences
prop.compute_device_type = 'CUDA'

for device in prop.devices:
    if device.type == 'CUDA':
        device.use = True
bpy.context.scene.cycles.device = 'GPU'

for scene in
    scene.cycles.device = 'GPU'


blender -b template.blend -P -a

How fast is the AWS GPU rendering?

Extremely fast!

The rendering process that takes about 10 minutes per frame in Google Colab can be finished in only 40 seconds in AWS P instance!

What on earth, it can save 93% of rendering time!

The Blender file that take 2 days rendering in Google Colab (or 13 hours if I’m using 3 accounts) can be finished in only 2 hours.

It really saves my age.

This is the rendering result:

Some notes:

I use FFmpeg to convert video file become good quality GIF. Here’s the command:

ffmpeg -i render.mkv -vf "fps=10,scale=720:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 render.gif

By Fajrul

Amateur physicist and science writer

Leave a comment

Your email address will not be published. Required fields are marked *