Changeset 1072 for XIOS


Ignore:
Timestamp:
03/14/17 19:12:25 (7 years ago)
Author:
yushan
Message:

Using threads : modif for xios_initialize

Location:
XIOS/dev/branch_yushan
Files:
51 edited

Legend:

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

    r1067 r1072  
    3333#bld::target libxios.a  
    3434#bld::target generate_fortran_interface.exe  
    35 bld::target xios_server.exe  
    36 #test_remap.exe 
     35#bld::target xios_server.exe  
     36#bld::target test_remap.exe 
    3737#bld::target test_new_features.exe test_unstruct_complete.exe  
    38 bld::target test_client.exe test_complete.exe 
     38bld::target test_omp.exe #test_complete.exe test_client.exe 
    3939bld::exe_dep 
    4040 
     
    6363bld::excl_dep        use::netcdf 
    6464bld::excl_dep        inc::mpif.h 
     65bld::excl_dep        use::omp_lib 
  • XIOS/dev/branch_yushan/extern/remap/src/clipper.cpp

    r919 r1072  
    5252 
    5353static double const pi = 3.141592653589793238; 
     54#pragma omp threadprivate(pi) 
     55 
    5456static double const two_pi = pi *2; 
     57#pragma omp threadprivate(two_pi) 
     58 
    5559static double const def_arc_tolerance = 0.25; 
     60#pragma omp threadprivate(def_arc_tolerance) 
    5661 
    5762enum Direction { dRightToLeft, dLeftToRight }; 
    5863 
    5964static int const Unassigned = -1;  //edge not currently 'owning' a solution 
     65#pragma omp threadprivate(Unassigned) 
     66 
    6067static int const Skip = -2;        //edge that would otherwise close a path 
     68#pragma omp threadprivate(Skip) 
    6169 
    6270#define HORIZONTAL (-1.0E+40) 
  • XIOS/dev/branch_yushan/extern/remap/src/clipper.hpp

    r688 r1072  
    7373  typedef int cInt; 
    7474  static cInt const loRange = 0x7FFF; 
     75  #pragma omp threadprivate(loRange) 
     76 
    7577  static cInt const hiRange = 0x7FFF; 
     78  #pragma omp threadprivate(hiRange) 
     79 
    7680#else 
    7781  typedef signed long long cInt; 
    7882  static cInt const loRange = 0x3FFFFFFF; 
     83  #pragma omp threadprivate(loRange) 
     84 
    7985  static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL; 
     86  #pragma omp threadprivate(hiRange) 
     87   
    8088  typedef signed long long long64;     //used by Int128 class 
    8189  typedef unsigned long long ulong64; 
  • XIOS/dev/branch_yushan/extern/remap/src/inside.cpp

    r688 r1072  
    1111 
    1212static const double SNAP = 1e-11; 
     13#pragma omp threadprivate(SNAP) 
    1314 
    1415using namespace std; 
  • XIOS/dev/branch_yushan/extern/remap/src/parallel_tree.cpp

    r923 r1072  
    1616 
    1717static const int assignLevel = 2; 
     18#pragma omp threadprivate(assignLevel) 
    1819 
    1920// only the circle is packed, rest of node will be initialized on unpacking 
  • XIOS/dev/branch_yushan/extern/remap/src/timerRemap.hpp

    r694 r1072  
    2727    void print(void); 
    2828    static map<string,CTimer*> allTimer; 
     29    //#pragma omp threadprivate(allTimer) 
     30 
    2931    static double getTime(void); 
    3032    static CTimer& get(string name); 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp

    r1069 r1072  
    1919    fint = ::MPI_Comm_c2f(static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    2020    #endif 
     21     
    2122    std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 
    2223     
     
    5051    else 
    5152    {       
    52       MPI_Comm return_comm; 
    53       if(omp_get_thread_num() == 0) 
     53       
     54      #ifdef _openmpi 
     55      ::MPI_Comm base_comm = ::MPI_Comm_f2c(comm); 
     56      #elif _intelmpi 
     57      ::MPI_Comm base_comm = (::MPI_Comm)(comm); 
     58      #endif 
     59 
     60      if(base_comm != MPI_COMM_NULL_STD) 
    5461      { 
    55         #ifdef _openmpi 
    56         ::MPI_Comm base_comm = ::MPI_Comm_f2c(comm); 
    57         #elif _intelmpi 
    58         ::MPI_Comm base_comm = (::MPI_Comm)(comm); 
    59         #endif 
    60  
    61         if(base_comm != MPI_COMM_NULL_STD) 
     62        if(omp_get_thread_num() == 0) 
    6263        { 
    6364          int num_ep = omp_get_num_threads(); 
     
    6566          MPI_Info info; 
    6667          MPI_Comm_create_endpoints(base_comm, num_ep, info, new_comm); 
    67           return_comm = new_comm[omp_get_thread_num()]; 
     68          passage = new_comm; 
    6869        } 
    69         return MPI_COMM_NULL; 
     70        #pragma omp barrier 
     71 
     72        MPI_Comm return_comm = passage[omp_get_thread_num()]; 
     73        return return_comm; 
     74         
    7075      } 
     76      return MPI_COMM_NULL; 
    7177       
    72        
    73       return return_comm; 
    7478    } 
    7579  } 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_kernel.cpp

    r1068 r1072  
    420420            *newintercomm =  iter->second[my_position]; 
    421421            found = true; 
    422             tag_list.erase(iter); 
    423422            break; 
    424423          } 
     
    428427 
    429428    MPI_Barrier_local(local_comm); 
    430     // if(is_proc_master) 
    431     // { 
    432     //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
    433     //   { 
    434     //     if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1]))) 
    435     //     { 
    436     //       tag_list.erase(iter); 
    437     //       break; 
    438     //     } 
    439     //   } 
    440     // } 
     429    if(is_proc_master) 
     430    { 
     431      for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
     432      { 
     433        if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1]))) 
     434        { 
     435          tag_list.erase(iter); 
     436          break; 
     437        } 
     438      } 
     439    } 
    441440 
    442441    int intercomm_ep_rank, intercomm_ep_rank_loc, intercomm_mpi_rank; 
     
    687686            *newintercomm =  iter->second[my_position]; 
    688687            found = true; 
     688            // tag_list.erase(iter); 
     689            break; 
     690          } 
     691        } 
     692      } 
     693    } 
     694 
     695    MPI_Barrier_local(local_comm); 
     696 
     697    if(leader_rank_in_peer[0] < leader_rank_in_peer[1]) 
     698    { 
     699      for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
     700        { 
     701          if((*iter).first == make_pair(tag_label[0], tag_label[1])) 
     702          { 
    689703            tag_list.erase(iter); 
    690704            break; 
    691705          } 
    692706        } 
    693       } 
    694     } 
    695  
    696     // if(leader_rank_in_peer[0] < leader_rank_in_peer[1]) 
    697     // { 
    698     //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
    699     //     { 
    700     //       if((*iter).first == make_pair(tag_label[0], tag_label[1])) 
    701     //       { 
    702     //         tag_list.erase(iter); 
    703     //       } 
    704     //     } 
    705     // } 
     707    } 
    706708 
    707709 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_world.cpp

    r1067 r1072  
    417417 
    418418            found = true; 
    419             tag_list.erase(iter); 
     419            //tag_list.erase(iter); 
    420420            break; 
    421421          } 
     
    426426    MPI_Barrier_local(local_comm); 
    427427 
    428     // if(is_proc_master) 
    429     // { 
    430     //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
    431     //   { 
    432     //     if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1]))) 
    433     //     { 
    434     //       tag_list.erase(iter); 
    435     //     } 
    436     //   } 
    437     // } 
     428    if(is_proc_master) 
     429    { 
     430      for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
     431      { 
     432        if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1]))) 
     433        { 
     434          tag_list.erase(iter); 
     435          break; 
     436        } 
     437      } 
     438    } 
    438439 
    439440     
     
    934935 
    935936            found = true; 
    936             tag_list.erase(iter); 
     937            //tag_list.erase(iter); 
    937938            break; 
    938939          } 
     
    943944    MPI_Barrier_local(local_comm); 
    944945 
    945     // if(is_proc_master) 
    946     // { 
    947     //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
    948     //   { 
    949     //     if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1]))) 
    950     //     { 
    951     //       tag_list.erase(iter); 
    952     //     } 
    953     //   } 
    954     // } 
     946    if(is_proc_master) 
     947    { 
     948      for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
     949      { 
     950        if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1]))) 
     951        { 
     952          tag_list.erase(iter); 
     953          break; 
     954        } 
     955      } 
     956    } 
    955957 
    956958    int intercomm_ep_rank, intercomm_ep_rank_loc, intercomm_mpi_rank; 
  • XIOS/dev/branch_yushan/src/attribute_map.hpp

    r1037 r1072  
    6969            /// Propriété statique /// 
    7070            static CAttributeMap * Current; 
     71            //#pragma omp threadprivate (Current) 
    7172 
    7273      };  // class CAttributeMap 
  • XIOS/dev/branch_yushan/src/buffer_client.hpp

    r1037 r1072  
    1616    public: 
    1717      static size_t maxRequestSize; 
     18      //#pragma omp threadprivate(maxRequestSize) 
    1819 
    1920      CClientBuffer(MPI_Comm intercomm, int serverRank, StdSize bufferSize, StdSize maxBufferedEvents); 
  • XIOS/dev/branch_yushan/src/client.cpp

    r1070 r1072  
    3939          if (!is_MPI_Initialized) 
    4040          { 
    41             MPI_Init(NULL, NULL); 
     41            //MPI_Init(NULL, NULL); 
     42            int return_level; 
     43            MPI_Init_thread(NULL, NULL, 3, &return_level); 
     44            assert(return_level == 3); 
    4245          } 
    4346          CTimer::get("XIOS").resume() ; 
     
    4649 
    4750          unsigned long hashClient=hashString(codeId) ; 
    48           unsigned long hashServer=hashString(CXios::xiosCodeId) ; 
     51          unsigned long hashServer; //=hashString(CXios::xiosCodeId) ; 
     52          hashServer=hashString("xios.x") ; 
    4953          unsigned long* hashAll ; 
    5054          int size ; 
     
    96100            MPI_Comm_size(intraComm,&intraCommSize) ; 
    97101            MPI_Comm_rank(intraComm,&intraCommRank) ; 
    98             info(50)<<"intercommCreate::client "<<rank<<" intraCommSize : "<<intraCommSize 
    99                  <<" intraCommRank :"<<intraCommRank<<"  serverLeader "<< serverLeader<<endl ; 
     102            #pragma omp critical(_output) 
     103            { 
     104              info(50)<<"intercommCreate::client "<<rank<<" intraCommSize : "<<intraCommSize 
     105                 <<" intraCommRank :"<<intraCommRank<<"  serverLeader "<< serverLeader<<endl ;   
     106            } 
     107             
    100108            MPI_Intercomm_create(intraComm,0,CXios::globalComm,serverLeader,0,&interComm) ; 
     109 
    101110          } 
    102111          else 
     
    289298 
    290299      fileNameClient << fileName << "_" << std::setfill('0') << std::setw(numDigit) << getRank() << ext; 
    291       fb->open(fileNameClient.str().c_str(), std::ios::out); 
    292       if (!fb->is_open()) 
    293         ERROR("void CClient::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)", 
    294               << std::endl << "Can not open <" << fileNameClient << "> file to write the client log(s)."); 
     300      printf("getrank() = %d, file name = %s\n", getRank(), fileNameClient.str().c_str()); 
     301      #pragma omp critical(_output) 
     302      { 
     303        fb->open(fileNameClient.str().c_str(), std::ios::out); 
     304        if (!fb->is_open()) 
     305          ERROR("void CClient::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)", 
     306              << std::endl << "Can not open <" << fileNameClient << "> file to write the client log(s).");   
     307      } 
     308       
    295309    } 
    296310 
  • XIOS/dev/branch_yushan/src/client.hpp

    r1053 r1072  
    1919 
    2020        static MPI_Comm intraComm; 
     21        #pragma omp threadprivate(intraComm) 
     22 
    2123        static MPI_Comm interComm; 
     24        #pragma omp threadprivate(interComm) 
     25 
    2226        static std::list<MPI_Comm> contextInterComms; 
     27        // #pragma omp threadprivate(contextInterComms) 
     28 
    2329        static int serverLeader; 
     30        #pragma omp threadprivate(serverLeader) 
     31 
    2432        static bool is_MPI_Initialized ; 
     33        #pragma omp threadprivate(is_MPI_Initialized) 
    2534 
    2635        //! Get rank of the current process 
     
    4352      protected: 
    4453        static int rank; 
     54        #pragma omp threadprivate(rank) 
     55 
    4556        static StdOFStream m_infoStream; 
     57        #pragma omp threadprivate(m_infoStream)  
     58 
    4659        static StdOFStream m_errorStream; 
     60        #pragma omp threadprivate(m_errorStream) 
    4761 
    4862        static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb); 
  • XIOS/dev/branch_yushan/src/cxios.cpp

    r1070 r1072  
    2222  bool CXios::isServer ; 
    2323  MPI_Comm CXios::globalComm ; 
     24  // #pragma omp threadprivate(CXios::globalComm) 
     25 
    2426  bool CXios::usingOasis ; 
    2527  bool CXios::usingServer = false; 
     
    3537  {     
    3638    set_new_handler(noMemory); 
    37     parseFile(rootFile); 
     39    //#pragma omp critical(_output) 
     40    #pragma omp master 
     41    { 
     42      parseFile(rootFile);   
     43    } 
    3844    parseXiosConfig(); 
    3945  } 
     
    4551  void CXios::parseXiosConfig() 
    4652  { 
     53 
    4754    usingOasis=getin<bool>("using_oasis",false) ; 
    4855    usingServer=getin<bool>("using_server",false) ; 
     
    6370    bufferSizeFactor = getin<double>("buffer_size_factor", defaultBufferSizeFactor); 
    6471    minBufferSize = getin<int>("min_buffer_size", 1024 * sizeof(double)); 
    65  
     72  
    6673    int num_ep; 
    67     if(isClient)  
     74    if(isClient)   
    6875    {  
    69       num_ep = 1; 
     76      num_ep = omp_get_num_threads(); 
     77      printf("Client %d: num_ep = %d\n", omp_get_thread_num(), num_ep); 
    7078    } 
    7179     
    7280    if(isServer)  
    7381    {  
    74       num_ep = 1;  
     82      num_ep = omp_get_num_threads(); 
     83      printf("Server %d: num_ep = %d\n", omp_get_thread_num(), num_ep);  
    7584    } 
    7685     
    7786    MPI_Info info; 
    78     MPI_Comm *ep_comm; 
    79     if(omp_get_thread_num()==0) 
    80     { 
     87    #pragma omp master 
     88    { 
     89      MPI_Comm *ep_comm; 
    8190      MPI_Comm_create_endpoints(MPI_COMM_WORLD, num_ep, info, ep_comm);  // servers should reach here too. 
    8291      passage = ep_comm;   
     
    8695       
    8796    globalComm = passage[omp_get_thread_num()]; 
     97 
     98    int tmp_rank; 
     99    MPI_Comm_rank(MPI_COMM_WORLD, &tmp_rank); 
     100    if(isClient) printf("client thread %d/%d, globalComm = %p\n", omp_get_thread_num(), tmp_rank, &passage[omp_get_thread_num()]); 
     101    if(isServer) printf("server thread %d/%d, globalComm = %p\n", omp_get_thread_num(), tmp_rank, &passage[omp_get_thread_num()]); 
    88102     
    89103  } 
  • XIOS/dev/branch_yushan/src/cxios.hpp

    r1053 r1072  
    3232    public: 
    3333     static string rootFile ; //!< Configuration filename 
     34     //#pragma omp threadprivate(rootFile) 
     35 
    3436     static string xiosCodeId ; //!< Identity for XIOS 
     37     //#pragma omp threadprivate(xiosCodeId) 
     38 
    3539     static string clientFile; //!< Filename template for client 
     40     //#pragma omp threadprivate(clientFile) 
     41 
    3642     static string serverFile; //!< Filename template for server 
     43     //#pragma omp threadprivate(serverFile) 
    3744 
    3845     static bool isClient ; //!< Check if xios is client 
     46     //#pragma omp threadprivate(isClient) 
     47 
    3948     static bool isServer ; //!< Check if xios is server 
     49     //#pragma omp threadprivate(isServer) 
    4050 
    4151     static MPI_Comm globalComm ; //!< Global communicator 
     52     #pragma omp threadprivate(globalComm) 
    4253 
    4354     static bool printLogs2Files; //!< Printing out logs into files 
     55     //#pragma omp threadprivate(printLogs2Files) 
     56 
    4457     static bool usingOasis ; //!< Using Oasis 
     58     //#pragma omp threadprivate(usingOasis) 
     59 
    4560     static bool usingServer ; //!< Using server (server mode) 
     61     //#pragma omp threadprivate(usingServer) 
     62 
    4663     static double bufferSizeFactor; //!< Factor used to tune the buffer size 
     64     //#pragma omp threadprivate(bufferSizeFactor) 
     65 
    4766     static const double defaultBufferSizeFactor; //!< Default factor value 
     67     //#pragma omp threadprivate(defaultBufferSizeFactor) 
     68 
    4869     static StdSize minBufferSize; //!< Minimum buffer size 
     70     //#pragma omp threadprivate(minBufferSize) 
     71 
    4972     static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible) 
     73     //#pragma omp threadprivate(isOptPerformance) 
     74 
    5075     static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers 
     76     //#pragma omp threadprivate(globalRegistry) 
    5177 
    5278    public: 
  • XIOS/dev/branch_yushan/src/event_client.hpp

    r731 r1072  
    1212    public: 
    1313      static const size_t headerSize; 
     14      //#pragma omp threadprivate(headerSize) 
    1415 
    1516      CEventClient(int classId, int typeId); 
  • XIOS/dev/branch_yushan/src/filter/spatial_transform_filter.hpp

    r1037 r1072  
    103103      //! The allocated engines 
    104104      static std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> > engines; 
     105      // #pragma omp threadprivate(engines) 
     106       
    105107  }; // class CSpatialTransformFilterEngine 
    106108} // namespace xios 
  • XIOS/dev/branch_yushan/src/indent.hpp

    r501 r1072  
    1010    public: 
    1111    static int defaultIncSize; 
     12    //#pragma omp threadprivate(defaultIncSize) 
     13     
    1214    static int index ; 
     15    //#pragma omp threadprivate(index) 
     16     
    1317    int incSize ; 
    1418    int offset ; 
  • XIOS/dev/branch_yushan/src/indent_xml.cpp

    r501 r1072  
    1515   { 
    1616      static unsigned int LineNB = 1; 
     17      #pragma omp threadprivate(LineNB) 
     18       
    1719      if (CIndent::WithLine) out << LineNB++ << ". "; 
    1820      for(unsigned int i = 0; i < CIndent::Indent; out << CIndent::Increm , i++){} 
  • XIOS/dev/branch_yushan/src/indent_xml.hpp

    r591 r1072  
    2222         /// Propriétés  statiques /// 
    2323         static unsigned int Indent; 
     24         //#pragma omp threadprivate(Indent) 
     25 
    2426         static StdString    Increm; 
     27         //#pragma omp threadprivate(Increm) 
     28 
    2529         static bool         WithLine; 
     30         //#pragma omp threadprivate(WithLine) 
    2631 
    2732   }; // class CIndent 
  • XIOS/dev/branch_yushan/src/interface/c/icdata.cpp

    r1070 r1072  
    7171      else local_comm = MPI_COMM_NULL; 
    7272      #endif 
    73       
     73       
    7474 
    7575      CXios::initClientSide(str, local_comm, return_comm); 
  • XIOS/dev/branch_yushan/src/io/netCdf_cf_constant.hpp

    r782 r1072  
    1616  static const StdString XIOS_CF_coordinates; 
    1717  static const StdString XIOS_CF_bounds; 
     18 
     19  #pragma omp threadprivate(XIOS_CF_units, XIOS_CF_standard_name, XIOS_CF_coordinates, XIOS_CF_bounds) 
    1820}; 
    1921const StdString CCFKeywords::XIOS_CF_units("units"); 
     
    2729  static const std::set<StdString> XIOS_CF_Longitude_units; 
    2830 
     31  // #pragma omp threadprivate(XIOS_CF_Latitude_units, XIOS_CF_Longitude_units) 
     32 
    2933private: 
    3034  CCFConvention(); 
  • XIOS/dev/branch_yushan/src/memtrack.cpp

    r501 r1072  
    6868        private:    // static member variables 
    6969            static BlockHeader *ourFirstNode; 
     70            //#pragma omp threadprivate(ourFirstNode) 
    7071     
    7172        private:    // member variables 
     
    244245            static const unsigned int SIGNATURE1 = 0xCAFEBABE; 
    245246            static const unsigned int SIGNATURE2 = 0xFACEFACE; 
     247 
     248            //#pragma omp threadprivate(SIGNATURE1, SIGNATURE2) 
    246249         
    247250        private:    // member variables 
  • XIOS/dev/branch_yushan/src/mpi.hpp

    r1053 r1072  
    1212 
    1313#ifdef _usingEP 
     14  #include <omp.h> 
    1415  #include "../extern/src_ep_dev/ep_lib.hpp" 
    1516  using namespace ep_lib; 
  • XIOS/dev/branch_yushan/src/node/axis.hpp

    r927 r1072  
    167167         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    168168         static std::map<StdString, ETranformationType> transformationMapList_; 
     169         // #pragma omp threadprivate(transformationMapList_) 
     170 
    169171         static bool dummyTransformationMapList_; 
     172         //#pragma omp threadprivate(dummyTransformationMapList_) 
    170173 
    171174         DECLARE_REF_FUNC(Axis,axis) 
  • XIOS/dev/branch_yushan/src/node/compute_connectivity_domain.hpp

    r934 r1072  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      //#pragma omp threadprivate(_dummyRegistered) 
     63       
    6264  }; // class CComputeConnectivityDomain 
    6365 
  • XIOS/dev/branch_yushan/src/node/context.hpp

    r1053 r1072  
    209209         // Context root 
    210210         static shared_ptr<CContextGroup> root; 
     211         // #pragma omp threadprivate(root) 
    211212 
    212213         // Determine context on client or not 
  • XIOS/dev/branch_yushan/src/node/domain.hpp

    r953 r1072  
    213213         static std::map<StdString, ETranformationType> transformationMapList_; 
    214214         static bool _dummyTransformationMapList; 
     215         //#pragma omp threadprivate(_dummyTransformationMapList) 
    215216 
    216217         DECLARE_REF_FUNC(Domain,domain) 
  • XIOS/dev/branch_yushan/src/node/expand_domain.hpp

    r935 r1072  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      //#pragma omp threadprivate(_dummyRegistered) 
     63       
    6264  }; // class CExpandDomain 
    6365 
  • XIOS/dev/branch_yushan/src/node/extract_axis_to_scalar.hpp

    r960 r1072  
    6060      static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      //#pragma omp threadprivate(_dummyRegistered) 
    6263  }; // class CExtractAxisToScalar 
    6364 
  • XIOS/dev/branch_yushan/src/node/extract_domain_to_axis.hpp

    r895 r1072  
    6060      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      //#pragma omp threadprivate(_dummyRegistered) 
    6263  }; // class CExtractDomainToAxis 
    6364 
  • XIOS/dev/branch_yushan/src/node/generate_rectilinear_domain.hpp

    r836 r1072  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      //#pragma omp threadprivate(_dummyRegistered) 
    6263  }; // class CGenerateRectilinearDomain 
    6364 
  • XIOS/dev/branch_yushan/src/node/interpolate_axis.hpp

    r836 r1072  
    6262      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6363      static bool _dummyRegistered; 
     64      //#pragma omp threadprivate(_dummyRegistered) 
     65       
    6466  }; // class CInterpolateAxis 
    6567 
  • XIOS/dev/branch_yushan/src/node/interpolate_domain.hpp

    r1037 r1072  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      //#pragma omp threadprivate(_dummyRegistered) 
    6263  }; // class CInterpolateDomain 
    6364 
  • XIOS/dev/branch_yushan/src/node/inverse_axis.hpp

    r836 r1072  
    5959      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6060      static bool _dummyRegistered; 
     61      //#pragma omp threadprivate(_dummyRegistered) 
    6162 
    6263  }; // class CInverseAxis 
  • XIOS/dev/branch_yushan/src/node/reduce_axis_to_scalar.hpp

    r888 r1072  
    5959      static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node); 
    6060      static bool _dummyRegistered; 
     61      //#pragma omp threadprivate(_dummyRegistered) 
    6162  }; // class CReduceAxisToScalar 
    6263 
  • XIOS/dev/branch_yushan/src/node/reduce_domain_to_axis.hpp

    r895 r1072  
    6060      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      //#pragma omp threadprivate(_dummyRegistered) 
    6263  }; // class CReduceDomainToAxis 
    6364 
  • XIOS/dev/branch_yushan/src/node/reduce_domain_to_scalar.hpp

    r976 r1072  
    6060      static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      //#pragma omp threadprivate(_dummyRegistered) 
    6263  }; // class CReduceDomainToScalar 
    6364 
  • XIOS/dev/branch_yushan/src/node/scalar.hpp

    r888 r1072  
    8989           static std::map<StdString, ETranformationType> transformationMapList_; 
    9090           static bool dummyTransformationMapList_; 
     91           //#pragma omp threadprivate(dummyTransformationMapList_) 
    9192 
    9293 
  • XIOS/dev/branch_yushan/src/node/transformation.hpp

    r934 r1072  
    3535      typedef std::map<ETranformationType, CreateTransformationCallBack> CallBackMap; 
    3636      static CallBackMap* transformationCreationCallBacks_; 
     37      //#pragma omp threadprivate(transformationCreationCallBacks_) 
    3738 
    3839      static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn); 
  • XIOS/dev/branch_yushan/src/node/zoom_axis.hpp

    r836 r1072  
    6060      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      //#pragma omp threadprivate(_dummyRegistered) 
    6263  }; // class CZoomAxis 
    6364 
  • XIOS/dev/branch_yushan/src/node/zoom_domain.hpp

    r836 r1072  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      //#pragma omp threadprivate(_dummyRegistered) 
     63       
    6264  }; // class CZoomDomain 
    6365 
  • XIOS/dev/branch_yushan/src/parse_expr/lex_parser.cpp

    r1037 r1072  
    264264static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 
    265265static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ 
     266#pragma omp threadprivate(yy_buffer_stack_top, yy_buffer_stack_max, yy_buffer_stack) 
    266267 
    267268/* We provide macros for accessing buffer states in case in the 
     
    283284static char yy_hold_char; 
    284285static yy_size_t yy_n_chars;            /* number of characters read into yy_ch_buf */ 
     286#pragma omp threadprivate(yy_hold_char, yy_n_chars) 
     287 
    285288yy_size_t yyleng; 
    286289 
     
    289292static int yy_init = 0;         /* whether we need to initialize */ 
    290293static int yy_start = 0;        /* start state number */ 
     294#pragma omp threadprivate(yy_c_buf_p, yy_init, yy_start) 
    291295 
    292296/* Flag which is used to allow yywrap()'s to do buffer switches 
     
    294298 */ 
    295299static int yy_did_buffer_switch_on_eof; 
     300#pragma omp threadprivate(yy_did_buffer_switch_on_eof) 
    296301 
    297302void yyrestart (FILE *input_file  ); 
     
    982987 
    983988    } ; 
     989#pragma omp threadprivate(yy_nxt) 
    984990 
    985991static yy_state_type yy_get_previous_state (void ); 
     
    10251031        0,    0,    0,    0,    0 
    10261032    } ; 
     1033 
     1034#pragma omp threadprivate(yy_accept, yy_last_accepting_state, yy_last_accepting_cpos, yy_NUL_trans) 
    10271035 
    10281036extern int yy_flex_debug; 
  • XIOS/dev/branch_yushan/src/server.cpp

    r1070 r1072  
    268268       int flag = false ; 
    269269       static void* buffer ; 
     270       #pragma omp threadprivate(buffer) 
     271 
    270272       static MPI_Request request ; 
     273       #pragma omp threadprivate(request) 
     274 
    271275       static bool recept=false ; 
     276       #pragma omp threadprivate(recept) 
     277 
    272278       int rank ; 
    273279       int count ;  
     
    364370       int flag ; 
    365371       static void* buffer ; 
     372       #pragma omp threadprivate(buffer) 
     373 
    366374       static MPI_Request request ; 
     375       #pragma omp threadprivate(request) 
     376 
    367377       static bool recept=false ; 
     378       #pragma omp threadprivate(recept) 
     379        
    368380       int rank ; 
    369381       int count ; 
  • XIOS/dev/branch_yushan/src/server.hpp

    r1037 r1072  
    2929 
    3030        static MPI_Comm intraComm; 
     31        //#pragma omp threadprivate(intraComm) 
     32 
    3133        static list<MPI_Comm> interComm; 
     34        //#pragma omp threadprivate(interComm) 
     35 
    3236        static std::list<MPI_Comm> contextInterComms; 
    3337        static CEventScheduler* eventScheduler; 
     38        //#pragma omp threadprivate(eventScheduler) 
    3439         
    3540        struct contextMessage 
     
    4045 
    4146        static bool isRoot; 
     47        //#pragma omp threadprivate(isRoot) 
    4248 
    4349        static map<string,CContext*> contextList; 
    4450        static bool finished; 
     51        //#pragma omp threadprivate(finished) 
     52 
    4553        static bool is_MPI_Initialized; 
     54        //#pragma omp threadprivate(is_MPI_Initialized) 
    4655 
    4756      public: 
     
    6574      private: 
    6675        static int rank; 
     76        //#pragma omp threadprivate(rank) 
     77 
    6778        static StdOFStream m_infoStream; 
     79        //#pragma omp threadprivate(m_infoStream) 
     80 
    6881        static StdOFStream m_errorStream; 
     82        //#pragma omp threadprivate(m_errorStream) 
    6983 
    7084        static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb); 
  • XIOS/dev/branch_yushan/src/test/test_client.f90

    r1069 r1072  
    33  USE xios 
    44  USE mod_wait 
     5  use omp_lib 
    56  IMPLICIT NONE 
    67  INCLUDE "mpif.h" 
     
    3233  INTEGER :: i,j,l,ts,n 
    3334 
    34 !!! MPI Initialization 
     35!!! MPI Initialization    
    3536 
    3637  CALL MPI_INIT(ierr) 
     
    4445  CALL MPI_COMM_RANK(comm,rank,ierr) 
    4546  CALL MPI_COMM_SIZE(comm,size,ierr) 
    46    
    4747 
    4848  DO j=1,nj_glo 
  • XIOS/dev/branch_yushan/src/transformation/Functions/reduction.hpp

    r1037 r1072  
    5959  typedef std::map<EReductionType, CreateOperationCallBack> CallBackMap; 
    6060  static CallBackMap* reductionCreationCallBacks_; 
     61  #pragma omp threadprivate(reductionCreationCallBacks_) 
    6162 
    6263  static bool registerOperation(EReductionType reduceType, CreateOperationCallBack createFn); 
     
    6667  static bool initReductionOperation(std::map<StdString,EReductionType>& m); 
    6768  static bool _dummyInit; 
     69  #pragma omp threadprivate(_dummyInit) 
    6870}; 
    6971 
  • XIOS/dev/branch_yushan/src/transformation/grid_transformation_factory_impl.hpp

    r933 r1072  
    5757  typedef std::map<ETranformationType, CreateTransformationCallBack> CallBackMap; 
    5858  static CallBackMap* transformationCreationCallBacks_; 
     59  #pragma omp threadprivate(transformationCreationCallBacks_) 
     60   
    5961  static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn); 
    6062  static bool unregisterTransformation(ETranformationType transType); 
    6163  static bool initializeTransformation_; 
     64  #pragma omp threadprivate(initializeTransformation_) 
    6265}; 
    6366 
  • XIOS/dev/branch_yushan/src/xios_server.f90

    r1063 r1072  
    44  IMPLICIT NONE 
    55  INCLUDE "mpif.h" 
    6   INTEGER :: ierr 
     6  INTEGER :: ierr, th_level 
    77     
    88    CALL MPI_INIT(ierr) 
     9    !CALL MPI_INIT_thread(3, th_level, ierr) 
    910    CALL init_wait 
    1011    CALL xios_init_server 
  • XIOS/dev/branch_yushan/src/xml_node.hpp

    r591 r1072  
    4949 
    5050            static StdString RootName; 
     51            //#pragma omp threadprivate(RootName) 
    5152 
    5253      }; //class CXMLParser 
  • XIOS/dev/branch_yushan/src/xml_parser.cpp

    r1037 r1072  
    1515      void CXMLParser::ParseFile(const StdString & filename, const std::set<StdString>& parseContextList) 
    1616      { 
     17         //printf("thread %d, parsefile = %s\n", omp_get_thread_num(), filename.c_str()); 
    1718         StdIFStream ifs ( filename.c_str() , StdIFStream::in ); 
    1819         if ( (ifs.rdstate() & std::ifstream::failbit ) != 0 ) 
Note: See TracChangeset for help on using the changeset viewer.