<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Sina, I think I have an idea.<br>
      <br>
      With SimpleGa, every individual of the population are evaluated at
      each generation.<br>
      In the others Ga,&nbsp; 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 !<br>
      As a consequence, the use of parallel computing should not provide
      you some substantial gains of time computing....<br>
      <br>
      See the doc about these Ga. I think I remember (I'm not sure) that
      incrementalGa use to replace only one or two individuals.<br>
      <br>
      Notice that these Gas are often used if your objective function
      involve some stochastic components (Ga similar to the Genitor
      model (Walch, 1989)).<br>
      <br>
      Cheers, Patrick.<br>
      <br>
      Le 13/08/2012 06:38, Sina Porsa a &eacute;crit&nbsp;:<br>
    </div>
    <blockquote
cite="mid:CAAPOfErD05qnN6a2PoEEK1Mmxx-cdOGBt8bUvpU+HtFJ3yL7yw@mail.gmail.com"
      type="cite">Hi all
      <div>I want to use GAlib to solve a huge problem and as a result,
        I have to run it in parallel.</div>
      <div>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).&nbsp;</div>
      <div>I thought it may be helpful to evaluate different individuals
        in a population in parallel to improve the total simulation
        time.</div>
      <div>I decided to test if I can use OpenMP . So I modified the
        GAPopulation.cpp file as below</div>
      <div><br>
      </div>
      <div>Original code:</div>
      <div>
        <div>GAPopulation::DefaultEvaluator(GAPopulation &amp; p){</div>
        <div><span class="Apple-tab-span" style="white-space:pre"> </span>for(int
          i=0; i&lt;p.size(); i++){</div>
        <div><span class="Apple-tab-span" style="white-space:pre"> </span>p.individual(i).evaluate();</div>
        <div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
        <div>}</div>
      </div>
      <div><br>
      </div>
      <div>
        <div>Modified code:</div>
        <div>
          <div>GAPopulation::DefaultEvaluator(GAPopulation &amp; p){</div>
          <div>&nbsp; #pragma omp parallel for num_threads(64) // I am using
            64 threads</div>
          <div><span class="Apple-tab-span" style="white-space:pre"> </span>for(int
            i=0; i&lt;p.size(); i++){</div>
          <div><span class="Apple-tab-span" style="white-space:pre"> </span>p.individual(i).evaluate();</div>
          <div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
          <div>}</div>
        </div>
      </div>
      <div><br>
      </div>
      <div>And the results were shocking!!</div>
      <div>During evaluation of the first generation,
        the&nbsp;&nbsp;evaluator&nbsp;runs in parallel and uses all 64 available
        threads. But for the rest of the simulation, it only uses 4-5 of
        the threads.</div>
      <div><br>
      </div>
      <div>Another&nbsp;wired&nbsp;thing is that this problem only happens if I
        use GASteadyStateGA or GAIncrementalGA. But if I chang
        to&nbsp;GASimpleGA, I will not have this problem and the simulation
        uses all 64 available threads.</div>
      <div><br>
      </div>
      <div>Any idea what is causing this problem and how can I solve it?</div>
      <div><br>
      </div>
      <div>Cheers,</div>
      <div>Sina</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
galib mailing list
<a class="moz-txt-link-abbreviated" href="mailto:galib@mit.edu">galib@mit.edu</a>
<a class="moz-txt-link-freetext" href="http://mailman.mit.edu/mailman/listinfo/galib">http://mailman.mit.edu/mailman/listinfo/galib</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Le Savoir n'est pas une marchandise
L'Universit&eacute; n'est pas une entreprise
--

Dr. Patrick Coquillard
Institut Biologie et sant&eacute; des V&eacute;g&eacute;taux
400, route des Chappes
06 903, Sophia Antipolis

T&eacute;l/fax : 04 92 38 64 30
<a class="moz-txt-link-freetext" href="http://www.unice.fr/coquillard">http://www.unice.fr/coquillard</a></pre>
  </body>
<a></a><p class=""avgcert"" align="left" color="#000000">Virus free certfied by AVG<br>
Analyse effectu&#233;e par AVG - <a href='http://www.avg.fr'>www.avg.fr</a><br>
Version: 2012.0.2197 / Base de donn&#233;es virale: 2437/5195 - Date: 12/08/2012</p></html>