Putting time conditions into eo::mpi::Job and MultiParallelApply, which doesn't prefigure about number of workers evaluations.

This commit is contained in:
Benjamin Bouvier 2012-06-26 17:53:32 +02:00
commit 7b399aa1dd
6 changed files with 136 additions and 13 deletions

View file

@ -26,9 +26,10 @@ namespace eo
std::vector<EOT>& _pop,
AssignmentAlgorithm & algo,
int _masterRank,
int _packetSize = 1
int _packetSize = 1,
long _maxTime = 0
) :
Job( algo, _masterRank ),
Job( algo, _masterRank, _maxTime ),
func( _proc ),
index( 0 ),
size( _pop.size() ),
@ -42,7 +43,7 @@ namespace eo
tempArray = new EOT[ packetSize ];
}
~ParallelApply()
virtual ~ParallelApply()
{
delete [] tempArray;
}
@ -59,8 +60,11 @@ namespace eo
}
int sentSize = futureIndex - index ;
comm.send( wrkRank, 1, sentSize );
eo::log << eo::progress << "Evaluating individual " << index << std::endl;
assignedTasks[ wrkRank ].index = index;
assignedTasks[ wrkRank ].size = sentSize;
@ -85,7 +89,7 @@ namespace eo
comm.send( masterRank, 1, tempArray, recvSize );
}
bool isFinished()
virtual bool isFinished()
{
return index == size;
}