Ignore:
Timestamp:
01/23/19 10:31:44 (5 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/context_client.cpp

    r1545 r1642  
    1212#include "cxios.hpp" 
    1313#include "server.hpp" 
    14 using namespace ep_lib; 
    1514 
    1615namespace xios 
     
    2221    \cxtSer [in] cxtSer Pointer to context of server side. (It is only used in case of attached mode). 
    2322    */ 
    24     CContextClient::CContextClient(CContext* parent, MPI_Comm intraComm_, MPI_Comm interComm_, CContext* cxtSer) 
     23    CContextClient::CContextClient(CContext* parent, ep_lib::MPI_Comm intraComm_, ep_lib::MPI_Comm interComm_, CContext* cxtSer) 
    2524     : mapBufferSize_(), parentServer(cxtSer), maxBufferedEvents(4) 
    2625    { 
     
    2827      intraComm = intraComm_; 
    2928      interComm = interComm_; 
    30       MPI_Comm_rank(intraComm, &clientRank); 
    31       MPI_Comm_size(intraComm, &clientSize); 
     29      ep_lib::MPI_Comm_rank(intraComm, &clientRank); 
     30      ep_lib::MPI_Comm_size(intraComm, &clientSize); 
    3231 
    3332      int flag; 
    34       MPI_Comm_test_inter(interComm, &flag); 
    35       if (flag) MPI_Comm_remote_size(interComm, &serverSize); 
    36       else  MPI_Comm_size(interComm, &serverSize); 
     33      ep_lib::MPI_Comm_test_inter(interComm, &flag); 
     34      if (flag) ep_lib::MPI_Comm_remote_size(interComm, &serverSize); 
     35      else  ep_lib::MPI_Comm_size(interComm, &serverSize); 
    3736 
    3837      computeLeader(clientRank, clientSize, serverSize, ranksServerLeader, ranksServerNotLeader); 
     
    9695    { 
    9796      list<int> ranks = event.getRanks(); 
    98  
     97      info(100)<<"Event "<<timeLine<<" of context "<<context->getId()<<endl ; 
    9998      if (CXios::checkEventSync) 
    10099      { 
     
    102101        typeId_in=event.getTypeId() ; 
    103102        classId_in=event.getClassId() ; 
    104         MPI_Allreduce(&timeLine,&timeLine_out, 1, MPI_LONG_LONG_INT, MPI_SUM, intraComm) ; 
    105         MPI_Allreduce(&typeId_in,&typeId, 1, MPI_INT, MPI_SUM, intraComm) ; 
    106         MPI_Allreduce(&classId_in,&classId, 1, MPI_INT, MPI_SUM, intraComm) ; 
     103//        MPI_Allreduce(&timeLine,&timeLine_out, 1, MPI_UINT64_T, MPI_SUM, intraComm) ; // MPI_UINT64_T standardized by MPI 3 
     104        ep_lib::MPI_Allreduce(&timeLine,&timeLine_out, 1, EP_LONG_LONG_INT, EP_SUM, intraComm) ;  
     105        ep_lib::MPI_Allreduce(&typeId_in,&typeId, 1, EP_INT, EP_SUM, intraComm) ; 
     106        ep_lib::MPI_Allreduce(&classId_in,&classId, 1, EP_INT, EP_SUM, intraComm) ; 
    107107        if (typeId/clientSize!=event.getTypeId() || classId/clientSize!=event.getClassId() || timeLine_out/clientSize!=timeLine) 
    108108        { 
     
    124124        { 
    125125          event.send(timeLine, sizes, buffList); 
     126          info(100)<<"Event "<<timeLine<<" of context "<<context->getId()<<"  sent"<<endl ; 
    126127 
    127128          checkBuffers(ranks); 
     
    142143          info(100)<<"DEBUG : temporaly event created : timeline "<<timeLine<<endl ; 
    143144          event.send(timeLine, tmpBufferedEvent.sizes, tmpBufferedEvent.buffers); 
     145          info(100)<<"Event "<<timeLine<<" of context "<<context->getId()<<"  sent"<<endl ; 
    144146        } 
    145147      } 
     
    341343       if (ratio < minBufferSizeEventSizeRatio) minBufferSizeEventSizeRatio = ratio; 
    342344     } 
    343      MPI_Allreduce(&minBufferSizeEventSizeRatio, &minBufferSizeEventSizeRatio, 1, MPI_DOUBLE, MPI_MIN, intraComm); 
     345     #ifdef _usingMPI 
     346     ep_lib::MPI_Allreduce(MPI_IN_PLACE, &minBufferSizeEventSizeRatio, 1, EP_DOUBLE, EP_MIN, intraComm); 
     347     #elif _usingEP 
     348     ep_lib::MPI_Allreduce(&minBufferSizeEventSizeRatio, &minBufferSizeEventSizeRatio, 1, EP_DOUBLE, EP_MIN, intraComm); 
     349     #endif 
    344350 
    345351     if (minBufferSizeEventSizeRatio < 1.0) 
     
    425431      for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    426432      { 
    427         #pragma omp critical (_output) 
    428433        info(100)<<"DEBUG : Sent context Finalize event to rank "<<*itRank<<endl ; 
    429434        event.push(*itRank, 1, msg); 
     
    451456    for (itMap = itbMap; itMap != iteMap; ++itMap) 
    452457    { 
    453       #pragma omp critical (_output) 
    454458      report(10) << " Memory report : Context <" << context->getId() << "> : client side : memory used for buffer of each connection to server" << endl 
    455459                 << "  +) To server with rank " << itMap->first << " : " << itMap->second << " bytes " << endl; 
    456460      totalBuf += itMap->second; 
    457461    } 
    458     #pragma omp critical (_output) 
    459462    report(0) << " Memory report : Context <" << context->getId() << "> : client side : total memory used for buffer " << totalBuf << " bytes" << endl; 
    460463 
Note: See TracChangeset for help on using the changeset viewer.