MPI POV-Ray

The image above was generated with POV-Ray 3.6.1. The standard cactus scene comes included with the samples, and I shamelessly ripped it off and added the Arizona State University High Performance Computing Initiative initials to it.

Back in 2004, I patched POV-Ray 3.6.1 to do some basic parallel rendering with MPI. Since Ray Tracing is an embarrasingly parallel problem, hacking up POV-Ray was pretty easy. My version isn't as nice as the PVM or original MPI version (but it is newer, last time I checked), and it works (kind of). The code is actually pretty stupid, If anybody wants to get the patch and try it (it only works for Unix/Linux), you can find it here: MPI-povray.patch. See below for information on how my MPI-POV-Ray patch works.

How this MPI-POV-Ray works: This is a short patch, only about 150 or 200 lines of real code. It does a static decomposition (meaning each slave calculates which part it will render. The only way you can change this is by increasing or decreasing the number of slaves). The slaves trace each line, then send the results back to the master for rendering to the screen. I could do many optimizations, but I only wanted to get it working. I have only tried this patch on one scene, and I haven't benchmarked it. Consider yourself warned.

Important Note: You must use 2 or more processes when running this MPI version. The master doesn't do any tracing. The master only displays pixels to the screen once the slaves have rendered them.

Known Bugs:
1. If the number of processors doesn't divide up evenly into the number of columns, the last processor in the row will not render that last few pixels on the line. This is because I didn't add a check to see if a processor was the last in the row. Thus, the math is a little bit off for the last few columns of the image.
2. Outputting the rendered image to a file also does not work (at least with PNG files). The PNG files don't work because they must be output row by row starting from 0,0. Since the parallel version gets data from random places, it can't write the output properly. This patch will however, render to the screen properly (at least, it does for me). I haven't tried it with any other image file format.

How to patch, compile, and run it: Download povray-3.6.1 for Unix, untar it, and copy the patch to the base directory of povray. Run patch -p1 < MPI-patch.patch. This should patch 3? or 4? files. To configure it you must use MPI enabled compilers with C++ classes. Since POV-Ray is written mostly in C++, I added the MPI patch using C++. I didn't patch the configure file because that would be too much trouble for me. I configure it with

#CC=mpicc CXX=mpicxx CFLAGS=”-DHAVE_MPI” CXXFLAGS=”-DHAVE_MPI” ./configure COMPILED_BY=”Anon”

Once that is done, simple run “make” and it should compile properly. After that, the MPI enabled executable should be in the unix subdirectory. You can use mpirun just like always.

Example:

#mpirun -np 2 isocacti.pov

You must use 2 processes minimum to get the image to render. If you only use mpirun -np 1, nothing will happen.

Note: The master node must be able to open an XWindow to display the rendered scene. If it can't, you won't see it. With the standard version of MPICH, the master node is always the one that the process is started from unless you use the -nolocal option.

If something else doesn't work, feel free to email (Wesley !dot! Emeneker (at) gmail %dot% com). I might not respond quickly since this is pretty much a one time patch, but I will try.