18 #include <boost/functional/hash.hpp>
41 boost::hash<string> hashString;
67 if (enableEventsProcessing)
79 map<int,CServerBuffer*>::iterator it;
83 MPI_Iprobe(MPI_ANY_SOURCE, 20,
interComm,&flag,&status);
88 rank=status.MPI_SOURCE ;
100 MPI_Iprobe(rank, 20,
interComm,&flag,&status);
113 map<int,CServerBuffer*>::iterator it;
114 int rank=status.MPI_SOURCE ;
120 MPI_Recv(&buffSize, 1, MPI_LONG, rank, 20,
interComm, &status);
127 MPI_Get_count(&status,MPI_CHAR,&count);
128 if (it->second->isBufferFree(count))
130 addr=(
char*)it->second->getBuffer(count);
143 map<int,MPI_Request>::iterator it;
144 list<int> recvRequest;
145 list<int>::iterator itRecv;
155 MPI_Test(& it->second, &flag, &status);
159 recvRequest.push_back(rank);
160 MPI_Get_count(&status,MPI_CHAR,&count);
165 for(itRecv=recvRequest.begin();itRecv!=recvRequest.end();itRecv++)
176 char* startBuffer,endBuffer;
179 map<size_t,CEventServer*>::iterator it;
184 char* startBuffer=(
char*)buffer.
ptr();
186 newBuffer>>size>>timeLine;
190 it->second->push(rank,
buffers[rank],startBuffer,size);
200 map<size_t,CEventServer*>::iterator it;
237 map<int,CServerBuffer*>::iterator it;
247 list<CEventServer::SSubEvent>::iterator it;
255 info(20)<<
" CContextServer: Receive context <"<<
context->
getId()<<
"> finalize."<<endl;
257 std::map<int, StdSize>::const_iterator itbMap =
mapBufferSize_.begin(),
259 for (itMap = itbMap; itMap != iteMap; ++itMap)
262 report(10)<<
" Memory report : Context <"<<ctxId<<
"> : server side : memory used for buffer of each connection to client" << endl
263 <<
" +) With client of rank " << rank <<
" : " << itMap->second <<
" bytes " << endl;
264 totalBuf += itMap->second;
266 report(0)<<
" Memory report : Context <"<<ctxId<<
"> : server side : total memory used for buffer "<<totalBuf<<
" bytes"<<endl;
269 else if (event.
classId==CContextGroup::GetType()) CContextGroup::dispatchEvent(event);
272 else if (event.
classId==CDomainGroup::GetType()) CDomainGroup::dispatchEvent(event);
274 else if (event.
classId==CAxisGroup::GetType()) CAxisGroup::dispatchEvent(event);
276 else if (event.
classId==CScalarGroup::GetType()) CScalarGroup::dispatchEvent(event);
278 else if (event.
classId==CGridGroup::GetType()) CGridGroup::dispatchEvent(event);
280 else if (event.
classId==CFieldGroup::GetType()) CFieldGroup::dispatchEvent(event);
282 else if (event.
classId==CFileGroup::GetType()) CFileGroup::dispatchEvent(event);
286 ERROR(
"void CContextServer::dispatchEvent(CEventServer& event)",<<
" Bad event class Id"<<endl);
static CEventScheduler * eventScheduler
map< int, char * > bufferRequest
static bool dispatchEvent(CEventServer &event)
Dispatch event from the lower communication layer then process event according to its type...
static ENodeType GetType(void)
static bool dispatchEvent(CEventServer &event)
Dispatch event received from client Whenever a message is received in buffer of server, it will be processed depending on its event type.
static bool dispatchEvent(CEventServer &event)
static ENodeType GetType(void)
bool eventLoop(bool enableEventsProcessing=true)
bool scheduled
event of current timeline is alreading scheduled ?
CContextServer(CContext *parent, MPI_Comm intraComm, MPI_Comm interComm)
std::vector< CContextClient * > clientPrimServer
static ENodeType GetType(void)
void checkPendingRequest(void)
static ENodeType GetType(void)
static ENodeType GetType(void)
map< int, CServerBuffer * > buffers
const StdString & getId(void) const
Accesseurs ///.
bool hasPendingEvent(void)
static ENodeType GetType(void)
static void setCurrent(const string &id)
Set context with an id be the current context.
std::map< int, StdSize > mapBufferSize_
CATCH CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar *scalarDestination, CScalar *scalarSource, CReduceScalarToScalar *algo ERROR)("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)",<< "Operation must be defined."<< "Scalar source "<< scalarSource->getId()<< std::endl<< "Scalar destination "<< scalarDestination->getId())
bool listenPendingRequest(MPI_Status &status)
static bool dispatchEvent(CEventServer &event)
map< size_t, CEventServer * > events
static bool dispatchEvent(CEventServer &event)
Dispatch event received from client Whenever a message is received in buffer of server, it will be processed depending on its event type.
void processRequest(int rank, char *buff, int count)
static bool dispatchEvent(CEventServer &event)
Deallocate buffers allocated by clientContexts.
static bool isServer
Check if xios is server.
static ENodeType GetType(void)
static bool dispatchEvent(CEventServer &event)
static CTimer & get(std::string name)
static ENodeType GetType(void)
void dispatchEvent(CEventServer &event)
map< int, MPI_Request > pendingRequest
void setPendingEvent(void)
void finalize(void)
Terminate a context.
static ENodeType GetType(void)
static bool dispatchEvent(CEventServer &event)
void registerEvent(const size_t timeLine, const size_t contextHashId)
public interface for registring an event from the server