Static assignment algorithm works with parallel eval now.
This commit is contained in:
parent
23acd1a633
commit
79c7a263a3
3 changed files with 23 additions and 1 deletions
|
|
@ -94,6 +94,7 @@ void parallelApply(
|
||||||
eo::mpi::ParallelEvalStore<EOT> & _store )
|
eo::mpi::ParallelEvalStore<EOT> & _store )
|
||||||
{
|
{
|
||||||
_store.data( _pop );
|
_store.data( _pop );
|
||||||
|
_algo.reinit( _pop.size() );
|
||||||
eo::mpi::ParallelApply<EOT> job( _algo, _masterRank, _store );
|
eo::mpi::ParallelApply<EOT> job( _algo, _masterRank, _store );
|
||||||
job.run();
|
job.run();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ namespace eo
|
||||||
virtual int availableWorkers( ) = 0;
|
virtual int availableWorkers( ) = 0;
|
||||||
virtual void confirm( int wrkRank ) = 0;
|
virtual void confirm( int wrkRank ) = 0;
|
||||||
virtual std::vector<int> idles( ) = 0;
|
virtual std::vector<int> idles( ) = 0;
|
||||||
|
virtual void reinit( int runs ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DynamicAssignmentAlgorithm : public AssignmentAlgorithm
|
struct DynamicAssignmentAlgorithm : public AssignmentAlgorithm
|
||||||
|
|
@ -79,6 +80,12 @@ namespace eo
|
||||||
return availableWrk;
|
return availableWrk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reinit( int _ )
|
||||||
|
{
|
||||||
|
++_;
|
||||||
|
// nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector< int > availableWrk;
|
std::vector< int > availableWrk;
|
||||||
};
|
};
|
||||||
|
|
@ -181,7 +188,7 @@ namespace eo
|
||||||
|
|
||||||
void confirm( int rank )
|
void confirm( int rank )
|
||||||
{
|
{
|
||||||
int i = -1;
|
int i = -1; // i is the real index in table
|
||||||
for( unsigned int j = 0; j < realRank.size(); ++j )
|
for( unsigned int j = 0; j < realRank.size(); ++j )
|
||||||
{
|
{
|
||||||
if( realRank[j] == rank )
|
if( realRank[j] == rank )
|
||||||
|
|
@ -196,6 +203,11 @@ namespace eo
|
||||||
++freeWorkers;
|
++freeWorkers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reinit( int runs )
|
||||||
|
{
|
||||||
|
init( realRank, runs );
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<int> attributions;
|
std::vector<int> attributions;
|
||||||
std::vector<int> realRank;
|
std::vector<int> realRank;
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,15 @@ namespace eo
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~EmptyJob()
|
||||||
|
{
|
||||||
|
std::vector< int > idles = assignmentAlgo.idles();
|
||||||
|
for(unsigned i = 0, size = idles.size(); i < size; ++i)
|
||||||
|
{
|
||||||
|
comm.send( idles[i], Channel::Commands, Message::Kill );
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Reference in a new issue