Changeset 491


Ignore:
Timestamp:
09/26/14 14:52:09 (7 years ago)
Author:
mhnguyen
Message:

Removing using_server from iodef.xml file. From now on, XIOS is capable of dectectin automatically server mode

+) Check whether server is in the MPI global group
+) Add some more methods to set/unset using_server
+) Do some cleaning stuff

Test
+) On Curie
+) All test passed correctly without using_server id

Location:
XIOS/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/inputs/COMPLETE/iodef.xml

    r490 r491  
    11<?xml version="1.0"?> 
    2 <simulation>  
     2<simulation> 
    33 
    44  <context id="atmosphere" src="./context_atmosphere.xml"/> 
     
    1010        <variable_group id="buffer"> 
    1111            buffer_size = 80000000 
    12             buffer_server_factor_size = 2  
     12            buffer_server_factor_size = 2 
    1313         </variable_group> 
    1414 
    1515        <variable_group id="parameters" > 
    16           <variable id="using_server" type="boolean">false</variable> 
    1716          <variable id="info_level" type="int">100</variable> 
    18           <variable id="info_output_file" type="boolean">true</variable> 
     17          <variable id="print_file" type="boolean">true</variable> 
    1918        </variable_group> 
    2019      </variable_definition> 
  • XIOS/trunk/src/client.cpp

    r490 r491  
    7373          } 
    7474 
     75          // Verify whether we are on server mode or not 
     76          CXios::setNotUsingServer(); 
     77          for (i=0; i < size; ++i) 
     78          { 
     79            if (hashServer == hashAll[i]) 
     80            { 
     81              CXios::setUsingServer(); 
     82              break; 
     83            } 
     84          } 
     85 
    7586          myColor=colors[hashClient] ; 
    7687 
     
    116127        CTimer::get("XIOS init").resume() ; 
    117128 
     129          // Verify whether we are on server mode or not 
     130        CXios::setNotUsingServer(); 
     131        int interCommSize = 0, intraCommSize = 0; 
     132        oasis_get_intercomm(interComm,CXios::xiosCodeId); 
     133        MPI_Comm_size(interComm, &interCommSize); 
     134        MPI_Comm_size(intraComm, &intraCommSize); 
     135        if (interCommSize == intraCommSize) CXios::setUsingServer(); 
     136 
    118137        if (CXios::usingServer) 
    119138        { 
    120139          MPI_Status status ; 
    121             MPI_Comm_rank(intraComm,&rank) ; 
     140          MPI_Comm_rank(intraComm,&rank) ; 
    122141          oasis_get_intercomm(interComm,CXios::xiosCodeId) ; 
    123142          if (rank==0) MPI_Recv(&serverLeader,1, MPI_INT, 0, 0, interComm, &status) ; 
     
    224243       std::filebuf* fb = m_infoStream.rdbuf(); 
    225244       StdStringStream fileNameClient; 
    226        fileNameClient << fileName <<"_client_" << getRank() << ".txt"; 
     245       fileNameClient << fileName <<"_client_" << getRank() << ".out"; 
    227246       fb->open(fileNameClient.str().c_str(), std::ios::out); 
    228247       if (!fb->is_open()) 
  • XIOS/trunk/src/cxios.cpp

    r490 r491  
    2121  MPI_Comm CXios::globalComm ; 
    2222  bool CXios::usingOasis ; 
    23   bool CXios::usingServer ; 
     23  bool CXios::usingServer = false; 
    2424  size_t CXios::bufferSize ; 
    2525  double CXios::bufferServerFactorSize=2 ; 
     
    3333    set_new_handler(noMemory); 
    3434    parseFile(rootFile); 
    35     usingServer=getin<bool>("using_server",false) ; 
    3635    usingOasis=getin<bool>("using_oasis",false) ; 
    3736    info.setLevel(getin<int>("info_level",0)) ; 
    38     printInfo2File=getin<bool>("info_output_file",false); 
     37    printInfo2File=getin<bool>("print_file",false); 
    3938    bufferSize=getin<size_t>("buffer_size",defaultBufferSize) ; 
    4039    bufferServerFactorSize=getin<double>("buffer_server_factor_size",defaultBufferServerFactorSize) ; 
     
    4948 
    5049    isClient=true; 
     50 
     51    CClient::initialize(codeId,localComm,returnComm) ; 
     52 
    5153    if (usingServer) isServer=false; 
    5254    else isServer=true ; 
    53  
    54     CClient::initialize(codeId,localComm,returnComm) ; 
    5555 
    5656    if (printInfo2File) 
     
    7676    initialize(); 
    7777 
    78     if (!usingServer) ERROR("void CXios::initServerSide(void)",<<"using_server is set to <false> and server initialization is called") ; 
     78//    if (!usingServer) ERROR("void CXios::initServerSide(void)",<<"using_server is set to <false> and server initialization is called") ; 
    7979    isClient=true; 
    8080    isServer=false ; 
    8181 
    82     //! Initialize all aspect MPI 
     82    // Initialize all aspects MPI 
    8383    CServer::initialize(); 
    8484 
     
    8888      CServer::openInfoStream(); 
    8989 
    90     //! Enter the loop to listen message from Client 
     90    // Enter the loop to listen message from Client 
    9191    CServer::eventLoop(); 
    9292 
    93     //! Finalize 
     93    // Finalize 
    9494    CServer::finalize(); 
    9595    CServer::closeInfoStream(); 
     
    100100    xml::CXMLParser::ParseFile(filename); 
    101101  } 
     102 
     103  void CXios::setUsingServer() 
     104  { 
     105    usingServer = true; 
     106  } 
     107 
     108  void CXios::setNotUsingServer() 
     109  { 
     110    usingServer = false; 
     111  } 
    102112} 
  • XIOS/trunk/src/cxios.hpp

    r490 r491  
    2929     static T getin(const string& id) ; 
    3030 
    31 //     static void openFileInfo(const StdString& fileName); 
    32 //     static void closeFileInfo(); 
    33  
    3431     static bool isClient ; 
    3532     static bool isServer ; 
     
    4542     static double defaultBufferServerFactorSize ; 
    4643 
    47      private: 
    48 //     static StdOFStream infoFileStream_; 
     44     public: 
     45      //! Setting xios to use server mode 
     46      static void setUsingServer(); 
     47 
     48      //! Setting xios NOT to use server mode 
     49      static void setNotUsingServer(); 
    4950 
    5051  } ; 
  • XIOS/trunk/src/server.cpp

    r490 r491  
    405405       std::filebuf* fb = m_infoStream.rdbuf(); 
    406406       StdStringStream fileNameServer; 
    407        fileNameServer << fileName <<"_server_"<<getRank() << ".txt"; 
     407       fileNameServer << fileName <<"_server_"<<getRank() << ".out"; 
    408408       fb->open(fileNameServer.str().c_str(), std::ios::out); 
    409409       if (!fb->is_open()) 
Note: See TracChangeset for help on using the changeset viewer.