The purpose of this project is to demonstrate distributed computing for generating animations of zooming into Mandelbrot pictures. In other words, to use multiple computers all networked together to work on a complicated math formula to generate mandelbrot animations.
Mandelbrots are pictures that are generated from the math equation z = z^2 + c where c is a complex number (x + yi) and x and y are coordinates. A set of coordinates are put into the formula and computed for a number of iterations. If at any time z becomes more than 4, the coordinates are not considered in the mandelbrot set and a color is put on the screen. The color depends on how many iterations went by before the coordinates failed. If z never becomes more than 4, a black dot is put on the screen. Here are a couple example pictures:
Coordinates: (-2.00,-1.00) to (1.00,1.00)
Coordinates: (-0.785799,-0.146523) to (-0.685693,-0.079802)
Anyway, I was curious about distributed computing, so I wrote this client/server Mandelbrot generator. The server is a modified version of my Naken Chat chat server. To use this program, simply run the mandel_server program. It will create a file called frames.dat in the frames directory. This file keeps track of all the frames that have been made, this way if the server dies when you start it over it will keep going where it left off. If you want mandel_server to create a new sequence of images, you must delete this file.
Before running the mandel_server you can configure it using the mandel_server.conf file. In this file you set the width/height of the output GIF image, the real/imaginary starting coordinates, the real/imaginary ending coordinates, the number of iterations, and the number of frames to create.
After starting the server, you need a client to do all the dirty work.
In the mandel_client directory, type: ./mandel_client <ip of server> (or
if you're on Windows, open up a DOS prompt or a run box, and type:
mandel_client <ip of server>). You need to replace the
Keep in mind that different processor architectures handle floating point numbers differently. In other words, if one of your clients is an Apple MAC, another an Intel PC, another a SGI MIPS, etc, you may get inconsistent results. Altho, my last animation I created was done with a Mac running OSX, an AMD Athlon XP running Linux, and an AMD K6-2 running Linux, and I saw no strangeness there :).
Well, problems with this program so far include:
1) It's not very user friendly. It's more of a proof of concept.
2) It's not secure. Maybe I should add a "hosts allow" file like Naken
Chat has
3) It's probably buggy. I wrote it pretty quick. It does create really neat
images tho.
In the future I might also add a feature so it can do more than 16 colors, and the mandel_server will tell all the clients which colors to use.
You can download and test it here:
mandel-2005-01-09.tar.gz (Unix Source)
mandel-2005-01-09.zip (Windows Binaries)
This package is NOT opensource. If you'd like to use
this code in your own projects (commercial or not) let me know and
we can work something out.
Click here if you're confused what to download/install
gif2avi
Click here if you're confused what to download/install