Frequently Asked Questions

Blender rendering jobs
Last Updated 6 months ago

Using our HPC to render Blender images and animations is pretty easy!
Blender has a command line interface that we will use, the full up-to-date documentation is located at:
https://docs.blender.org/manual/en/latest/render/workflows/command_line.html

First, load Blender via the modules command:

$ module load Blender
Running on compute nodes
The easiest way to run a render is to transfer your .blend file to you home folder and use srun:

$ srun -N1 blender -b .blend  -o //_###.png -a
This command will ask for one node on the compute partition and will run blender on your .blend file. The output images will be stored in the same folder with the names you define in the -o option. The -a argument tells Blender that you want to render the whole animation, if you want to render specific frames, use the -f option. Keep in mind that the -a and -f options have to be the last options. A comma separated list of frames can also be used (no spaces) or you can define a range of frames using the '..' seperator between the first and last frames (inclusive). Also make sure to replace .blend with the name of your .blend render file, and with the name you want for the rendered output frames.


Running on gpu nodes
We also have a partition where nodes have a lot of GPU power, which can be beneficial for rendering. First, we need to load the CUDA module:

$ module load CUDA

Next, in order to run Blender jobs on our GPUs, copy and save the following in a file in the same folder with your .blend file:

import bpy
bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type= 'CUDA'
bpy.context.user_preferences.addons['cycles'].preferences.devices[0].use = True
bpy.context.scene.cycles.device = 'GPU'
bpy.ops.render.render(write_still=True)
Save it as cuda.py
This script tells blender to use out NVIDIA Tesla M60 GPUs running CUDA. It is necessary since you probably prepared your render files on your local machine with different hardware.

Run Blender, the command is similar to the one we used before:

$ srun -N1 -pgpu blender -b .blend  -o //_###.png -P cuda.py -a

If you want to split the rendering to multiple nodes, the best way is to define sets of frames using the -f option and run multiple jobs. In that case, you can write a Slurm batch script and run the jobs with sbatch in the background.

A simple Slurm batch script that loads all the modules and renders frames 1 to 10 on the GPU nodes is here:

#!/bin/bash -l
#SBATCH --partition=gpu
#SBATCH --nodes=1

module load Blender
module load CUDA

srun blender -b .blend -o //_###.png -P cuda.py -f 1..10
Again, replace and with the correct names, save the script in the same directory as your .blend and cuda.py files as blender.slurm and run it with:

$ sbatch blender.slurm

More info here:
https://support.arctur.si/scp/faq.php?id=8

Please Wait!

Please wait... it will take a second!