Changeset 1081


Ignore:
Timestamp:
03/31/17 20:26:21 (7 years ago)
Author:
yushan
Message:

save current modifications

Location:
XIOS/dev/branch_yushan
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan/bld.cfg

    r1080 r1081  
    3636#bld::target test_remap.exe 
    3737#bld::target test_new_features.exe test_unstruct_complete.exe  
    38 bld::target test_omp.exe #test_client.exe #test_complete.exe  
     38bld::target test_omp.exe test_client.exe #test_complete.exe  
    3939bld::exe_dep 
    4040 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_split.cpp

    r1056 r1081  
    167167      { 
    168168        *newcomm = comm.ep_comm_ptr->comm_list->mem_bridge[new_ep_rank_loc]; 
    169 //        newcomm = &(comm.ep_comm_ptr->comm_list->mem_bridge[new_ep_rank_loc]); 
     169 //       newcomm = &(comm.ep_comm_ptr->comm_list->mem_bridge[new_ep_rank_loc]); 
    170170        (*newcomm).ep_comm_ptr->comm_label = color; 
    171171      } 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_type.hpp

    r1068 r1081  
    174174    } 
    175175 
     176    // ep_intercomm(ep_intercomm &ref) 
     177    // { 
     178    //   printf("calling copy Constructor of ep_intercomm\n"); 
     179    //   ep_intercomm return_intercomm; 
     180 
     181    //   return_intercomm.mpi_inter_comm = ref.mpi_inter_comm; 
     182    //   return_intercomm.intercomm_rank_map = ref.intercomm_rank_map; 
     183    //   return_intercomm.local_rank_map = ref.local_rank_map; 
     184    //   return_intercomm.remote_rank_map = ref.remote_rank_map; 
     185    //   return_intercomm.size_rank_info[0] = ref.size_rank_info[0]; 
     186    //   return_intercomm.size_rank_info[1] = ref.size_rank_info[1]; 
     187    //   return_intercomm.size_rank_info[2] = ref.size_rank_info[2]; 
     188    //   return_intercomm.local_comm = ref.local_comm; 
     189    //   return_intercomm.intercomm_tag = ref.intercomm_tag; 
     190    // } 
     191 
    176192    bool operator == (ep_intercomm right) 
    177193    { 
     
    195211      return a||b||c||d||e||f; 
    196212    } 
     213 
     214    // ep_intercomm operator = (ep_intercomm ref) 
     215    // { 
     216    //   printf("calling = operator of ep_intercomm\n"); 
     217    //   ep_intercomm return_intercomm; 
     218 
     219    //   return_intercomm.mpi_inter_comm = ref.mpi_inter_comm; 
     220    //   return_intercomm.intercomm_rank_map = ref.intercomm_rank_map; 
     221    //   return_intercomm.local_rank_map = ref.local_rank_map; 
     222    //   return_intercomm.remote_rank_map = ref.remote_rank_map; 
     223    //   return_intercomm.size_rank_info[0] = ref.size_rank_info[0]; 
     224    //   return_intercomm.size_rank_info[1] = ref.size_rank_info[1]; 
     225    //   return_intercomm.size_rank_info[2] = ref.size_rank_info[2]; 
     226    //   return_intercomm.local_comm = ref.local_comm; 
     227    //   return_intercomm.intercomm_tag = ref.intercomm_tag; 
     228    // } 
    197229  }; 
    198230 
     
    238270      return a||b||c; 
    239271    } 
     272 
     273    // ep_communicator operator = (ep_communicator ref) 
     274    // { 
     275    //   printf("calling = operator of ep_communicator\n"); 
     276    //   ep_communicator return_ep; 
     277 
     278    //   return_ep.intercomm = ref.intercomm; 
     279    //   return_ep.comm_label = ref.comm_label; 
     280    //   return_ep.message_queue = ref.message_queue; 
     281    //   return_ep.comm_list = ref.comm_list; 
     282    //   return_ep.size_rank_info[0] = ref.size_rank_info[0]; 
     283    //   return_ep.size_rank_info[1] = ref.size_rank_info[1]; 
     284    //   return_ep.size_rank_info[2] = ref.size_rank_info[2]; 
     285    // } 
    240286  }; 
    241287 
     
    340386      return a||b||c||d; 
    341387    } 
     388 
     389    // MPI_Comm operator = (MPI_Comm ref) 
     390    // { 
     391    //   printf("calling = operator of MPI_Comm\n"); 
     392    //   MPI_Comm return_comm; 
     393 
     394    //   return_comm.mpi_comm = ref.mpi_comm; 
     395    //   return_comm.is_ep = ref.is_ep; 
     396    //   return_comm.is_intercomm = ref.is_intercomm; 
     397    //   return_comm.my_buffer = ref.my_buffer; 
     398    //   return_comm.ep_barrier = ref.ep_barrier; 
     399    //   return_comm.rank_map = ref.rank_map; 
     400    //   return_comm.ep_comm_ptr = ref.ep_comm_ptr; 
     401    // } 
    342402  }; 
    343403 
  • XIOS/dev/branch_yushan/src/client.cpp

    r1080 r1081  
    4444            //MPI_Init(NULL, NULL); 
    4545            int return_level; 
    46             #ifdef _intelmpi 
    4746            MPI_Init_thread(NULL, NULL, 3, &return_level); 
    4847            assert(return_level == 3); 
    49             #elif _openmpi 
    50             MPI_Init_thread(NULL, NULL, 2, &return_level); 
    51             assert(return_level == 2); 
    52             #endif 
    5348          } 
    5449          CTimer::get("XIOS").resume() ; 
     
    5853          unsigned long hashClient=hashString(codeId) ; 
    5954          unsigned long hashServer=hashString(CXios::xiosCodeId) ; 
    60           //hashServer=hashString("xios.x") ; 
    6155          unsigned long* hashAll ; 
    6256          int size ; 
     
    6660          MPI_Comm_size(CXios::globalComm,&size); 
    6761          MPI_Comm_rank(CXios::globalComm,&rank); 
    68  
    69           printf("client init : rank = %d, size = %d\n", rank, size); 
    70            
     62        
    7163 
    7264          hashAll=new unsigned long[size] ; 
     
    120112            MPI_Intercomm_create(intraComm,0,CXios::globalComm,serverLeader,0,&interComm) ; 
    121113 
    122             int interCommSize, interCommRank ; 
    123             MPI_Comm_size(interComm,&interCommSize) ; 
    124             MPI_Comm_rank(interComm,&interCommRank) ; 
    125  
    126             #pragma omp critical(_output) 
    127             { 
    128               info(50)<<" interCommRank :"<<interCommRank 
    129                  <<" interCommSize : "<< interCommSize << endl ;   
    130             } 
    131  
    132  
    133114          } 
    134115          else 
     
    186167    void CClient::registerContext(const string& id,MPI_Comm contextComm) 
    187168    { 
     169      //#pragma omp critical(_output) 
    188170      //info(50) << "Client "<<getRank() << " start registerContext using info output" << endl; 
    189       printf("Client %d start registerContext\n", getRank()); 
    190       //printf("Client start registerContext\n"); 
    191171 
    192172      CContext::setCurrent(id) ; 
    193       printf("Client %d CContext::setCurrent OK\n", getRank()); 
    194173      CContext* context = CContext::create(id); 
    195       printf("Client %d context=CContext::create(%s) OK, *context = %p\n", getRank(), id, &(*context)); 
     174       
     175      #pragma omp critical (_output) 
     176      printf("Client::registerContext context add = %p\n", &(*context)); 
     177       
    196178       
    197179      StdString idServer(id); 
     
    201183      {       
    202184        int size,rank,globalRank ; 
    203         size_t message_size ; 
    204         int leaderRank ; 
     185        //size_t message_size ; 
     186        //int leaderRank ; 
    205187        MPI_Comm contextInterComm ; 
    206188 
     
    238220 
    239221        #pragma omp critical (_output) 
    240         printf("Client %d : MPI_Intercomm_merge OK \n", getRank()) ; 
    241          
     222        printf("Client %d context=CContext::create(%s) OK, context.identifier = %d\n", getRank(), id, context->get_identifier()); 
    242223         
    243224        context->initClient(contextComm,contextInterComm) ; 
     225         
    244226        #pragma omp critical (_output) 
    245227        printf("Client %d : context->initClient(contextComm,contextInterComm) OK \n", getRank()) ; 
     
    299281      } 
    300282       
    301       info(20) << "Client side context is finalized"<<endl ; 
    302       report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ; 
    303       report(0)<< " Performance report : time spent for waiting free buffer : "<< CTimer::get("Blocking time").getCumulatedTime()<<" s"<<endl ; 
    304       report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS").getCumulatedTime()*100.<<" %"<<endl ; 
    305       report(0)<< " Performance report : This ratio must be close to zero. Otherwise it may be usefull to increase buffer size or numbers of server"<<endl ; 
    306 //      report(0)<< " Memory report : Current buffer_size : "<<CXios::bufferSize<<endl ; 
    307       report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ; 
    308       report(0)<< " Memory report : increasing it by a factor will increase performance, depending of the volume of data wrote in file at each time step of the file"<<endl ; 
     283       
     284        //info(20) << "Client "<<rank<<" : Client side context is finalized "<< endl ; 
     285//         report(0) <<"     Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ; 
     286//         report(0)<< "     Performance report : time spent for waiting free buffer : "<< CTimer::get("Blocking time").getCumulatedTime()<<" s"<<endl ; 
     287//         report(0)<< "     Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS").getCumulatedTime()*100.<<" %"<<endl ; 
     288//         report(0)<< "     Performance report : This ratio must be close to zero. Otherwise it may be usefull to increase buffer size or numbers of server"<<endl ; 
     289// //      report(0)<< "     Memory report : Current buffer_size : "<<CXios::bufferSize<<endl ; 
     290//         report(0)<< "     Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ; 
     291//         report(0)<< "     Memory report : increasing it by a factor will increase performance, depending of the volume of data wrote in file at each time step of the file"<<endl ; 
     292       
     293 
    309294   } 
    310295 
     
    335320 
    336321      fileNameClient << fileName << "_" << std::setfill('0') << std::setw(numDigit) << getRank() << ext; 
    337       printf("getrank() = %d, file name = %s\n", getRank(), fileNameClient.str().c_str()); 
     322      //printf("getrank() = %d, file name = %s\n", getRank(), fileNameClient.str().c_str()); 
    338323       
    339324        fb->open(fileNameClient.str().c_str(), std::ios::out); 
  • XIOS/dev/branch_yushan/src/client.hpp

    r1080 r1081  
    2222 
    2323        static std::list<MPI_Comm> contextInterComms; 
    24         // #pragma omp threadprivate(contextInterComms) 
    2524        //std::list<MPI_Comm> contextInterComms; 
     25        static std::list<MPI_Comm> * contextInterComms_ptr; 
     26        #pragma omp threadprivate(contextInterComms_ptr) 
    2627 
    2728        static int serverLeader; 
    28         //#pragma omp threadprivate(serverLeader) 
     29        #pragma omp threadprivate(serverLeader) 
    2930 
    3031        static bool is_MPI_Initialized ; 
    31         //#pragma omp threadprivate(is_MPI_Initialized) 
     32        #pragma omp threadprivate(is_MPI_Initialized) 
    3233 
    3334        //! Get rank of the current process 
     
    5354 
    5455        static StdOFStream m_infoStream; 
    55         //#pragma omp threadprivate(m_infoStream)  
     56        #pragma omp threadprivate(m_infoStream)  
    5657 
    5758        static StdOFStream m_errorStream; 
    58         //#pragma omp threadprivate(m_errorStream) 
     59        #pragma omp threadprivate(m_errorStream) 
    5960 
    6061        static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb); 
  • XIOS/dev/branch_yushan/src/context_client.cpp

    r1070 r1081  
    1414namespace xios 
    1515{ 
     16    CContextClient::CContextClient() {} 
     17     
    1618    /*! 
    1719    \param [in] parent Pointer to context on client side 
    1820    \param [in] intraComm_ communicator of group client 
    1921    \param [in] interComm_ communicator of group server 
    20     \cxtSer [in] cxtSer Pointer to context of server side. (It is only used on case of attached mode) 
     22    \param [in] cxtSer Pointer to context of server side. (It is only used on case of attached mode) 
    2123    */ 
    2224    CContextClient::CContextClient(CContext* parent, ep_lib::MPI_Comm intraComm_, ep_lib::MPI_Comm interComm_, CContext* cxtSer) 
     
    2830      MPI_Comm_rank(intraComm, &clientRank); 
    2931      MPI_Comm_size(intraComm, &clientSize); 
    30  
     32       
    3133      int flag; 
    3234      MPI_Comm_test_inter(interComm, &flag); 
     
    3436      else  MPI_Comm_size(interComm, &serverSize); 
    3537 
     38 
    3639      if (clientSize < serverSize) 
    3740      { 
     
    5053        for (int i = 0; i < serverByClient; i++) 
    5154          ranksServerLeader.push_back(rankStart + i); 
     55 
     56         
    5257      } 
    5358      else 
     
    6772            ranksServerLeader.push_back(remain + rank / clientByServer); 
    6873        } 
     74 
     75        printf("clientRank = %d (%p)\n", clientRank, &clientRank); 
    6976      } 
    7077 
  • XIOS/dev/branch_yushan/src/context_client.hpp

    r1053 r1081  
    3131    public: 
    3232      // Contructor 
     33      CContextClient(); 
    3334      CContextClient(CContext* parent, ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* parentServer = 0); 
    3435 
  • XIOS/dev/branch_yushan/src/cxios.cpp

    r1079 r1081  
    1414namespace xios 
    1515{ 
    16   string CXios::rootFile="./iodef.xml" ; 
    17   string CXios::xiosCodeId="xios.x" ; 
    18   string CXios::clientFile="./xios_client"; 
    19   string CXios::serverFile="./xios_server"; 
     16  const string CXios::rootFile="./iodef.xml" ; 
     17  const string CXios::xiosCodeId="xios.x" ; 
     18  const string CXios::clientFile="./xios_client"; 
     19  const string CXios::serverFile="./xios_server"; 
     20  //#pragma omp threadprivate(CXios::rootFile, CXios::xiosCodeId, CXios::clientFile, CXios::serverFile) 
    2021 
    2122  bool CXios::isClient ; 
    2223  bool CXios::isServer ; 
     24  #pragma omp threadprivate(CXios::isServer, CXios::isClient) 
     25 
    2326  MPI_Comm CXios::globalComm ; 
     27  #pragma omp threadprivate(CXios::globalComm) 
    2428   
    2529  bool CXios::usingOasis ; 
    2630  bool CXios::usingServer = false; 
     31  #pragma omp threadprivate(CXios::usingOasis, CXios::usingServer) 
     32 
    2733  double CXios::bufferSizeFactor = 1.0; 
    2834  const double CXios::defaultBufferSizeFactor = 1.0; 
    2935  StdSize CXios::minBufferSize = 1024 * sizeof(double); 
     36  #pragma omp threadprivate(CXios::bufferSizeFactor, CXios::defaultBufferSizeFactor, CXios::minBufferSize) 
     37 
    3038  bool CXios::printLogs2Files; 
    3139  bool CXios::isOptPerformance = true; 
    3240  CRegistry* CXios::globalRegistry = 0; 
     41  #pragma omp threadprivate(CXios::printLogs2Files, CXios::isOptPerformance) 
     42 
    3343 
    3444  //! Parse configuration file and create some objects from it 
     
    3646  {     
    3747    set_new_handler(noMemory); 
     48     
    3849    #pragma omp critical 
    3950    { 
    4051      parseFile(rootFile);   
    4152    } 
     53    #pragma omp barrier 
    4254    parseXiosConfig(); 
    4355  } 
     
    95107    CXios::globalComm = passage[omp_get_thread_num()]; 
    96108 
    97     // int tmp_rank; 
    98     // MPI_Comm_rank(CXios::globalComm, &tmp_rank); 
    99     // if(isClient) printf("client thread %d/%d, globalComm = %p\n", omp_get_thread_num(), tmp_rank, &(CXios::globalComm)); 
     109    int tmp_rank; 
     110    MPI_Comm_rank(CXios::globalComm, &tmp_rank); 
     111    if(isClient) printf("client thread %d/%d, globalComm = %p, passage = %p\n",  
     112                         omp_get_thread_num(), tmp_rank,  
     113                         &(CXios::globalComm), passage); 
    100114    //if(isServer) printf("server thread %d/%d, globalComm = %p\n", omp_get_thread_num(), tmp_rank, &globalComm); 
    101115     
     
    122136    isServer = !usingServer; 
    123137     
    124     printf("CXios::initClientSide OK, printLogs2Files = %d\n", printLogs2Files); 
     138    //printf("CXios::initClientSide OK, printLogs2Files = %d\n", printLogs2Files); 
    125139     
    126140    if (printLogs2Files) 
    127141    { 
    128142      CClient::openInfoStream(clientFile); 
    129       CClient::openErrorStream(clientFile); 
     143      //CClient::openErrorStream(clientFile); 
    130144    } 
    131145    else 
     
    173187    std::set<StdString> parseList; 
    174188    parseList.insert("xios"); 
     189 
    175190    xml::CXMLParser::ParseFile(rootFile, parseList); 
     191 
    176192    parseXiosConfig(); 
    177193  } 
  • XIOS/dev/branch_yushan/src/cxios.hpp

    r1079 r1081  
    1818  { 
    1919    public: 
    20      static void initialize(void) ; 
    21      static void initClientSide(const string & codeId, ep_lib::MPI_Comm& localComm, ep_lib::MPI_Comm& returnComm) ; 
    22      static void initServerSide(void) ; 
    23      static void clientFinalize(void) ; 
    24      static void parseFile(const string& filename) ; 
     20      CXios(); 
     21      static void initialize(void) ; 
     22      static void initClientSide(const string & codeId, ep_lib::MPI_Comm& localComm, ep_lib::MPI_Comm& returnComm) ; 
     23      static void initServerSide(void) ; 
     24      static void clientFinalize(void) ; 
     25      static void parseFile(const string& filename) ; 
    2526 
    26      template <typename T> 
    27      static T getin(const string& id,const T& defaultValue) ; 
     27      template <typename T> 
     28      static T getin(const string& id,const T& defaultValue) ; 
    2829 
    29      template <typename T> 
    30      static T getin(const string& id) ; 
     30      template <typename T> 
     31      static T getin(const string& id) ; 
    3132 
    3233    public: 
    33      static string rootFile ; //!< Configuration filename 
    34      //#pragma omp threadprivate(rootFile) 
     34      static const string rootFile; //!< Configuration filename 
    3535 
    36      static string xiosCodeId ; //!< Identity for XIOS 
    37      //#pragma omp threadprivate(xiosCodeId) 
     36      static const string xiosCodeId ; //!< Identity for XIOS 
    3837 
    39      static string clientFile; //!< Filename template for client 
    40      //#pragma omp threadprivate(clientFile) 
     38      static const string clientFile; //!< Filename template for client 
    4139 
    42      static string serverFile; //!< Filename template for server 
    43      //#pragma omp threadprivate(serverFile) 
     40      static const string serverFile; //!< Filename template for server 
    4441 
    45      static bool isClient ; //!< Check if xios is client 
    46      //#pragma omp threadprivate(isClient) 
     42      static bool isClient ; //!< Check if xios is client 
    4743 
    48      static bool isServer ; //!< Check if xios is server 
    49      //#pragma omp threadprivate(isServer) 
     44      static bool isServer ; //!< Check if xios is server 
    5045 
    51      static MPI_Comm globalComm ; //!< Global communicator 
    52      #pragma omp threadprivate(globalComm) 
     46      #pragma omp threadprivate(isClient, isServer) 
    5347 
    54      static bool printLogs2Files; //!< Printing out logs into files 
    55      //#pragma omp threadprivate(printLogs2Files) 
     48      static MPI_Comm globalComm ; //!< Global communicator 
     49      #pragma omp threadprivate(globalComm) 
    5650 
    57      static bool usingOasis ; //!< Using Oasis 
    58      //#pragma omp threadprivate(usingOasis) 
     51      static bool printLogs2Files; //!< Printing out logs into files 
    5952 
    60      static bool usingServer ; //!< Using server (server mode) 
    61      //#pragma omp threadprivate(usingServer) 
     53      static bool usingOasis ; //!< Using Oasis 
    6254 
    63      static double bufferSizeFactor; //!< Factor used to tune the buffer size 
    64      //#pragma omp threadprivate(bufferSizeFactor) 
     55      static bool usingServer ; //!< Using server (server mode) 
    6556 
    66      static const double defaultBufferSizeFactor; //!< Default factor value 
    67      //#pragma omp threadprivate(defaultBufferSizeFactor) 
     57      static double bufferSizeFactor; //!< Factor used to tune the buffer size 
    6858 
    69      static StdSize minBufferSize; //!< Minimum buffer size 
    70      //#pragma omp threadprivate(minBufferSize) 
     59      static const double defaultBufferSizeFactor; //!< Default factor value 
    7160 
    72      static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible) 
    73      //#pragma omp threadprivate(isOptPerformance) 
     61      static StdSize minBufferSize; //!< Minimum buffer size 
    7462 
    75      static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers 
    76      //#pragma omp threadprivate(globalRegistry) 
     63      static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible) 
    7764 
     65      #pragma omp threadprivate(printLogs2Files, usingOasis, usingServer, bufferSizeFactor, minBufferSize, isOptPerformance) 
     66       
     67      static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers 
     68 
     69       
     70       
    7871    public: 
    7972     //! Setting xios to use server mode 
  • XIOS/dev/branch_yushan/src/interface/c/icdata.cpp

    r1074 r1081  
    129129     CTimer::get("XIOS context finalize").resume(); 
    130130      
    131      printf("Check : calling cxios_context_finalize\n"); 
     131      
    132132     CContext* context = CContext::getCurrent(); 
     133     printf("Check : CContext::getCurrent() = %p\n", CContext::getCurrent()); 
    133134     context->finalize(); 
    134135           
  • XIOS/dev/branch_yushan/src/log.hpp

    r523 r1081  
    2626    } 
    2727    void setLevel(int l) {level=l; } 
    28     int getLevel() {return level ;} 
     28    int  getLevel() {return level ;} 
    2929    bool isActive(void) { if (rdbuf()==NULL) return true ; else return false ;} 
    3030    bool isActive(int l) {if (l<=level) return true ; else return false ; } 
  • XIOS/dev/branch_yushan/src/node/context.cpp

    r1080 r1081  
    239239   { 
    240240     hasClient=true; 
    241      client = new CContextClient(this,intraComm, interComm, cxtServer); 
     241      
     242     #pragma omp critical 
     243     client = new CContextClient(this, intraComm, interComm, cxtServer); 
     244 
    242245 
    243246     int tmp_rank; 
     
    245248     MPI_Barrier(intraComm); 
    246249      
     250     #pragma omp critical 
     251     registryIn=new CRegistry(intraComm); 
    247252      
     253 
     254     registryIn->setPath(getId()) ; 
    248255      
    249      registryIn=new CRegistry(intraComm); 
    250  
    251256     #pragma omp critical (_output) 
    252      printf("Client %d : registryIn=new CRegistry(intraComm), &registryIn = %p, registryIn = %p \n", tmp_rank, &registryIn, registryIn) ; 
    253  
    254      // registryIn=new CRegistry; 
    255      // registryIn->communicator = intraComm; 
    256      registryIn->setPath(getId()) ; 
     257     printf("Client %d : registryIn->setPath(getId()=%s), clientRank = %d (%p) \n", tmp_rank, getId(), client->clientRank, &(client->clientRank)) ; 
     258     printf("Client %d : context.identifier = %d\n", tmp_rank, this->get_identifier()); 
     259 
    257260     if (client->clientRank==0) registryIn->fromFile("xios_registry.bin") ; 
    258261     registryIn->bcastRegistry() ; 
     
    260263     registryOut=new CRegistry(intraComm) ; 
    261264     registryOut->setPath(getId()) ; 
     265      
    262266     #pragma omp critical (_output) 
    263      printf("Client %d : registryOut->setPath(getId()) \n", tmp_rank) ; 
     267     printf("Client %d : registryOut->setPath(getId()=%s) \n", tmp_rank, getId()) ; 
    264268 
    265269     ep_lib::MPI_Comm intraCommServer, interCommServer; 
     
    11921196  */ 
    11931197   //bkp 
    1194 //   CContext* CContext::create(const StdString& id) 
    1195 //   { 
    1196 //     CContext::setCurrent(id); 
    1197  
    1198 //     bool hasctxt = CContext::has(id); 
    1199 //     CContext* context = CObjectFactory::CreateObject<CContext>(id).get(); 
    1200 //     getRoot(); 
    1201 //     if (!hasctxt) CGroupFactory::AddChild(root, context->getShared()); 
    1202  
    1203 // #define DECLARE_NODE(Name_, name_) \ 
    1204 //     C##Name_##Definition::create(C##Name_##Definition::GetDefName()); 
    1205 // #define DECLARE_NODE_PAR(Name_, name_) 
    1206 // #include "node_type.conf" 
    1207  
    1208 //     return (context); 
    1209 //   } 
    1210  
    1211  
    12121198  CContext* CContext::create(const StdString& id) 
    12131199  { 
    12141200    CContext::setCurrent(id); 
    12151201 
    1216  
    12171202    bool hasctxt = CContext::has(id); 
    1218     CContext* context[omp_get_num_threads()]; 
    1219     for(int i=0; i<omp_get_num_threads(); i++) 
    1220     { 
    1221  
    1222      context[i] = CObjectFactory::CreateObject<CContext>(id).get(); 
    1223      getRoot(); 
    1224      if (!hasctxt) CGroupFactory::AddChild(root, context[i]->getShared()); 
     1203    CContext* context = CObjectFactory::CreateObject<CContext>(id).get(); 
     1204    getRoot(); 
     1205    if (!hasctxt) CGroupFactory::AddChild(root, context->getShared()); 
    12251206 
    12261207#define DECLARE_NODE(Name_, name_) \ 
    1227      C##Name_##Definition::create(C##Name_##Definition::GetDefName()); 
     1208    C##Name_##Definition::create(C##Name_##Definition::GetDefName()); 
    12281209#define DECLARE_NODE_PAR(Name_, name_) 
    12291210#include "node_type.conf" 
    1230     } 
    1231     int tmp_rank; 
    1232     MPI_Comm_rank(MPI_COMM_WORLD, &tmp_rank); 
    1233     printf("CContext::create : num_threads = %d, my_id = %d, return add = %p\n", omp_get_num_threads(), tmp_rank, &(context[omp_get_thread_num()])); 
    1234      
    1235     return (context[omp_get_thread_num()]); 
     1211 
     1212    return (context); 
    12361213  } 
     1214 
     1215  int CContext::get_identifier() 
     1216  { 
     1217    return this->identifier; 
     1218  } 
     1219 
    12371220 
    12381221     //! Server side: Receive a message to do some post processing 
  • XIOS/dev/branch_yushan/src/node/context.hpp

    r1080 r1081  
    222222         // Concrete contex client 
    223223         CContextClient* client; 
     224 
     225 
    224226         CRegistry* registryIn ;  //!< input registry which is read from file 
    225227         CRegistry* registryOut ; //!< output registry which will be wrote on file at the finalize 
    226          //#pragma omp threadprivate(registryIn, registryOut) 
     228          
    227229 
    228230      private: 
     
    233235         std::list<ep_lib::MPI_Comm> comms; //!< Communicators allocated internally 
    234236 
     237         int identifier; 
     238 
    235239      public: // Some function maybe removed in the near future 
     240         int get_identifier(); 
    236241        // virtual void toBinary  (StdOStream & os) const; 
    237242        // virtual void fromBinary(StdIStream & is); 
  • XIOS/dev/branch_yushan/src/object_template.hpp

    r731 r1081  
    104104 
    105105         static xios_map< StdString, long int > GenId ; 
     106         //#pragma omp threadprivate(AllMapObj, AllVectObj, GenId) 
    106107 
    107108   }; // class CObjectTemplate 
  • XIOS/dev/branch_yushan/src/registry.hpp

    r1080 r1081  
    2828/** Constructor, the communicator is used for bcast or gather operation between MPI processes */ 
    2929      
    30       //CRegistry(const ep_lib::MPI_Comm& comm=MPI_COMM_WORLD) : communicator(comm) {} 
    31       CRegistry(const ep_lib::MPI_Comm& comm=MPI_COMM_WORLD) 
    32       { 
    33         communicator = comm; 
    34       } 
     30      CRegistry(const ep_lib::MPI_Comm& comm=MPI_COMM_WORLD) : communicator(comm) {} 
     31      // CRegistry(const ep_lib::MPI_Comm& comm=MPI_COMM_WORLD) 
     32      // { 
     33      //   communicator = comm; 
     34 
     35      //   int tmp_rank; 
     36      //   MPI_Comm_rank(comm, &tmp_rank); 
     37      //   printf("rank %d (%d): constructor on address %p, ref_comm = %p\n", tmp_rank, omp_get_thread_num(), &communicator, &comm); 
     38      // } 
    3539       
    3640      
  • XIOS/dev/branch_yushan/src/test/test_client.f90

    r1079 r1081  
    3737  CALL init_wait 
    3838 
    39   !CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
    40   !if(rank < 2) then 
     39  CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
     40  if(rank < 2) then 
    4141 
    4242   
     
    153153  print *, "Client : xios_finalize " 
    154154 
    155 !    else 
     155    else 
    156156 
    157 !    CALL xios_init_server 
    158 !    print *, "Server : xios_finalize " 
     157    CALL xios_init_server 
     158    print *, "Server : xios_finalize " 
    159159   
    160 !    endif 
     160    endif 
    161161     
    162162 
  • XIOS/dev/branch_yushan/src/test/test_omp.f90

    r1080 r1081  
    3535!!! MPI Initialization    
    3636 
    37   CALL MPI_INIT_THREAD(3, provided, ierr) 
    38   print*, "provided = ", provided 
    39    
    40   CALL init_wait 
    41  
    42   CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
    43   if(rank < 2) then 
    44  
    45   !$omp parallel default(private) 
    46    
    47   CALL xios_initialize(id,return_comm=comm) 
    48    
    49   CALL MPI_COMM_RANK(comm,rank,ierr) 
    50   CALL MPI_COMM_SIZE(comm,size,ierr) 
    51  
    52   size = size*omp_get_num_threads() 
    53   rank = rank*omp_get_num_threads() + omp_get_thread_num() 
    54  
    55   DO j=1,nj_glo 
    56     DO i=1,ni_glo 
    57       lon_glo(i,j)=(i-1)+(j-1)*ni_glo 
    58       lat_glo(i,j)=1000+(i-1)+(j-1)*ni_glo 
    59       DO l=1,llm 
    60         field_A_glo(i,j,l)=(i-1)+(j-1)*ni_glo+10000*l 
     37    CALL MPI_INIT_THREAD(3, provided, ierr) 
     38    if(provided .NE. 3) then 
     39      print*, "provided thread level = ", provided 
     40      call MPI_Abort() 
     41    endif 
     42 
     43    CALL init_wait 
     44 
     45    CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
     46    if(rank < 2) then 
     47 
     48    !$omp parallel default(private) 
     49   
     50    CALL xios_initialize(id,return_comm=comm) 
     51   
     52    CALL MPI_COMM_RANK(comm,rank,ierr) 
     53    CALL MPI_COMM_SIZE(comm,size,ierr) 
     54 
     55    size = size*omp_get_num_threads() 
     56    rank = rank*omp_get_num_threads() + omp_get_thread_num() 
     57 
     58    DO j=1,nj_glo 
     59      DO i=1,ni_glo 
     60        lon_glo(i,j)=(i-1)+(j-1)*ni_glo 
     61        lat_glo(i,j)=1000+(i-1)+(j-1)*ni_glo 
     62        DO l=1,llm 
     63          field_A_glo(i,j,l)=(i-1)+(j-1)*ni_glo+10000*l 
     64        ENDDO 
    6165      ENDDO 
    6266    ENDDO 
    63   ENDDO 
    64   ni=ni_glo ; ibegin=0 
    65  
    66   jbegin=0 
    67   DO n=0,size-1 
    68     nj=nj_glo/size 
    69     IF (n<MOD(nj_glo,size)) nj=nj+1 
    70     IF (n==rank) exit 
    71     jbegin=jbegin+nj 
    72   ENDDO 
    73  
    74   iend=ibegin+ni-1 ; jend=jbegin+nj-1 
    75  
    76   ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni,nj)) 
    77   lon(:,:)=lon_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
    78   lat(:,:)=lat_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
    79   field_A(1:ni,1:nj,:)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,:) 
    80  
    81   print*, "xios init OK", rank, size 
    82  
    83  
    84    CALL xios_context_initialize("test",comm) 
    85    print*, "xios_context init OK", rank, size  
     67    ni=ni_glo ; ibegin=0 
     68 
     69    jbegin=0 
     70    DO n=0,size-1 
     71      nj=nj_glo/size 
     72      IF (n<MOD(nj_glo,size)) nj=nj+1 
     73      IF (n==rank) exit 
     74      jbegin=jbegin+nj 
     75    ENDDO 
     76 
     77    iend=ibegin+ni-1 ; jend=jbegin+nj-1 
     78 
     79    ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni,nj)) 
     80    lon(:,:)=lon_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
     81    lat(:,:)=lat_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
     82    field_A(1:ni,1:nj,:)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,:) 
     83 
     84    print*, "xios init OK", rank, size 
     85 
     86      CALL xios_context_initialize("test",comm) 
     87      print*, "xios_context init OK", rank, size  
     88 
     89!      CALL xios_context_finalize() 
     90!      print*, "xios_context finalize OK", rank, size 
     91 
     92    CALL xios_finalize() 
     93    print*, "xios finalize OK", rank, size 
     94 
     95 
     96     
     97    !$omp barrier 
     98    !call MPI_Barrier(MPI_COMM_WORLD) 
     99    !$omp barrier 
     100 
     101    call MPI_Abort() 
     102 
     103     
    86104    
    87105    CALL xios_get_handle("test",ctx_hdl) 
     
    93111    CALL xios_get_calendar_type(calendar_type) 
    94112    print*, "xios_get_calendar_type OK", rank, size  
    95  
    96   !CALL xios_context_finalize()   
    97   !print*, "xios_context finalize OK", rank, size  
     113     
     114     
     115    CALL xios_set_axis_attr("axis_A",n_glo=llm ,value=lval) ; 
     116    CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj,type='curvilinear') 
     117    CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4) 
     118    CALL xios_set_domain_attr("domain_A",lonvalue_2D=lon,latvalue_2D=lat) 
     119    CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.) 
     120 
     121    CALL xios_get_handle("field_definition",fieldgroup_hdl) 
     122    CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B") 
     123    CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B") 
     124 
     125    CALL xios_get_handle("output",file_hdl) 
     126    CALL xios_add_child(file_hdl,field_hdl) 
     127    CALL xios_set_attr(field_hdl,field_ref="field_A_zoom",name="field_C") 
     128   
     129    dtime%second = 3600 
     130    CALL xios_set_timestep(dtime) 
     131    print*, "xios_set_timestep OK", rank, size  
     132 
     133    CALL xios_get_time_origin(date) 
     134     
     135    PRINT *, "--> year length = ", xios_get_year_length_in_seconds(date%year) 
     136    PRINT *, "--> day length = ", xios_get_day_length_in_seconds() 
     137    CALL xios_date_convert_to_string(date, date_str) 
     138    PRINT *, "time_origin = ", date_str 
     139    PRINT *, "xios_date_get_second_of_year(time_origin) = ", xios_date_get_second_of_year(date) 
     140    PRINT *, "xios_date_get_day_of_year(time_origin) = ", xios_date_get_day_of_year(date) 
     141    PRINT *, "xios_date_get_fraction_of_year(time_origin) = ", xios_date_get_fraction_of_year(date) 
     142    PRINT *, "xios_date_get_second_of_day(time_origin) = ", xios_date_get_second_of_day(date) 
     143    PRINT *, "xios_date_get_fraction_of_day(time_origin) = ", xios_date_get_fraction_of_day(date) 
     144    dtime%timestep = 1 
     145    dtime = 0.5 * dtime 
     146    CALL xios_duration_convert_to_string(dtime, dtime_str) 
     147    PRINT *, "duration = ", dtime_str 
     148    date = date + 3 * (dtime + dtime) 
     149    CALL xios_date_convert_to_string(date, date_str) 
     150    PRINT *, "date = time_origin + 3 * (duration + duration) = ", date_str 
     151    PRINT *, "xios_date_convert_to_seconds(date) = ", xios_date_convert_to_seconds(date) 
     152    PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour) 
     153 
     154    ni=0 ; lonvalue(:,:)=0; 
     155    CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue_2D=lonvalue) 
     156    print *,"ni",ni 
     157 
     158    CALL xios_is_defined_field_attr("field_A",enabled=ok) 
     159    PRINT *,"field_A : attribute enabled is defined ? ",ok 
     160 
     161 
     162!   CALL xios_close_context_definition() 
     163   
     164!   print*, "xios_close_context_definition OK", rank, size  
    98165 
    99166 
Note: See TracChangeset for help on using the changeset viewer.