Blenderfarm

To launch blender renderer in CLI on compute nodes, login to one of the Zeus’s headnodes, change to your working folder and load blender modulefile

module load blender/2.71

Then you can submit rendering job to the slurm queue using e.g. the following slurm script (say, save as blender.slurm)

#!/bin/bash 
# This is HPC job submission script (submit job to the queue as:
#
# "sbatch blender.slurm"
#
# in the same folder there must be blend file be present and script "render.sh"
# if you need to adjust rendering parameters -- edit render.sh 
#

#SBATCH --time=12:00:00 
#SBATCH --nodes=10
#SBATCH --partition=all
#SBATCH --ntasks-per-node=1 
#SBATCH --cpus-per-task=8
#SBATCH --job-name="BLENDER"

blendfile="bmw27_cpu.blend"

#frames to render
start_frame=1
frames_total=100

cd $SLURM_SUBMIT_DIR
srun ./render.sh $start_frame $frames_total ${blendfile}

# the output is created in your ~/public_html/

In the same folder where you will submit this script, blender file *.blend must be present as well as 2nd script: render.sh, its content below:

#!/bin/bash

# THIS SCRIPT LAUNCH blender RENDERER ON A SLURM node NODE. 
# IT REQUIRES 3 PARAMETERS:

# 1) STARTFRAME
# 2) total Nr of FRAMES to RENDER
# 3) blend file name to render
#
# E.G. "./render.sh 10 100 ./myfile.blend" will render frames from 10 to 110



# THIS SCRIPT CAN BE SUBMITTED TO THE QUEUE AS (e.g. to render frames 1 to 100 on 10 nodes)

# nohup srun -N10 --cpus-per-node=8 -t 24:00:00 -p all ./render.sh 1 100 myfile.blend &





module load blender/2.71
############################### USER EDIT ################################################################
#

# image format
#--render-format <format> -- Set the render format, Valid options are
# TGA IRIS JPEG MOVIE IRIZ RAWTGA AVIRAW AVIJPEG PNG BMP FRAMESERVER
 
format="PNG"
############################ DO NOT CHANGE BELOW (unless you know what's you're doing) ###################



startframe=$1
totalframes=$2
filename=$3

IFS='.' read -a array <<< "$filename"

# get rid of maya file extension
let lastelement=${#array[@]}-1
unset array[$lastelement]
name=$(IFS=. ; echo "${array[*]}")

output_dir=~/public_html/$filename/output/

#

mkdir -p $output_dir
chmod -R 755 ~/public_html
mkdir -p $output_dir/thumbs
chmod 777 $output_dir/thumbs

NNODES=${SLURM_NNODES}

let FPN=$totalframes/$NNODES
let rem=$totalframes%$NNODES

if [ $rem -gt 0 ]
 then
 let FPN=$FPN+1
fi

echo "Launching Node $SLURM_NODEID"

let START=$((${SLURM_NODEID} * $FPN + $startframe))
let END=$START+$FPN-1

if [ $END -gt $totalframes ]
 then
 END=$totalframes
fi

EXE="blender"

# messing with Web-PHP, output only first node will execute

if [ ${SLURM_NODEID} -eq 0 ]
then
 rm -f output.log
 rm -f $output_dir/*.*
 rm -f $output_dir/thumbs/*.*

cp /share/apps/blender/slides/ $output_dir/

echo "<?php" > $output_dir/index.php
 echo "\$total_frames=$totalframes;" >> $output_dir/index.php
 echo "\$name=$name;" >> $output_dir/index.php 
 echo "\$ext=\"${format}\";" >> $output_dir/index.php 
 echo "\$numnodes=${SLURM_NNODES};" >> $output_dir/index.php 
 echo "\$jobid=${SLURM_JOBID};" >> $output_dir/index.php 
 echo "?>" >> $output_dir/index.php
 echo "" >> $output_dir/index.php
 cat /share/apps/blender/misc/index.php >> $output_dir/index.php

fi

CMD="$EXE -b $filename -F $format -s $START -e $END -o $output_dir -a -noaudio"
echo $CMD > Node_$SLURM_NODEID.log

# launch renderer

$CMD

The output images will be created in your home in ~/public_html folder, one can view it in web browser at

http://zeus.coventry.ac.uk/~yourusername/

 

css.php