Wednesday, 10 February 2010

X-Grid and Blender part 2

So, after looking at the said articles I found that they are actually slightly out of date (2004!) and OS X 10.5 no longer supports the GUI for submitting jobs in that particular way. And plus, to my dismay, I cannot find it to download ANYWHERE! I tried many many things alas and I've ended up spending about 3 days slowly getting there, and I have got somewhere. I think I'll go through all the troubleshooting I went through, so I can say what I have and have not tried.

So to start with I had my xgrid all setup (previous post), running xgrid admin from my machine. For a test setup I thought I'd try and just get one machine to render an animation, and then get two and so on. So I started with my machine (although I should have started with a third machine). So I made a blender file "box.blend" and tried some command line rendering. Finally I got this command to render the animation:

/Applications/Blender/ -b /Volumes/Shared/xgridprojects/in/box.blend -a

note: I saved it on a network share on the xserve mounted in /Volumes/Shared so that other machines in the future could access this file.

note 2: this is case sensitive so watch out for Blender or blender in the applications folder. I think I renamed it 'Blender' and it prefers to be 'blender' (this held me up for 15 mins!)

the -b renders in the background (put before the file) and the -a renders the animation you have setup in the blend file (default to /tmp/). The /tmp/ directory turned out maybe to be the best directory to render to as blender, when run by this xgrid user (no-one) can't seem to write to any other folders.

The -a attribute renders as many frames as are in the animation. At first this seemed the best but when using with xgrid, the alternative option is -f [frame number] which renders a specific frame. Also, -a can be used with -s [start frame] and -e [end frame] but I think these need to be plaeed carefully either before or after the '-a' attribute.

So, now I knew the commands which xgrid needed to send to each machine I could begin. A big 'downer' was the fact I didn't have the GUI in the tutorial so it was command line stuff. The first thing was to know how to send a job:

xgrid -job submit [-gid grid-identifier] [-si stdin] [-in indir]
           [-dids jobid [, jobid]*] [-email email-address]
           [-art art-path -artid art-identifier] [-artequal art-value]
           [-artmin art-value] [-artmax art-value] cmd [arg1 [...]]


xgrid -job submit -gid /Applications/Blender/ -b /Volumes/Shared/xgridprojects/in/box.blend -a

I think this might have worked, but I saw that actually you can have input directories and output directories! So this is where the network mount might have come in:

xgrid -job submit -gid -in /Volumes/Shared/xgridprojects/in/ -out /Volumes/Shared/xgridprojects/out/ /Applications/Blender/ -b box.blend -a

notice how I didn't have to specify where my box.blend file was, as it automatically looked in the "in" folder. Now this folder was mounted on the computer I was rendering on through xgrid, but I now think that xgrid manages these files all by itself, so I don't think that it has to be mounted (I shall try tomorrow). I think the main point is that it is on the machine which submitted the job!

Now that this worked I tried it on two machines! Alas, it only used one machine to render the entire animation! This was because I didn't specify the variable or 'range' (which was in the tutorial) which changes. The only solution I found was to specify lots of jobs, each rendering a specific part of the animaton. Luckily I found an application for submitting 'Batch' jobs  which is called 'GridStuffer'. You can give it a text file with the cmd for the specific jobs, a different line for each job you want, and it will send it to the xgrid as lots of different jobs. Not only that but if a job fails, it'll keep sending it until it is complete (fully optional though).

So with this handy tool I made a text file like this:

/Applications/Blender/ -b /Volumes/Shared/xgridprojects/in/box.blend -f 1
/Applications/Blender/ -b /Volumes/Shared/xgridprojects/in/box.blend -f 2
/Applications/Blender/ -b /Volumes/Shared/xgridprojects/in/box.blend -f 3
/Applications/Blender/ -b /Volumes/Shared/xgridprojects/in/box.blend -f 4

and it will send them all to the xgrid under different jobs, and keep sending them until they are done. That way the xgrid application will send each job to a different machine and utilise all the processers it needs, YAY!

I think you don't even need the blend file on the server, I think it sends it from that machine (but this theory needs testing). I think what you do need is the blender application on each machine although I seem to remember it saying you didn't!! But anyway, not the hardest thing to do.

One of the main stumbling points at the moment is trying to get all the rendered files from all of the machines '/tmp/' folders. A script could be written and sent out over ARD, but I would prefer it if I could get xgrid to move them, or blender to save to a networked space, which would mean mounting on each machine before jobs are sent out. Preferably all the machines would automount a volume on bootup which could be useful for a lot of other things. Apparenly this might be done by NFS shares but needs looking into.

Well, till another day. Hope this helps sometime again and it wasn't all in vain.

No comments:

Post a Comment