Island modified
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@923 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
77506fb591
commit
e7f6d3ca83
8 changed files with 62 additions and 62 deletions
|
|
@ -61,7 +61,7 @@
|
|||
//! @see Cooperative eoUpdater
|
||||
//! @version 2.0
|
||||
//! @date january 2008
|
||||
template< class EOT, class TYPE > class peoAsyncIslandMig : public Cooperative, public eoUpdater
|
||||
template< class TYPESELECT, class TYPEREPLACE > class peoAsyncIslandMig : public Cooperative, public eoUpdater
|
||||
{
|
||||
|
||||
public:
|
||||
|
|
@ -73,8 +73,8 @@ template< class EOT, class TYPE > class peoAsyncIslandMig : public Cooperative,
|
|||
//! @param Topology& __topology
|
||||
peoAsyncIslandMig(
|
||||
continuator & __cont,
|
||||
selector <TYPE> & __select,
|
||||
replacement <TYPE> & __replace,
|
||||
selector <TYPESELECT> & __select,
|
||||
replacement <TYPEREPLACE> & __replace,
|
||||
Topology& __topology
|
||||
);
|
||||
|
||||
|
|
@ -95,27 +95,27 @@ template< class EOT, class TYPE > class peoAsyncIslandMig : public Cooperative,
|
|||
|
||||
private:
|
||||
//! @param continuator & cont
|
||||
//! @param selector <TYPE> & select
|
||||
//! @param replacement <TYPE> & replace
|
||||
//! @param selector <TYPESELECT> & select
|
||||
//! @param replacement <TYPEREPLACE> & replace
|
||||
//! @param Topology& topology
|
||||
//! @param std :: queue< TYPE > imm
|
||||
//! @param std :: queue< TYPE > em
|
||||
//! @param std :: queue< TYPEREPLACE > imm
|
||||
//! @param std :: queue< TYPESELECT > em
|
||||
//! @param std :: queue< Cooperative* > coop_em
|
||||
continuator & cont;
|
||||
selector <TYPE> & select;
|
||||
replacement <TYPE> & replace;
|
||||
selector <TYPESELECT> & select;
|
||||
replacement <TYPEREPLACE> & replace;
|
||||
Topology& topology;
|
||||
std :: queue< TYPE > imm;
|
||||
std :: queue< TYPE > em;
|
||||
std :: queue< TYPEREPLACE > imm;
|
||||
std :: queue< TYPESELECT > em;
|
||||
std :: queue< Cooperative* > coop_em;
|
||||
};
|
||||
|
||||
|
||||
template< class EOT , class TYPE> peoAsyncIslandMig< EOT, TYPE > :: peoAsyncIslandMig(
|
||||
template< class TYPESELECT , class TYPEREPLACE> peoAsyncIslandMig< TYPESELECT, TYPEREPLACE > :: peoAsyncIslandMig(
|
||||
|
||||
continuator & __cont,
|
||||
selector <TYPE> & __select,
|
||||
replacement <TYPE> & __replace,
|
||||
selector <TYPESELECT> & __select,
|
||||
replacement <TYPEREPLACE> & __replace,
|
||||
Topology& __topology
|
||||
|
||||
) : select( __select ), replace( __replace ), topology( __topology ), cont(__cont)
|
||||
|
|
@ -125,7 +125,7 @@ template< class EOT , class TYPE> peoAsyncIslandMig< EOT, TYPE > :: peoAsyncIsla
|
|||
}
|
||||
|
||||
|
||||
template< class EOT , class TYPE> void peoAsyncIslandMig< EOT, TYPE > :: pack()
|
||||
template< class TYPESELECT , class TYPEREPLACE> void peoAsyncIslandMig< TYPESELECT, TYPEREPLACE > :: pack()
|
||||
{
|
||||
lock ();
|
||||
::pack( coop_em.front()->getKey() );
|
||||
|
|
@ -136,19 +136,19 @@ template< class EOT , class TYPE> void peoAsyncIslandMig< EOT, TYPE > :: pack()
|
|||
}
|
||||
|
||||
|
||||
template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: unpack()
|
||||
template< class TYPESELECT, class TYPEREPLACE> void peoAsyncIslandMig< TYPESELECT , TYPEREPLACE> :: unpack()
|
||||
{
|
||||
lock ();
|
||||
TYPE mig;
|
||||
TYPEREPLACE mig;
|
||||
mig.unpack();
|
||||
imm.push( mig );
|
||||
unlock();
|
||||
}
|
||||
|
||||
template< class EOT , class TYPE> void peoAsyncIslandMig< EOT, TYPE > :: packSynchronizeReq()
|
||||
template< class TYPESELECT , class TYPEREPLACE> void peoAsyncIslandMig< TYPESELECT, TYPEREPLACE > :: packSynchronizeReq()
|
||||
{}
|
||||
|
||||
template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: emigrate()
|
||||
template< class TYPESELECT , class TYPEREPLACE> void peoAsyncIslandMig< TYPESELECT , TYPEREPLACE> :: emigrate()
|
||||
{
|
||||
std :: vector< Cooperative* >in, out;
|
||||
topology.setNeighbors( this, in, out );
|
||||
|
|
@ -156,7 +156,7 @@ template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: emigrat
|
|||
for ( unsigned i = 0; i < out.size(); i++ )
|
||||
{
|
||||
|
||||
TYPE mig;
|
||||
TYPESELECT mig;
|
||||
select(mig);
|
||||
em.push( mig );
|
||||
coop_em.push( out[i] );
|
||||
|
|
@ -166,7 +166,7 @@ template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: emigrat
|
|||
}
|
||||
|
||||
|
||||
template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: immigrate()
|
||||
template< class TYPESELECT, class TYPEREPLACE> void peoAsyncIslandMig< TYPESELECT , TYPEREPLACE> :: immigrate()
|
||||
{
|
||||
|
||||
lock ();
|
||||
|
|
@ -183,7 +183,7 @@ template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: immigra
|
|||
}
|
||||
|
||||
|
||||
template< class EOT , class TYPE> void peoAsyncIslandMig< EOT, TYPE > :: operator()()
|
||||
template< class TYPESELECT , class TYPEREPLACE> void peoAsyncIslandMig< TYPESELECT , TYPEREPLACE > :: operator()()
|
||||
{
|
||||
|
||||
if (cont.check())
|
||||
|
|
|
|||
|
|
@ -68,20 +68,20 @@
|
|||
//! @see Cooperative eoUpdater
|
||||
//! @version 2.0
|
||||
//! @date january 2008
|
||||
template< class EOT, class TYPE > class peoSyncIslandMig : public Cooperative, public eoUpdater
|
||||
template< class TYPESELECT, class TYPEREPLACE > class peoSyncIslandMig : public Cooperative, public eoUpdater
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! @brief Constructor
|
||||
//! @param unsigned __frequency
|
||||
//! @param selector <TYPE> & __select
|
||||
//! @param replacement <TYPE> & __replace
|
||||
//! @param selector <TYPESELECT> & __select
|
||||
//! @param replacement <TYPEREPLACE> & __replace
|
||||
//! @param Topology& __topology
|
||||
peoSyncIslandMig(
|
||||
unsigned __frequency,
|
||||
selector <TYPE> & __select,
|
||||
replacement <TYPE> & __replace,
|
||||
selector <TYPESELECT> & __select,
|
||||
replacement <TYPEREPLACE> & __replace,
|
||||
Topology& __topology
|
||||
);
|
||||
|
||||
|
|
@ -110,11 +110,11 @@ template< class EOT, class TYPE > class peoSyncIslandMig : public Cooperative,
|
|||
|
||||
private:
|
||||
//! @param eoSyncContinue cont
|
||||
//! @param selector <TYPE> & select
|
||||
//! @param replacement <TYPE> & replace
|
||||
//! @param selector <TYPESELECT> & select
|
||||
//! @param replacement <TYPEREPLACE> & replace
|
||||
//! @param Topology& topology
|
||||
//! @param std :: queue< TYPE > imm
|
||||
//! @param std :: queue< TYPE > em
|
||||
//! @param std :: queue< TYPEREPLACE > imm
|
||||
//! @param std :: queue< TYPESELECT > em
|
||||
//! @param std :: queue< Cooperative* > coop_em
|
||||
//! @param sem_t sync
|
||||
//! @param bool explicitPassive
|
||||
|
|
@ -122,11 +122,11 @@ template< class EOT, class TYPE > class peoSyncIslandMig : public Cooperative,
|
|||
//! @param std :: vector< Cooperative* > in, out, all
|
||||
//! @param unsigned nbMigrations
|
||||
eoSyncContinue cont;
|
||||
selector <TYPE> & select;
|
||||
replacement <TYPE> & replace;
|
||||
selector <TYPESELECT> & select;
|
||||
replacement <TYPEREPLACE> & replace;
|
||||
Topology& topology;
|
||||
std :: queue< TYPE > imm;
|
||||
std :: queue< TYPE > em;
|
||||
std :: queue< TYPEREPLACE > imm;
|
||||
std :: queue< TYPESELECT > em;
|
||||
std :: queue< Cooperative* > coop_em;
|
||||
sem_t sync;
|
||||
bool explicitPassive;
|
||||
|
|
@ -136,11 +136,11 @@ template< class EOT, class TYPE > class peoSyncIslandMig : public Cooperative,
|
|||
};
|
||||
|
||||
|
||||
template< class EOT, class TYPE > peoSyncIslandMig< EOT,TYPE > :: peoSyncIslandMig(
|
||||
template< class TYPESELECT, class TYPEREPLACE > peoSyncIslandMig< TYPESELECT,TYPEREPLACE > :: peoSyncIslandMig(
|
||||
|
||||
unsigned __frequency,
|
||||
selector <TYPE> & __select,
|
||||
replacement <TYPE> & __replace,
|
||||
selector <TYPESELECT> & __select,
|
||||
replacement <TYPEREPLACE> & __replace,
|
||||
Topology& __topology
|
||||
) : cont( __frequency ), select( __select ), replace( __replace ), topology( __topology )
|
||||
{
|
||||
|
|
@ -150,7 +150,7 @@ template< class EOT, class TYPE > peoSyncIslandMig< EOT,TYPE > :: peoSyncIslandM
|
|||
}
|
||||
|
||||
|
||||
template< class EOT, class TYPE > void peoSyncIslandMig< EOT, TYPE > :: pack()
|
||||
template< class TYPESELECT, class TYPEREPLACE > void peoSyncIslandMig< TYPESELECT, TYPEREPLACE > :: pack()
|
||||
{
|
||||
::pack( coop_em.front()->getKey() );
|
||||
em.front().pack();
|
||||
|
|
@ -158,27 +158,27 @@ template< class EOT, class TYPE > void peoSyncIslandMig< EOT, TYPE > :: pack()
|
|||
em.pop();
|
||||
}
|
||||
|
||||
template< class EOT, class TYPE > void peoSyncIslandMig< EOT, TYPE > :: unpack()
|
||||
template< class TYPESELECT, class TYPEREPLACE > void peoSyncIslandMig< TYPESELECT, TYPEREPLACE > :: unpack()
|
||||
{
|
||||
TYPE mig;
|
||||
TYPEREPLACE mig;
|
||||
mig.unpack();
|
||||
imm.push( mig );
|
||||
explicitPassive = true;
|
||||
}
|
||||
|
||||
template< class EOT, class TYPE > void peoSyncIslandMig< EOT,TYPE > :: packSynchronizeReq()
|
||||
template< class TYPESELECT, class TYPEREPLACE > void peoSyncIslandMig< TYPESELECT,TYPEREPLACE > :: packSynchronizeReq()
|
||||
{
|
||||
|
||||
packSynchronRequest( all );
|
||||
}
|
||||
|
||||
template< class EOT, class TYPE > void peoSyncIslandMig< EOT , TYPE > :: emigrate()
|
||||
template< class TYPESELECT, class TYPEREPLACE > void peoSyncIslandMig< TYPESELECT , TYPEREPLACE > :: emigrate()
|
||||
{
|
||||
|
||||
for ( unsigned i = 0; i < out.size(); i ++ )
|
||||
{
|
||||
|
||||
TYPE mig;
|
||||
TYPESELECT mig;
|
||||
select( mig );
|
||||
em.push( mig );
|
||||
coop_em.push( out[ i ] );
|
||||
|
|
@ -187,7 +187,7 @@ template< class EOT, class TYPE > void peoSyncIslandMig< EOT , TYPE > :: emigrat
|
|||
}
|
||||
}
|
||||
|
||||
template< class EOT, class TYPE > void peoSyncIslandMig< EOT , TYPE > :: immigrate()
|
||||
template< class TYPESELECT, class TYPEREPLACE > void peoSyncIslandMig< TYPESELECT , TYPEREPLACE > :: immigrate()
|
||||
{
|
||||
assert( imm.size() );
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ template< class EOT, class TYPE > void peoSyncIslandMig< EOT , TYPE > :: immigra
|
|||
printDebugMessage( "peoSyncIslandMig: receiving some immigrants." );
|
||||
}
|
||||
|
||||
template< class EOT, class TYPE > void peoSyncIslandMig< EOT , TYPE > :: operator()()
|
||||
template< class TYPESELECT, class TYPEREPLACE > void peoSyncIslandMig< TYPESELECT , TYPEREPLACE > :: operator()()
|
||||
{
|
||||
|
||||
if ( cont.check() )
|
||||
|
|
@ -222,12 +222,12 @@ template< class EOT, class TYPE > void peoSyncIslandMig< EOT , TYPE > :: operato
|
|||
}
|
||||
}
|
||||
|
||||
template< class EOT, class TYPE > void peoSyncIslandMig< EOT , TYPE > :: notifySending()
|
||||
template< class TYPESELECT, class TYPEREPLACE > void peoSyncIslandMig< TYPESELECT , TYPEREPLACE > :: notifySending()
|
||||
{
|
||||
if ( !explicitPassive ) getOwner()->setPassive();
|
||||
}
|
||||
|
||||
template< class EOT, class TYPE > void peoSyncIslandMig< EOT , TYPE > :: notifyReceiving()
|
||||
template< class TYPESELECT, class TYPEREPLACE > void peoSyncIslandMig< TYPESELECT , TYPEREPLACE > :: notifyReceiving()
|
||||
{
|
||||
nbMigrations++;
|
||||
|
||||
|
|
@ -239,13 +239,13 @@ template< class EOT, class TYPE > void peoSyncIslandMig< EOT , TYPE > :: notifyR
|
|||
}
|
||||
}
|
||||
|
||||
template< class EOT, class TYPE > void peoSyncIslandMig< EOT, TYPE > :: notifySendingSyncReq ()
|
||||
template< class TYPESELECT, class TYPE > void peoSyncIslandMig< TYPESELECT, TYPE > :: notifySendingSyncReq ()
|
||||
{
|
||||
|
||||
getOwner()->setPassive();
|
||||
}
|
||||
|
||||
template< class EOT, class TYPE > void peoSyncIslandMig< EOT, TYPE > :: notifySynchronized ()
|
||||
template< class TYPESELECT, class TYPE > void peoSyncIslandMig< TYPESELECT, TYPE > :: notifySynchronized ()
|
||||
{
|
||||
|
||||
standbyMigration = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue