April 15, 2010

Weekend project: compute a 68 gigapixels fractal image: Part II

So, as promised, here is the source code for the gigapixels fractal project: gmpano.tar.gz. The archive contain the following files:

mandelbrot.cpp: The actual C++ code for the computation
numpy.i and PyMandelbrot.i: The SWIG descriptions files used for the function wrapper (C++ to Python)
gigaMandelbrot.py: This one contain the Python class used for the image tile rendering
gmPano.py: The final script that putting it all together and write the final image in the Deep Zoom Format. You will need to write the xml file by hand :-( . You can use HDView SL or HDView for viewing the image.

You will also need SWIG and the following python package: numpy, matplotlib, python parallel.

Here is a example of compilation process on a 64-bits linux machine:
swig -c++ -python PyMandelbrot.i
g++ -c -O3 -fPIC -fomit-frame-pointer -funroll-loops -fstrict-aliasing -m64 mandelbrot.cpp -I/usr/include/python2.6
g++ -c -O3 -fPIC -fomit-frame-pointer -funroll-loops -fstrict-aliasing -m64 PyMandelbrot_wrap.cxx -I/usr/include/python2.6
g++ -shared mandelbrot.o PyMandelbrot_wrap.o -o _PyMandelbrot.so -lm -lstdc+

March 27, 2010

Weekend project: compute a 68 gigapixels fractal image

Here is a project I made in order to test HDView SL. I’m not a big fan of the Flash/Silverlight thing, but I have to admit that the Seadragon zooming technique include in Silverlight is pretty neat. Put it in Fullscreen and have fun !

Quick facts:
- The final image size is around 3.2 GB.
- A physical print @ 300 dpi would be around 72.75 feet x 72.75 feet ! Which is equivalent to a 8-story building
- It took around 8 hrs to compute on a 4 cores CPU @ 2.4 Ghz.
- The main loop of the code was done in C.
- The final multithreaded code was done in Python with the help of Parallel Python
- The function wrapper (C -> Python) was done with SWIG and numpy.i.
- I’ll publish the code in the next posts