Add notion of base EOT for heterogeneous model. Island can be templated on a EOT regardless the EOT of its model. Island must have a conversion function from and to base EOT. Base EOT is optionnal and would be considered as EOT. In that case, conversion functions would be identity function.
This commit is contained in:
parent
c90fdc579f
commit
f67ee442c7
11 changed files with 86 additions and 58 deletions
|
|
@ -51,8 +51,8 @@ void paradiseo::smp::IslandModel<EOT>::operator()()
|
|||
std::vector<std::thread> threads(islands.size());
|
||||
|
||||
// Preparing islands
|
||||
for(auto it : islands)
|
||||
it.second = true;
|
||||
for(auto& it : islands)
|
||||
it.second = true; // Indicate islands are running
|
||||
|
||||
// Construct topology according to the number of islands
|
||||
topo.construct(islands.size());
|
||||
|
|
@ -75,7 +75,7 @@ void paradiseo::smp::IslandModel<EOT>::operator()()
|
|||
[](std::pair<AIsland<EOT>*, bool>& i) -> bool
|
||||
{ return i.second; } );
|
||||
};
|
||||
|
||||
|
||||
while(workingIslands() > 0)
|
||||
{
|
||||
// Count working islands
|
||||
|
|
@ -107,6 +107,7 @@ template<class EOT>
|
|||
void paradiseo::smp::IslandModel<EOT>::update(eoPop<EOT> _data, AIsland<EOT>* _island)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m);
|
||||
std::cout << "Mediateur reçoit ! " << _data << std::endl;
|
||||
listEmigrants.push(std::pair<eoPop<EOT>,AIsland<EOT>*>(_data, _island));
|
||||
}
|
||||
|
||||
|
|
@ -133,6 +134,7 @@ void paradiseo::smp::IslandModel<EOT>::send(void)
|
|||
std::lock_guard<std::mutex> lock(m);
|
||||
while (!listEmigrants.empty())
|
||||
{
|
||||
std::cout << "Mediator envoie ! " << listEmigrants.size() << std::endl;
|
||||
// Get the neighbors
|
||||
unsigned idFrom = table.getLeft()[listEmigrants.front().second];
|
||||
std::vector<unsigned> neighbors = topo.getIdNeighbors(idFrom);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue