git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1202 331e1502-861f-0410-8da2-ba01fb791d7f

This commit is contained in:
atantar 2008-06-15 16:29:20 +00:00
commit 2622e3f2a2

View file

@ -3,7 +3,7 @@
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Clive Canape
* Alexandru-Adrian TANTAR
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
@ -57,6 +57,10 @@
#include "rmc/mpi/synchron.h"
extern void wakeUpCommunicator();
extern int getNodeRank();
class peoSyncDataTransfer : public Cooperative, public eoUpdater
{
@ -131,100 +135,7 @@ class peoSyncDataTransfer : public Cooperative, public eoUpdater
}
void operator()();
void pack();
void unpack();
void packSynchronizeReq();
void notifySending();
void notifyReceiving();
void notifySendingSyncReq();
void notifySynchronized();
private:
void sendData();
void receiveData();
Topology& topology; // neighboring topology
// source and destination end-points
AbstractMsgTransferQueue* source;
AbstractMsgTransferQueue* destination;
std :: queue< Cooperative* > coop_em;
sem_t sync;
bool standbyTransfer;
std :: vector< Cooperative* > in, out, all;
unsigned nbTransfersIn, nbTransfersOut;
};
void peoSyncDataTransfer :: pack()
{
::pack( coop_em.front()->getKey() );
source->packMessage();
coop_em.pop();
}
void peoSyncDataTransfer :: unpack()
{
destination->unpackMessage();
}
void peoSyncDataTransfer :: packSynchronizeReq()
{
packSynchronRequest( all );
}
extern void wakeUpCommunicator();
extern int getNodeRank();
void peoSyncDataTransfer :: sendData()
{
for ( unsigned i = 0; i < out.size(); i ++ )
{
source->pushMessage();
coop_em.push( out[ i ] );
send( out[ i ]);
printDebugMessage( "peoSyncDataTransfer: sending data." );
}
wakeUpCommunicator();
}
void peoSyncDataTransfer :: receiveData()
{
assert( !( destination->empty() ) );
while ( !( destination->empty() ) )
{
printDebugMessage( "peoSyncDataTransfer: received data." );
destination->popMessage();
printDebugMessage( "peoSyncDataTransfer: done extracting received data." );
}
}
void peoSyncDataTransfer :: operator()()
void operator()()
{
standbyTransfer = false;
@ -247,7 +158,30 @@ void peoSyncDataTransfer :: operator()()
stop();
}
void peoSyncDataTransfer :: notifySending()
void pack()
{
::pack( coop_em.front()->getKey() );
source->packMessage();
coop_em.pop();
}
void unpack()
{
destination->unpackMessage();
}
void packSynchronizeReq()
{
packSynchronRequest( all );
}
void notifySending()
{
nbTransfersOut++;
@ -261,7 +195,8 @@ void peoSyncDataTransfer :: notifySending()
}
}
void peoSyncDataTransfer :: notifyReceiving()
void notifyReceiving()
{
nbTransfersIn++;
@ -282,14 +217,15 @@ void peoSyncDataTransfer :: notifyReceiving()
}
}
void peoSyncDataTransfer :: notifySendingSyncReq ()
void notifySendingSyncReq()
{
getOwner()->setPassive();
printDebugMessage( "peoSyncIslandMig: synchronization request sent." );
}
void peoSyncDataTransfer :: notifySynchronized ()
void notifySynchronized()
{
printDebugMessage( "peoSyncIslandMig: cooperators synchronized." );
@ -300,4 +236,53 @@ void peoSyncDataTransfer :: notifySynchronized ()
}
private:
void sendData()
{
for ( unsigned i = 0; i < out.size(); i ++ )
{
source->pushMessage();
coop_em.push( out[ i ] );
send( out[ i ]);
printDebugMessage( "peoSyncDataTransfer: sending data." );
}
wakeUpCommunicator();
}
void receiveData()
{
assert( !( destination->empty() ) );
while ( !( destination->empty() ) )
{
printDebugMessage( "peoSyncDataTransfer: received data." );
destination->popMessage();
printDebugMessage( "peoSyncDataTransfer: done extracting received data." );
}
}
Topology& topology; // neighboring topology
// source and destination end-points
AbstractMsgTransferQueue* source;
AbstractMsgTransferQueue* destination;
std :: queue< Cooperative* > coop_em;
sem_t sync;
bool standbyTransfer;
std :: vector< Cooperative* > in, out, all;
unsigned nbTransfersIn, nbTransfersOut;
};
#endif