[ Home | Docs | News | Resources | Download]
GAUL Documentation: Utilising Multiple Processors

Parallel calculations

Performing multiprocessor calculations with GAUL is easy!

The example program wildfire.c is CPU intensive and therefore fairly slow on a standard uniprocessor computer. Several different parallel GA implementations are provided by GAUL. These parallel implementations are, in most cases, drop-in replacements for the "ga_evolution()" and "ga_evolution_archipelago()" functions. The computer systems available to you will the primary factor dictating the choice between these replacement functions.

An exception to this is the use of OpenMP for parallel code. If GAUL is compiled with OpenMP support enabled, and assumming an OpenMP compiler is available, then all GAUL code may, transparently, benefit without any further action by the user.

Note that subject to the compilation options used, some of these functions will be unavailable. Generally, the functions are only compiled on systems for which they would be useful. For example, the MPI-based versions are not available on systems where the MPI libraries are not installed!

Distributed processes with "ga_evolution_mpi()" and "ga_evolution_archipelago_mpi()"

"ga_evolution_mpi()" is a replacement for "ga_evolution()". Likewise, "ga_evolution_archipelago_mpi()" is a replacement for "ga_evolution_archipelago()". These both require a functioning MPI parallel message-passing library to be installed. These are not direct, drop-in, replacements because a certian amount of MPI-specific setup needs to be performed.

Any of the GAUL examples with a name finishing with "_mpi" (and source code with a name finishing with "_mpi.c") uses these MPI-based parallel algorithms. You are referred to such examples as a guide for creating your own parallel GAUL programs.

Forked processes with "ga_evolution_forked()" and "ga_evolution_archipelago_forked()"

These functions are intended for use on multiple processor workstations or distributed systems with transparent process migration, for example Linux clusters with MOSIX or OpenMOSIX. The results from these functions will be identical to the results from the standard "ga_evolution()" or "ga_evolution_archipelago()". The difference is that every fitness evaluation and adaptation operation is performed within a seperate forked process. In the case of a trivial fitness function, it is likely that no improvement in the evolution's speed will be observed because of the fork overhead. However, for many tasks on certain systems, the benefits of having the fitness evalutations occur in parallel can be significant.

They require absolutely no code changes, besides the use of the specific function.

An environment variable, "GA_NUM_PROCESSES" by default, may be used to define the maximum number of forked processes at any single time.

You must be careful if your evaluation or adaptation functions use random numbers. Without careful modification, the results of your evolution will be affected by the distortion to the random number sequence.

Multiple threads with "ga_evolution_threaded()" and "ga_evolution_archipelago_threaded()"

These versions of the evolution algorithms are most useful on SMP workstations. Each evaluation and adaptation is performed in a child thread. The environment variable "GA_NUM_THREADS" is used to define the maximum number of threads to use at one time.

Again, these functions require absolutely no code changes, besides the use of the specific function. However, they require a working installation of the Pthreads API to be available (as is the case for most modern Linux distributions).

Parallel processing demonstrations

The various versions of the standard generational GA available in GAUL are demonstrated in:

The directly equivalent island-model GA functions are demonstrated in:

If this section of the GAUL tutorial is of interest to you, you are recommended to inspect these demonstration programs to see how to construct your own parallel programs using GAUL.


[ Home | Docs | News | Resources | Download]
Hosted by:
SourceForge Logo
GAUL Button Valid HTML 4.01!

© 2001-2005, "Stewart Adcock" <stewart@linux-domain.com> All rights reserved.
All trademarks on this page are probably owned by their respective companies. You can insert you own favourite disclaimer here.