eoPopEvalFunc updated for parallel evaluation.

This commit is contained in:
Benjamin Bouvier 2012-06-25 14:55:15 +02:00
commit fc68c3b81e
3 changed files with 41 additions and 21 deletions

View file

@ -83,17 +83,33 @@ template<class EOT>
class eoParallelPopLoopEval : public eoPopEvalFunc<EOT> {
public:
/** Ctor: set value of embedded eoEvalFunc */
eoParallelPopLoopEval(eoEvalFunc<EOT> & _eval) : eval(_eval) {}
eoParallelPopLoopEval(
eoEvalFunc<EOT> & _eval,
eo::mpi::AssignmentAlgorithm& _assignAlgo,
int _masterRank,
int _packetSize = 1
) :
eval(_eval),
assignAlgo( _assignAlgo ),
masterRank( _masterRank ),
packetSize( _packetSize )
{
// empty
}
/** Do the job: simple loop over the offspring */
void operator()(eoPop<EOT> & _parents, eoPop<EOT> & _offspring)
{
(void)_parents;
parallelApply<EOT>(eval, _offspring);
parallelApply<EOT>(eval, _offspring, assignAlgo, masterRank, packetSize);
}
private:
eoEvalFunc<EOT> & eval;
eo::mpi::AssignmentAlgorithm & assignAlgo;
int masterRank;
int packetSize;
};
#endif