[galib] Runnng GAlib in parallel usin OpenMp
Patrick Coquillard
patrick.coquillard at unice.fr
Mon Aug 13 03:45:28 EDT 2012
Hi Sina, I think I have an idea.
With SimpleGa, every individual of the population are evaluated at each
generation.
In the others Ga, few best individuals are used to produce few
offspring which are next used to replace the worst ones (a small
fraction of the population). Thus there is no reevaluation of the rest
of the population at each generation !
As a consequence, the use of parallel computing should not provide you
some substantial gains of time computing....
See the doc about these Ga. I think I remember (I'm not sure) that
incrementalGa use to replace only one or two individuals.
Notice that these Gas are often used if your objective function involve
some stochastic components (Ga similar to the Genitor model (Walch, 1989)).
Cheers, Patrick.
Le 13/08/2012 06:38, Sina Porsa a écrit :
> Hi all
> I want to use GAlib to solve a huge problem and as a result, I have to
> run it in parallel.
> Actually the evaluation of the objective function is the most time
> consuming part in my code. (Evaluation of each genome/individual will
> take about 2 secs).
> I thought it may be helpful to evaluate different individuals in a
> population in parallel to improve the total simulation time.
> I decided to test if I can use OpenMP . So I modified the
> GAPopulation.cpp file as below
>
> Original code:
> GAPopulation::DefaultEvaluator(GAPopulation & p){
> for(int i=0; i<p.size(); i++){
> p.individual(i).evaluate();
> }
> }
>
> Modified code:
> GAPopulation::DefaultEvaluator(GAPopulation & p){
> #pragma omp parallel for num_threads(64) // I am using 64 threads
> for(int i=0; i<p.size(); i++){
> p.individual(i).evaluate();
> }
> }
>
> And the results were shocking!!
> During evaluation of the first generation, the evaluator runs in
> parallel and uses all 64 available threads. But for the rest of the
> simulation, it only uses 4-5 of the threads.
>
> Another wired thing is that this problem only happens if I use
> GASteadyStateGA or GAIncrementalGA. But if I chang to GASimpleGA, I
> will not have this problem and the simulation uses all 64 available
> threads.
>
> Any idea what is causing this problem and how can I solve it?
>
> Cheers,
> Sina
>
>
> _______________________________________________
> galib mailing list
> galib at mit.edu
> http://mailman.mit.edu/mailman/listinfo/galib
--
Le Savoir n'est pas une marchandise
L'Université n'est pas une entreprise
--
Dr. Patrick Coquillard
Institut Biologie et santé des Végétaux
400, route des Chappes
06 903, Sophia Antipolis
Tél/fax : 04 92 38 64 30
http://www.unice.fr/coquillard
-----
Virus free certfied by AVG
Analyse effectuée par AVG - www.avg.fr
Version: 2012.0.2197 / Base de données virale: 2437/5195 - Date: 12/08/2012
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20120813/ec76211d/attachment.htm
More information about the galib
mailing list