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+

Leave a Reply