A1: High Throughput Ray-Tracing with Condor
A ray-tracing tool creates very precise computer images from a detailed
geometric specification. Unlike other forms of computer graphics, ray-tracing
is very slow, because it computes exactly how a single beam of light propagates
through a scene to arrive at each pixel on the screen. Ray-tracing is too
slow to be used in real-time for, say, a computer game. Instead, it is used
when quality is more important than speed, such as when rendering a high
Rending a single frame of a Hollywood-quality movie may take
minutes to hours even on a very fast computer. Rendering a movie measured
in hours would take decades on a single computer. Fortunately, this is a
perfect application of high-throughput computing. Each frame of a movie
can be rendered on a different computer simultaneously, and then assembled
at the end to produce a complete movie.
In this assignment, you will learn the basics of POVRay, an open source
ray-tracing tool, and then use Condor to perform high-throughput generation
of simple movies.
At the conclusion of this assignment, students will be able to:
Operate an open-source ray-tracer at a basic level.
Divide a computational workload into pieces appropriate for high-throughput computing.
Construct, submit, and manage large numbers of batch jobs.
Analyze and explain the vital statistics of a high-throughput workload.
Quick Introduction to POVRay
POVRay is a widely-used open source ray-tracer that can be run in batch mode on the command line or with a graphical display. You will also need ffmpeg, a video processing tool. Both are already installed in AFS, so just set your PATH like this:
setenv PATH /afs/nd.edu/user37/ccl/software/external/povray/bin:$PATH
setenv PATH /afs/nd.edu/user37/ccl/software/external/ffmpeg/bin:$PATH
Then, download the example files rubiks.pov and WRC_RubiksCube.inc. (You can try out other examples from the POVRay collections site). To render a single image of a Rubik's cube:
povray +Irubiks.pov +Orubiks.png
And then display the output file:
Now, open up rubiks.pov in a text editor. The POVRay language describes exactly how to render the image, and the elements are fairly self explanatory. Scroll to the bottom, and look for the invocation of the cube:
WRC_RubiksRevenge("F'f' Rrd2R'r' U'u'Rr d2 U ld'l' U' ldl' R'r'Uu Ff")
translate < -6.6/2, 0, -6.6/2 >
WRC_RubiksRevenge is just a function defined in WRC_RubiksCube.inc, and the funny string following it simply defines how to set up the cubes and the colors. translate just moves the cube in the x, y, and z, directions, and rotate spins it around the Y axis by 45 degrees. (The cube is 6.5 centimeters on each edge, so the translate is just moving the rotation axis to the middle of the cube.)
Add a few more cubes to the scene by copying the object clause three or four times. For each one, tweak the rotation and add a second translate after the rotate to move the new cubes around the scene. Adjust the settings
until you have a couple of cubes in the view.
Now, how do we make a movie? POVRay uses the built-in clock variable to represent the passage of time. clock is a floating point that varies only from zero to one through the course of an animation. You can set the clock value to, say, 0.5 by using the option +K.5.
For example, change one of the rotation statements to:
Render three slightly different frames like this:
povray +Irubiks.pov +Oframe000.png +K.0
povray +Irubiks.pov +Oframe001.png +K.1
povray +Irubiks.pov +Oframe002.png +K.2
And then join them into a movie like this:
ffmpeg -r 10 -i frame%03d.png -r ntsc movie.mpg
You can play the (very short) movie like this:
Create a tool called condor_povray that renders a long
movie quickly by submitting each frame to be rendered as a separate
Condor job. You may use any language that you are comfortable with,
but I would recommend either Perl or Python.
condor_povray should generate an appropriate condor submit file
for each job and call condor_submit as needed.
(Make sure to have each job specify the same user log file with
log = something.log.) Then, use condor_wait to wait for all to finish and join them together with ffmpeg into a single
finished .mpg movie that runs at 10 frames per second.
The tool should be invoked like this:
condor_povray input.pov output.mpg nframes
where the first argument is the input file to POVRay, the second argument
is the output movie, and the third is the number of frames to be created.
The user of condor_povray should not have to know anything about
Condor; it should just work.
- Using POVray directly, time how long it takes to render a single video frame in the following resolutions: 320x400, 640x480, 1280x720, and 1920x1080. From that measurement, figure out how long it would take to render one minute of video at 10 frames per second on a single machine.
- Using condor_povray, render a one minute video at each of the resolutions above. Keep both the output movie and the log file for each run. Submit each log file to the Condor Log Analyzer. Study the analysis critically, and describe what happened during the run. How many jobs ran at once? Did the work proceed smoothly? Did anything unusual happen?
What to Turn In
Your dropbox directory is:
Into that directory, submit:
Source code to condor_povray.
Your modified rubiks.pov.
For each resolution, a movie file and a condor log file named e.g. rubik320.mpg and rubik320.log
A lab report titled answers.html containing answers to the questions above, along with links to the corresponding files and Condor Log Analyzer pages.
This assignment is due at the beginning of class on Tuesday, February 2.
Use your creativity to make the movie more exciting.
Do this after completing the assignment,
so that you can use condor_povray to render movies quickly.
I'll show the best examples in class.