Ignore:
Timestamp:
01/23/19 10:31:44 (3 years ago)
Author:
yushan
Message:

dev on ADA. add flag switch _usingEP/_usingMPI

File:
1 edited

Legend:

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

    r1533 r1642  
    44#include "tracer.hpp" 
    55 
    6 using namespace ep_lib; 
    7  
    86namespace xios 
    97{ 
    108  
    119  
    12   CEventScheduler::CEventScheduler(const MPI_Comm& comm)  
    13   { 
    14     MPI_Comm_dup(comm, &communicator) ; 
    15     MPI_Comm_size(communicator,&mpiSize) ; 
    16     MPI_Comm_rank(communicator,&mpiRank); 
     10  CEventScheduler::CEventScheduler(const ep_lib::MPI_Comm& comm)  
     11  { 
     12    ep_lib::MPI_Comm_dup(comm, &communicator) ; 
     13    ep_lib::MPI_Comm_size(communicator,&mpiSize) ; 
     14    ep_lib::MPI_Comm_rank(communicator,&mpiRank); 
    1715 
    1816 
     
    9088 
    9189    pendingSentParentRequest.push(sentRequest) ; 
    92     MPI_Isend(sentRequest->buffer,3, MPI_UNSIGNED_LONG, parent[lev], 0, communicator, &sentRequest->request) ; 
     90    ep_lib::MPI_Isend(sentRequest->buffer,3, EP_UNSIGNED_LONG, parent[lev], 0, communicator, &sentRequest->request) ; 
    9391    traceOn() ; 
    9492  }  
     
    117115  { 
    118116    int completed ; 
    119     MPI_Status status ; 
     117    ep_lib::MPI_Status status ; 
    120118    int received ; 
    121119    SPendingRequest* recvRequest ; 
     
    137135    while(received) 
    138136    { 
    139       MPI_Iprobe(-2,1,communicator,&received, &status) ; 
     137      #ifdef _usingMPI 
     138      MPI_Iprobe(MPI_ANY_SOURCE,1,communicator,&received, &status) ; 
     139      #elif _usingEP 
     140      ep_lib::MPI_Iprobe(-2,1,communicator,&received, &status) ; 
     141      #endif 
    140142      if (received) 
    141143      { 
    142144        recvRequest=new SPendingRequest ; 
    143         MPI_Irecv(recvRequest->buffer, 3, MPI_UNSIGNED_LONG, -2, 1, communicator, &(recvRequest->request)) ; 
     145        #ifdef _usingMPI 
     146        MPI_Irecv(recvRequest->buffer, 3, MPI_UNSIGNED_LONG, MPI_ANY_SOURCE, 1, communicator, &(recvRequest->request)) ; 
     147        #elif _usingEP 
     148        ep_lib::MPI_Irecv(recvRequest->buffer, 3, EP_UNSIGNED_LONG, -2, 1, communicator, &(recvRequest->request)) ; 
     149        #endif 
    144150        pendingRecvParentRequest.push(recvRequest) ; 
    145151      } 
     
    151157    { 
    152158      recvRequest=pendingRecvParentRequest.front() ; 
    153       MPI_Test( &(recvRequest->request), &completed, &status) ; 
     159      ep_lib::MPI_Test( &(recvRequest->request), &completed, &status) ; 
    154160      if (completed)  
    155161      { 
     
    171177// function call only by parent mpi process 
    172178 
    173     MPI_Status status ;  
     179    ep_lib::MPI_Status status ;  
    174180    int received ; 
    175181    received=true ; 
     
    179185    while(received) 
    180186    { 
    181       MPI_Iprobe(-2,0,communicator,&received, &status) ; 
     187      #ifdef _usingMPI 
     188      MPI_Iprobe(MPI_ANY_SOURCE,0,communicator,&received, &status) ; 
     189      #elif _usingEP 
     190      ep_lib::MPI_Iprobe(-2,0,communicator,&received, &status) ; 
     191      #endif 
    182192      if (received) 
    183193      { 
    184194        recvRequest=new SPendingRequest ; 
    185         MPI_Irecv(recvRequest->buffer, 3, MPI_UNSIGNED_LONG, -2, 0, communicator, &recvRequest->request) ; 
     195        #ifdef _usingMPI 
     196        MPI_Irecv(recvRequest->buffer, 3, MPI_UNSIGNED_LONG, MPI_ANY_SOURCE, 0, communicator, &recvRequest->request) ; 
     197        #elif _usingEP 
     198        ep_lib::MPI_Irecv(recvRequest->buffer, 3, EP_UNSIGNED_LONG, -2, 0, communicator, &recvRequest->request) ; 
     199        #endif 
    186200        pendingRecvChildRequest.push_back(recvRequest) ; 
    187201      } 
     
    192206    for(list<SPendingRequest*>::iterator it=pendingRecvChildRequest.begin(); it!=pendingRecvChildRequest.end() ; ) 
    193207    { 
    194       MPI_Test(&((*it)->request),&received,&status) ; 
     208      ep_lib::MPI_Test(&((*it)->request),&received,&status) ; 
    195209      if (received) 
    196210      { 
     
    230244    for(list<SPendingRequest*>::iterator it=pendingSentChildRequest.begin(); it!=pendingSentChildRequest.end() ; ) 
    231245    { 
    232       MPI_Test(&(*it)->request,&received,&status) ; 
     246      ep_lib::MPI_Test(&(*it)->request,&received,&status) ; 
    233247      if (received) 
    234248      { 
     
    253267      sentRequest->buffer[1]=contextHashId ; 
    254268      sentRequest->buffer[2]=lev+1 ; 
    255       MPI_Isend(sentRequest->buffer,3, MPI_UNSIGNED_LONG, child[lev][i], 1, communicator, & sentRequest->request) ; 
     269      ep_lib::MPI_Isend(sentRequest->buffer,3, EP_UNSIGNED_LONG, child[lev][i], 1, communicator, & sentRequest->request) ; 
    256270      pendingSentChildRequest.push_back(sentRequest) ; 
    257271    } 
Note: See TracChangeset for help on using the changeset viewer.