Ignore:
Timestamp:
11/19/18 15:52:54 (5 years ago)
Author:
yushan
Message:

branch_openmp merged with trunk r1597

File:
1 edited

Legend:

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

    r1230 r1601  
    1818#include <boost/functional/hash.hpp> 
    1919 
    20  
     20using namespace ep_lib; 
    2121 
    2222namespace xios 
     
    8181 
    8282    traceOff(); 
    83     MPI_Iprobe(MPI_ANY_SOURCE, 20,interComm,&flag,&status); 
     83    MPI_Iprobe(-2, 20,interComm,&flag,&status); 
    8484    traceOn(); 
    8585 
    8686    if (flag==true) 
    8787    { 
     88      #ifdef _usingMPI 
    8889      rank=status.MPI_SOURCE ; 
     90      #elif _usingEP 
     91      rank=status.ep_src ; 
     92      #endif 
    8993      okLoop = true; 
    9094      if (pendingRequest.find(rank)==pendingRequest.end()) 
     
    112116    char * addr; 
    113117    map<int,CServerBuffer*>::iterator it; 
     118    #ifdef _usingMPI 
    114119    int rank=status.MPI_SOURCE ; 
     120    #elif _usingEP 
     121    int rank=status.ep_src; 
     122    #endif     
    115123 
    116124    it=buffers.find(rank); 
     
    118126    { 
    119127       StdSize buffSize = 0; 
    120        MPI_Recv(&buffSize, 1, MPI_LONG, rank, 20, interComm, &status); 
     128       MPI_Request request; 
     129        
     130       MPI_Irecv(&buffSize, 1, MPI_LONG, rank, 20, interComm, &request); 
     131       MPI_Wait(&request, &status); 
    121132       mapBufferSize_.insert(std::make_pair(rank, buffSize)); 
    122133       it=(buffers.insert(pair<int,CServerBuffer*>(rank,new CServerBuffer(buffSize)))).first; 
     
    132143         bufferRequest[rank]=addr; 
    133144         return true; 
    134        } 
     145      } 
    135146      else 
    136147        return false; 
     
    253264    { 
    254265      finished=true; 
     266      #pragma omp critical (_output) 
    255267      info(20)<<" CContextServer: Receive context <"<<context->getId()<<"> finalize."<<endl; 
    256268      context->finalize(); 
     
    260272      { 
    261273        rank = itMap->first; 
     274        #pragma omp critical (_output) 
    262275        report(10)<< " Memory report : Context <"<<ctxId<<"> : server side : memory used for buffer of each connection to client" << endl 
    263276            << "  +) With client of rank " << rank << " : " << itMap->second << " bytes " << endl; 
    264277        totalBuf += itMap->second; 
    265278      } 
     279      #pragma omp critical (_output) 
    266280      report(0)<< " Memory report : Context <"<<ctxId<<"> : server side : total memory used for buffer "<<totalBuf<<" bytes"<<endl; 
    267281    } 
Note: See TracChangeset for help on using the changeset viewer.