Blender and GNU Parallel

As an alternative to using render farm management software, there is a quick and easy way to perform distributed renders from the command line.

GNU Parallel [1] is a general purpose utility for running jobs in parallel on one or more computers. It runs on most unix-like operating systems including macOS and Linux, but it should be possible to use it on Windows via a Linux Virtual Machine [2]. We can use GNU Parallel to distribute rendering workload – either animations or single frames – over multiple computers with just a couple of lines of code.

For example, assuming a .blend file with all resources packed and set to 2000 samples: the first line would distribute a single frame render across 2 computers as 20 chunks of 100 samples, transferring files as required (no need for a shared filesystem), and will tidy up after itself as it goes. The second line uses ImageMagick [3] to combine the chunks to form the final 2000 sample image:

seq 1 20 | parallel -S1/[email protected],1/[email protected] –progress –plus –basefile render.blend –return 1_{#}.exr –cleanup blender -b render.blend -o \”#\”_{#} -F EXR -f 1 — –cycles-resumable-num-chunks {##} –cycles-resumable-current-chunk {#} > /dev/null

convert 1_*.exr -evaluate-sequence mean final.exr

Some basic SSH configuration may be required, and this is covered in the documentation given here [4].

[1] https://www.gnu.org/software/parallel/
[2] https://www.virtualbox.org
[3] https://imagemagick.org/script/convert.php
[4] https://gitlab.com/skororu/scripts

Advertisement