This is a easy workaround to enable Blender rendering on a super-computing cluster. The samples shown here are based on the Euler cluster of ETH Zürich (IBM LSF batch system).
Normally for scientific super-computing clusters, the end-user does not have privilege to install packages using the package manager. Hopefully, the Blender foundation provides an easy-to-start installation on (almost-any) Linux distributions. The package is provided like https://www.blender.org/download/Blender2.80/blender-2.80-linux-glibc217-x86_64.tar.bz2/ (Blender 2.80, 64 Bit):
Untar the tarball and use symlink to the binary like:
# Symlink the blender binary under your system PATH
ln -s /path/to/blender/bin/binder ~/bin/blender
# Uncomment the following line if ~/bin is not within the PATH
# export PATH=~/bin:$PATH
Now to test the blender binary:
$ blender -b -noaudio
Blender 2.80 (sub 75) (hash f6cb5f54494e built 2019-07-29 17:17:04)
/run/user/161240/gvfs/ non-existent directory
found bundled python: /cluster/home/ttian/bin/blender-2.80-linux-glibc217-x86_64/2.80/python
Blender quit
The idea of this part is to replace normal Blender rendering process using batch job system on a cluster. The basic workflow can be:
scp
.blend file to remote- Submit batch job using
ssh
command - Once the job is done, fetch the output rendering result from cluster.
# Transfer file onto remote, files name are just indicative
rsync local_file.blend username@cluster:/remote_file.blend
echo "File transfer finished"
# ssh render on remote
render_string="blender -b -noaudio ~/tmp/test.blend -f 0 -o ~/tmp/output####.png -t 24"
ssh username@cluster "bsub -n 24 \"$render_string\""
echo "job submitted"
After the job is finished, fetch the output from the cluster using:
rsync -a username@cluster:/output/output.png local_path
In the last part of step 2, it is usually not very convenient to frequently check if the rendered file exists and fetch from remote. There could be 2 possible ways of work-around:
- The cluster allows in- and out-going external network traffic:
Upload the output file to an online server, such as using WebDav:
ssh username@host "curl -T webdav_username:webdav_password /path/to/remote/output.png \"htts://webdav/link/output.png\""
**Note**: you have to specify both the source and target filenames for webdav to understand. The
webdav_username
is username on the webdav server, not the cluster username! - Use
sshfs
to mount the remote sourcesE.g. on macOS, use
sshfs
to mount the resources like:sshfs user@host:/path/to/output/ /local/mount/point -o volname="Cluster Output"
Note the
/local/mount/point
should be created first.