JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net

The open source
grid computing

 Home   About   Features   Download   Documentation   On Github   Forums 

Generation of Mandelbrot Fractal Movies

What does the sample do?

This sample demonstrates a JPPF grid based on a volunteer computing model. Its goal is to generate AVI movies made of fractal images (Mandelbrot set) individually computed as in the Fractals sample.

For this, we will reuse the code and artifacts of the Fractals sample, since it already implements JPPF tasks for the Mandelbrot computations, along with the code to submit the corresponding JPPF jobs. The movie file itself is created using the Monte Media Library.

Additionally, we will also generate a specific node distribution, with the following extensions and customizations:

  • the node will run in offline mode: it will disconnect from the server to execute the job, then reconnect to send the results back
  • the node will run in idle mode: it will start when the computer is idle (no user activity) and stop when the user wakes it up
  • it will embed a modified version of the JPPF default screensaver, which will display a preview of the image being computed by the node. This relies on task notifications emitted for each point of the image. The screen saver will look like this screenshot.
  • Since the node is offline, and to reduce network traffic, all required libraries and classes will be part of the node's local classpath

How do I run it?

Before running this sample application, you must have a JPPF server running.
For information on how to set up a server, please refer to the JPPF documentation.

Once you have a server running, you can build the node distribution by typing ant build from a command or shell prompt. This will produce two files "" and "JPPF-node.tar.gz". Use the file appropriate for the platform where the node is deployed (the .tar.gz includes execute permission for the script). If you wish to modify the node settings before this, you can edit the configuration files in FractalMovieGenerator/config/node.

once you have a node running, you can launch the sample by typing:
<run> -i data/mandelbrot.csv -o data/mandelbrot.avi -f 30 -t 30
where <run> is replaced with "run.bat" on Windows platforms or "./" on Linux/Unix platforms.

The command lines arguments can be obtained by typing <run> -h, which displays:

Windows: run.bat [option, ...]
Linux: ./ [option, ...]
There are two possible sets of options:
1. <run_cmd> -h|?
  display this screen and exit
2. <run_cmd> -i <input_file> -o <output_file> -f <frame_rate> -t <trans_time>
  input_file: a csv record file produced by the mandelbrot fractal sample
  output_file: path to the generated movie file
    the .avi extension is added if needed
  frame_rate: number of frames per second
  trans_time: the duration (in seconds) of a transition
    between 2 records in the input file
note: the total number of frames in the generated movie is equal to
  (nb_input_records-1) * frame_rate * trans_time

It is also possible to specify how many jobs can be sent concurrently by the application, by setting the following in config/

# max number of jobs that can be concurrently submitted
# if > 1, it also requires setting a connection pool = 4

This mechanism limits the memory consumption of the application, as the generated images can be huge and lead to OutOfMemoryError if too many are generated in parallel. For instance, to have up to 4 images generated in parallel, you would set the following: = 4
jppf.pool.size = 4

Lastly, you can also configure a job dispatch timeout and maximum allowed timeouts in the client configuration. These 2 properties are used to prevent jobs from getting stuck forever, in case a node never completes the execution of a job. This is done as follows:

# maximum allowed time for a job to execute in a node, before it is resubmitted
# or cancelled; defaults to 15000 ms
jppf.fractals.dispatch.timeout = 15000
# maximum number of allowed timeouts before a job is cancelled; defaults to 1
jppf.fractals.dispatch.max.timeouts = 1

Example generated video

The following was generated as an image size of 640x360 (360p definition), using a frame rate of 30 fps, and based on the input file "FractalMovieGenerator/data/mandelbrot.csv". Note that uploading it to Youtube required an additonal encoding step using the H.264 codec to generate a .mp4 video file.

I have additional questions and comments, where can I go?

If you need more insight into the code of this demo, you can consult the source, or have a look at the API documentation.

In addition, There are 2 privileged places you can go to:

JPPF Copyright © 2005-2020 Get JPPF at Fast, secure and Free Open Source software downloads