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 * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008 * (C) OPAC Team, LIFL, 2002-2008
* *
* Clive Canape * Alexandru-Adrian TANTAR
* *
* This software is governed by the CeCILL license under French law and * This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use, * abiding by the rules of distribution of free software. You can use,
@ -57,6 +57,10 @@
#include "rmc/mpi/synchron.h" #include "rmc/mpi/synchron.h"
extern void wakeUpCommunicator();
extern int getNodeRank();
class peoSyncDataTransfer : public Cooperative, public eoUpdater class peoSyncDataTransfer : public Cooperative, public eoUpdater
{ {
@ -131,102 +135,9 @@ class peoSyncDataTransfer : public Cooperative, public eoUpdater
} }
void operator()(); 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()()
{
standbyTransfer = false; standbyTransfer = false;
nbTransfersIn = nbTransfersOut = 0; nbTransfersIn = nbTransfersOut = 0;
@ -245,10 +156,33 @@ void peoSyncDataTransfer :: operator()()
synchronizeCoopEx(); synchronizeCoopEx();
stop(); 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++; nbTransfersOut++;
@ -259,10 +193,11 @@ void peoSyncDataTransfer :: notifySending()
{ {
getOwner()->setPassive(); getOwner()->setPassive();
} }
} }
void peoSyncDataTransfer :: notifyReceiving()
{ void notifyReceiving()
{
nbTransfersIn++; nbTransfersIn++;
printDebugMessage( "peoSyncIslandMig: notified of incoming data." ); printDebugMessage( "peoSyncIslandMig: notified of incoming data." );
@ -280,24 +215,74 @@ void peoSyncDataTransfer :: notifyReceiving()
printDebugMessage( "peoSyncIslandMig: finished collecting incoming data." ); printDebugMessage( "peoSyncIslandMig: finished collecting incoming data." );
sem_post( &sync ); sem_post( &sync );
} }
} }
void peoSyncDataTransfer :: notifySendingSyncReq ()
{ void notifySendingSyncReq()
{
getOwner()->setPassive(); getOwner()->setPassive();
printDebugMessage( "peoSyncIslandMig: synchronization request sent." ); printDebugMessage( "peoSyncIslandMig: synchronization request sent." );
} }
void peoSyncDataTransfer :: notifySynchronized () void notifySynchronized()
{ {
printDebugMessage( "peoSyncIslandMig: cooperators synchronized." ); printDebugMessage( "peoSyncIslandMig: cooperators synchronized." );
standbyTransfer = true; standbyTransfer = true;
getOwner()->setActive(); getOwner()->setActive();
resume(); resume();
} }
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 #endif