|
![](/i/fill.gif) |
Note: All the computers must have a common file system (that is, they all
see the same directory where you are starting the rendering) and you should
be able to rsh to all of them without password prompting. These usually
occur only in local networks (so this script cannot be used, at least not
unmodified, to distribute the rendering over the world).
Put the names of the machines in the HOSTS variable at the beginning and
the correct number of them in the HOSTSCNT (I know that it may be possible
to automatically count the number of words in HOSTS but I was lazy and didn't
search for info about how to do it).
#!/bin/zsh
POVEXEC=$HOME/povray/xmegapov
ROWSPERHOST=17
HOSTSCNT=3
HOSTS=(machine1 machine2 machine3)
### If this is a child process
if [ "$1" = "__SubProc__" ]
then
echo "### Subprocess at `uname -n` starting rendering. (`uptime | sed
's/^.*average: //'`)"
PART=$2
FILE=$3
WIDTH=$4
HEIGHT=$5
shift 5
let STARTROW=PART*ROWSPERHOST
while [ $STARTROW -le $HEIGHT ]
do
let ENDROW=STARTROW+ROWSPERHOST-1
echo `uname -n` rendering lines $STARTROW to $ENDROW
$POVEXEC -i $FILE $* -w$WIDTH -h$HEIGHT +sr$STARTROW +er$ENDROW -d -p -v +ft -o
ImagePart`printf "%05i" $STARTROW` >&/dev/null
let STARTROW+=ROWSPERHOST*HOSTSCNT
done
echo "### `uname -n` done."
exit
fi
### Else this is the main process
if [ "$3" = "" ]
then
echo "Usage: $0 <pov-file> <width> <height> [<additional pov options>]"
exit
fi
PART=0
for HOST in $HOSTS
do
rsh $HOST "cd `pwd`; $0 __SubProc__ $PART $*" &
PART=$[PART+1]
done
wait
echo "Joining image parts..."
if [ `echo $1 | grep -c '\.pov$'` = 1 ]
then
IMAGE=`echo $1 | sed 's/\.pov$/.tga/'`
else
IMAGE="$1".tga
fi
mv ImagePart00000.tga $IMAGE
for FILE in ImagePart?????.tga
do
tail +19c $FILE >> $IMAGE
done
rm ImagePart?????.tga
echo "Done."
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |