Ignore:
Timestamp:
03/22/18 10:43:20 (6 years ago)
Author:
yushan
Message:

branch_openmp merged with XIOS_DEV_CMIP6@1459

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/src/context_server.cpp

    r1342 r1460  
    2929    MPI_Comm_size(intraComm,&intraCommSize); 
    3030    MPI_Comm_rank(intraComm,&intraCommRank); 
     31 
    3132    interComm=interComm_; 
    3233    int flag; 
     
    3435    if (flag) MPI_Comm_remote_size(interComm,&commSize); 
    3536    else  MPI_Comm_size(interComm,&commSize); 
     37 
    3638    currentTimeLine=0; 
    3739    scheduled=false; 
    3840    finished=false; 
    39  
    4041    boost::hash<string> hashString; 
    41     hashId=hashString(context->getId()); 
    42  
    43   } 
     42    if (CServer::serverLevel == 1) 
     43      hashId=hashString(context->getId() + boost::lexical_cast<string>(context->clientPrimServer.size())); 
     44    else 
     45      hashId=hashString(context->getId()); 
     46  } 
     47 
    4448  void CContextServer::setPendingEvent(void) 
    4549  { 
     
    142146  } 
    143147 
     148 
    144149  void CContextServer::checkPendingRequest(void) 
    145150  { 
     
    182187    map<size_t,CEventServer*>::iterator it; 
    183188 
     189    CTimer::get("Process request").resume(); 
    184190    while(count>0) 
    185191    { 
     
    195201      count=buffer.remain(); 
    196202    } 
    197  
     203    CTimer::get("Process request").suspend(); 
    198204  } 
    199205 
     
    241247  } 
    242248 
    243  
    244249  void CContextServer::dispatchEvent(CEventServer& event) 
    245250  { 
     
    249254    int rank; 
    250255    list<CEventServer::SSubEvent>::iterator it; 
    251     CContext::setCurrent(context->getId()); 
     256    StdString ctxId = context->getId(); 
     257    CContext::setCurrent(ctxId); 
     258    StdSize totalBuf = 0; 
    252259 
    253260    if (event.classId==CContext::GetType() && event.type==CContext::EVENT_ID_CONTEXT_FINALIZE) 
     
    255262      finished=true; 
    256263      #pragma omp critical (_output) 
    257       info(20)<<"Server Side context <"<<context->getId()<<"> finalized"<<endl; 
     264      info(20)<<" CContextServer: Receive context <"<<context->getId()<<"> finalize."<<endl; 
     265      context->finalize(); 
    258266      std::map<int, StdSize>::const_iterator itbMap = mapBufferSize_.begin(), 
    259                                              iteMap = mapBufferSize_.end(), itMap; 
    260       StdSize totalBuf = 0; 
     267                           iteMap = mapBufferSize_.end(), itMap; 
    261268      for (itMap = itbMap; itMap != iteMap; ++itMap) 
    262269      { 
    263         //report(10)<< " Memory report : Context <"<<context->getId()<<"> : server side : memory used for buffer of each connection to client" << endl 
    264         //          << "  +) With client of rank " << itMap->first << " : " << itMap->second << " bytes " << endl; 
     270        rank = itMap->first; 
     271        #pragma omp critical (_output) 
     272        report(10)<< " Memory report : Context <"<<ctxId<<"> : server side : memory used for buffer of each connection to client" << endl 
     273            << "  +) With client of rank " << rank << " : " << itMap->second << " bytes " << endl; 
    265274        totalBuf += itMap->second; 
    266275      } 
    267       context->finalize(); 
    268       //report(0)<< " Memory report : Context <"<<context->getId()<<"> : server side : total memory used for buffer "<<totalBuf<<" bytes"<<endl; 
     276      #pragma omp critical (_output) 
     277      report(0)<< " Memory report : Context <"<<ctxId<<"> : server side : total memory used for buffer "<<totalBuf<<" bytes"<<endl; 
    269278    } 
    270279    else if (event.classId==CContext::GetType()) CContext::dispatchEvent(event); 
Note: See TracChangeset for help on using the changeset viewer.