The open source
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:
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 "JPPF-node.zip" 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 startNode.sh 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:
The command lines arguments can be obtained by typing
usage: Windows: run.bat [option, ...] Linux: ./run.sh [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> where: 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/jppf.properties:
# max number of jobs that can be concurrently submitted # if > 1, it also requires setting a connection pool jppf.fractals.concurrent.jobs = 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:
jppf.fractals.concurrent.jobs = 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 videoThe 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:
|Copyright © 2005-2020 JPPF.org|