Changeset 1331 for XIOS


Ignore:
Timestamp:
11/16/17 16:20:41 (6 years ago)
Author:
yushan
Message:

dev_omp

Location:
XIOS/dev/branch_openmp
Files:
39 edited

Legend:

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

    r1329 r1331  
    4040#bld::target test_omp.exe  
    4141#bld::target test_complete_omp.exe  
    42 bld::target test_remap.exe  
     42#bld::target test_remap.exe  
    4343bld::target test_remap_ref.exe  
    4444bld::target test_remap_omp.exe  
    4545#bld::target test_unstruct_omp.exe 
    4646#bld::target test_netcdf_omp.exe 
    47 bld::target test_client.exe  
    48 bld::target test_complete.exe 
     47#bld::target test_client.exe  
     48#bld::target test_complete.exe 
    4949#bld::target test_remap.exe 
    5050#bld::target test_unstruct.exe 
  • XIOS/dev/branch_openmp/src/attribute_map.hpp

    r1328 r1331  
    7676            /// Propriété statique /// 
    7777            static CAttributeMap * Current; 
     78            #pragma omp threadprivate(Current) 
    7879 
    7980      };  // class CAttributeMap 
  • XIOS/dev/branch_openmp/src/buffer_client.hpp

    r1328 r1331  
    1313    public: 
    1414      static size_t maxRequestSize; 
     15      #pragma omp threadprivate(maxRequestSize) 
    1516 
    1617      CClientBuffer(ep_lib::MPI_Comm intercomm, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize, StdSize maxBufferedEvents); 
  • XIOS/dev/branch_openmp/src/client.hpp

    r1328 r1331  
    77namespace xios 
    88{ 
    9     class CClient 
    10     { 
    11       public: 
    12         static void initialize(const string& codeId, ep_lib::MPI_Comm& localComm, ep_lib::MPI_Comm& returnComm); 
    13         static void finalize(void); 
    14         static void registerContext(const string& id, ep_lib::MPI_Comm contextComm); 
     9  class CClient 
     10  { 
     11    public: 
     12      static void initialize(const string& codeId, ep_lib::MPI_Comm& localComm, ep_lib::MPI_Comm& returnComm); 
     13      static void finalize(void); 
     14      static void registerContext(const string& id, ep_lib::MPI_Comm contextComm); 
    1515 
    16         static ep_lib::MPI_Comm intraComm; 
    17         static ep_lib::MPI_Comm interComm; 
    18         //static std::list<MPI_Comm> contextInterComms; 
    19         static std::list<ep_lib::MPI_Comm> *contextInterComms_ptr; 
    20         static int serverLeader; 
    21         static bool is_MPI_Initialized ; 
     16      static ep_lib::MPI_Comm intraComm; 
     17      #pragma omp threadprivate(intraComm) 
     18    
     19      static ep_lib::MPI_Comm interComm; 
     20      #pragma omp threadprivate(interComm) 
    2221 
    23         //! Get rank of the current process 
    24         static int getRank(); 
     22      //static std::list<MPI_Comm> contextInterComms; 
     23      static std::list<ep_lib::MPI_Comm> *contextInterComms_ptr; 
     24      #pragma omp threadprivate(contextInterComms_ptr) 
    2525 
    26         //! Open a file stream to write the info logs 
    27         static void openInfoStream(const StdString& fileName); 
    28         //! Write the info logs to standard output 
    29         static void openInfoStream(); 
    30         //! Close the info logs file if it opens 
    31         static void closeInfoStream(); 
     26      static int serverLeader; 
     27      #pragma omp threadprivate(serverLeader) 
     28       
     29      static bool is_MPI_Initialized ; 
     30      #pragma omp threadprivate(is_MPI_Initialized) 
    3231 
    33         //! Open a file stream to write the error log 
    34         static void openErrorStream(const StdString& fileName); 
    35         //! Write the error log to standard error output 
    36         static void openErrorStream(); 
    37         //! Close the error log file if it opens 
    38         static void closeErrorStream(); 
     32      //! Get rank of the current process 
     33      static int getRank(); 
    3934 
    40       protected: 
    41         static int rank; 
    42         static StdOFStream m_infoStream; 
    43         static StdOFStream m_errorStream; 
     35      //! Open a file stream to write the info logs 
     36      static void openInfoStream(const StdString& fileName); 
     37      //! Write the info logs to standard output 
     38      static void openInfoStream(); 
     39      //! Close the info logs file if it opens 
     40      static void closeInfoStream(); 
    4441 
    45         static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb); 
    46     }; 
     42      //! Open a file stream to write the error log 
     43      static void openErrorStream(const StdString& fileName); 
     44      //! Write the error log to standard error output 
     45      static void openErrorStream(); 
     46      //! Close the error log file if it opens 
     47      static void closeErrorStream(); 
     48 
     49    protected: 
     50      static int rank; 
     51      #pragma omp threadprivate(rank) 
     52 
     53      static StdOFStream m_infoStream; 
     54      #pragma omp threadprivate(m_infoStream) 
     55      static StdOFStream m_errorStream; 
     56      #pragma omp threadprivate(m_errorStream) 
     57 
     58      static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb); 
     59  }; 
    4760} 
    4861 
  • XIOS/dev/branch_openmp/src/cxios.cpp

    r1328 r1331  
    1515namespace xios 
    1616{ 
    17   string CXios::rootFile="./iodef.xml" ; 
    18   string CXios::xiosCodeId="xios.x" ; 
    19   string CXios::clientFile="./xios_client"; 
    20   string CXios::serverFile="./xios_server"; 
     17  const string CXios::rootFile="./iodef.xml" ; 
     18  const string CXios::xiosCodeId="xios.x" ; 
     19  const string CXios::clientFile="./xios_client"; 
     20  const string CXios::serverFile="./xios_server"; 
    2121 
    2222  bool CXios::isClient ; 
     
    3737  { 
    3838    set_new_handler(noMemory); 
    39     parseFile(rootFile); 
     39    int tmp_rank; 
     40    MPI_Comm_rank(MPI_COMM_WORLD, &tmp_rank); 
     41    #pragma omp critical 
     42    { 
     43      std::cout<<"thread "<<tmp_rank<<"("<<omp_get_thread_num()<<")"<<" parsing rootfile"<<std::endl; 
     44      parseFile(rootFile); 
     45      std::cout<<"thread "<<tmp_rank<<"("<<omp_get_thread_num()<<")"<<" parsed rootfile"<<std::endl; 
     46    } 
     47    #pragma omp barrier 
    4048    parseXiosConfig(); 
    4149  } 
     
    7886    if(isServer)  
    7987    {  
    80       num_ep = omp_get_num_threads(); 
     88      num_ep = 1; 
    8189    } 
    8290         
  • XIOS/dev/branch_openmp/src/cxios.hpp

    r1328 r1331  
    1414  { 
    1515    public: 
    16      static void initialize(void) ; 
    17      static void initClientSide(const string & codeId, ep_lib::MPI_Comm& localComm, ep_lib::MPI_Comm& returnComm) ; 
    18      static void initServerSide(void) ; 
    19      static void clientFinalize(void) ; 
    20      static void parseFile(const string& filename) ; 
     16      static void initialize(void) ; 
     17      static void initClientSide(const string & codeId, ep_lib::MPI_Comm& localComm, ep_lib::MPI_Comm& returnComm) ; 
     18      static void initServerSide(void) ; 
     19      static void clientFinalize(void) ; 
     20      static void parseFile(const string& filename) ; 
    2121 
    22      template <typename T> 
    23      static T getin(const string& id,const T& defaultValue) ; 
     22      template <typename T> 
     23      static T getin(const string& id,const T& defaultValue) ; 
    2424 
    25      template <typename T> 
    26      static T getin(const string& id) ; 
     25      template <typename T> 
     26      static T getin(const string& id) ; 
    2727 
    2828    public: 
    29      static string rootFile ; //!< Configuration filename 
    30      static string xiosCodeId ; //!< Identity for XIOS 
    31      static string clientFile; //!< Filename template for client 
    32      static string serverFile; //!< Filename template for server 
     29      static const string rootFile ; //!< Configuration filename 
     30      static const string xiosCodeId ; //!< Identity for XIOS 
     31      static const string clientFile; //!< Filename template for client 
     32      static const string serverFile; //!< Filename template for server 
     33      //#pragma omp threadprivate(rootFile, xiosCodeId, clientFile, serverFile) 
    3334 
    34      static bool isClient ; //!< Check if xios is client 
    35      static bool isServer ; //!< Check if xios is server 
     35      static bool isClient ; //!< Check if xios is client 
     36      #pragma omp threadprivate(isClient) 
     37      static bool isServer ; //!< Check if xios is server 
     38      #pragma omp threadprivate(isServer) 
    3639 
    37      static ep_lib::MPI_Comm globalComm ; //!< Global communicator 
     40      static ep_lib::MPI_Comm globalComm ; //!< Global communicator 
     41      #pragma omp threadprivate(globalComm) 
    3842 
    39      static bool printLogs2Files; //!< Printing out logs into files 
    40      static bool usingOasis ; //!< Using Oasis 
    41      static bool usingServer ; //!< Using server (server mode) 
    42      static double bufferSizeFactor; //!< Factor used to tune the buffer size 
    43      static const double defaultBufferSizeFactor; //!< Default factor value 
    44      static StdSize minBufferSize; //!< Minimum buffer size 
    45      static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible) 
    46      static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers 
    47      static double recvFieldTimeout; //!< Time to wait for data before issuing an error when receiving a field 
     43      static bool printLogs2Files; //!< Printing out logs into files 
     44      #pragma omp threadprivate(printLogs2Files) 
     45      static bool usingOasis ; //!< Using Oasis 
     46      #pragma omp threadprivate(usingOasis) 
     47      static bool usingServer ; //!< Using server (server mode) 
     48      #pragma omp threadprivate(usingServer) 
     49      static double bufferSizeFactor; //!< Factor used to tune the buffer size 
     50      #pragma omp threadprivate(bufferSizeFactor) 
     51      static const double defaultBufferSizeFactor; //!< Default factor value 
     52      static StdSize minBufferSize; //!< Minimum buffer size 
     53      #pragma omp threadprivate(minBufferSize) 
     54      static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible) 
     55      #pragma omp threadprivate(isOptPerformance) 
     56      static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers 
     57      #pragma omp threadprivate(globalRegistry) 
     58      static double recvFieldTimeout; //!< Time to wait for data before issuing an error when receiving a field 
     59      #pragma omp threadprivate(recvFieldTimeout) 
    4860 
    4961    public: 
    50      //! Setting xios to use server mode 
    51      static void setUsingServer(); 
     62      //! Setting xios to use server mode 
     63      static void setUsingServer(); 
    5264 
    53      //! Setting xios NOT to use server mode 
    54      static void setNotUsingServer(); 
     65      //! Setting xios NOT to use server mode 
     66      static void setNotUsingServer(); 
    5567 
    56      //! Initialize server (if any) 
    57      static  void initServer(); 
     68      //! Initialize server (if any) 
     69      static  void initServer(); 
    5870 
    5971    private: 
  • XIOS/dev/branch_openmp/src/filter/spatial_transform_filter.hpp

    r1328 r1331  
    105105      //static std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> > engines; 
    106106      static std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> > *engines_ptr; 
     107      #pragma om threadprivate(engines_ptr) 
    107108  }; // class CSpatialTransformFilterEngine 
    108109} // namespace xios 
  • XIOS/dev/branch_openmp/src/group_factory.hpp

    r1328 r1331  
    7070         /// Propriétés statiques /// 
    7171         static StdString CurrContext; 
     72//         #pragma omp threadprivate(CurrContext) 
    7273 
    7374   }; // class CGroupFactory 
  • XIOS/dev/branch_openmp/src/indent.hpp

    r1328 r1331  
    1010    public: 
    1111    static int defaultIncSize; 
     12    #pragma omp threadprivate(defaultIncSize) 
    1213    static int index ; 
     14    #pragma omp threadprivate(index) 
    1315    int incSize ; 
    1416    int offset ; 
  • XIOS/dev/branch_openmp/src/indent_xml.hpp

    r1328 r1331  
    88namespace xios 
    99{ 
    10    /// ////////////////////// Déclarations ////////////////////// /// 
    11    class CIndent 
    12    { 
    13       public : 
     10  /// ////////////////////// Déclarations ////////////////////// /// 
     11  class CIndent 
     12  { 
     13    public : 
    1414 
    15          /// Méthodes statiques /// 
    16          static StdOStream & NIndent  (StdOStream & out); 
    17          static StdOStream & IncIndent(StdOStream & out); 
    18          static StdOStream & DecEndl  (StdOStream & out); 
     15      /// Méthodes statiques /// 
     16      static StdOStream & NIndent  (StdOStream & out); 
     17      static StdOStream & IncIndent(StdOStream & out); 
     18      static StdOStream & DecEndl  (StdOStream & out); 
    1919 
    20       private : 
     20    private : 
    2121 
    22          /// Propriétés  statiques /// 
    23          static unsigned int Indent; 
    24          static StdString    Increm; 
    25          static bool         WithLine; 
     22      /// Propriétés  statiques /// 
     23      static unsigned int Indent; 
     24      #pragma omp threadprivate(Indent) 
     25      static StdString    Increm; 
     26      #pragma omp threadprivate(Increm) 
     27      static bool         WithLine; 
     28      #pragma omp threadprivate(WithLine) 
    2629 
    27    }; // class CIndent 
     30  }; // class CIndent 
    2831 
    29     ///-------------------------------------------------------------- 
     32  ///-------------------------------------------------------------- 
    3033     
    31    class CIndentedXml 
    32    { 
    33       public : 
     34  class CIndentedXml 
     35  { 
     36    public : 
     37      /// Méthode statique /// 
     38      static StdString Indented(const StdString & content); 
    3439 
    35          /// Méthode statique /// 
    36          static StdString Indented(const StdString & content); 
     40  }; // class CIndentedXml 
    3741 
    38    }; // class CIndentedXml 
    39  
    40     ///-------------------------------------------------------------- 
     42  ///-------------------------------------------------------------- 
    4143 
    4244} // namespace xios 
  • XIOS/dev/branch_openmp/src/node/axis.hpp

    r1328 r1331  
    173173         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    174174         static bool initializeTransformationMap(); 
    175          //static std::map<StdString, ETranformationType> transformationMapList_; 
    176175         static std::map<StdString, ETranformationType> *transformationMapList_ptr; 
     176         #pragma omp threadprivate(transformationMapList_ptr) 
    177177         static bool dummyTransformationMapList_; 
     178         #pragma omp threadprivate(dummyTransformationMapList_) 
    178179 
    179180         DECLARE_REF_FUNC(Axis,axis) 
  • XIOS/dev/branch_openmp/src/node/compute_connectivity_domain.hpp

    r1328 r1331  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      #pragma omp threadprivate(_dummyRegistered) 
    6263  }; // class CComputeConnectivityDomain 
    6364 
  • XIOS/dev/branch_openmp/src/node/context.cpp

    r1328 r1331  
    2323namespace xios { 
    2424 
    25   shared_ptr<CContextGroup> CContext::root; 
    26  
    27    /// ////////////////////// Définitions ////////////////////// /// 
     25  shared_ptr<CContextGroup> * CContext::root_ptr = 0; 
     26 
     27   /// ////////////////////// Dfinitions ////////////////////// /// 
    2828 
    2929   CContext::CContext(void) 
     
    5959   CContextGroup* CContext::getRoot(void) 
    6060   { 
    61       if (root.get()==NULL) root=shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName())); 
    62       return root.get(); 
     61      //std::cout<<omp_get_thread_num()<<" get root name = "<<xml::CXMLNode::GetRootName()<<std::endl; 
     62      if (root_ptr==0) root_ptr = new shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName())); 
     63      return root_ptr->get(); 
    6364   } 
    6465 
     
    182183      if (!this->hasChild()) 
    183184      { 
    184          //oss << "<!-- No definition -->" << std::endl; // fait planter l'incrémentation 
     185         //oss << "<!-- No definition -->" << std::endl; // fait planter l'incrmentation 
    185186      } 
    186187      else 
     
    555556   void CContext::solveAllInheritance(bool apply) // default : apply = true 
    556557   { 
    557      // Résolution des héritages descendants (càd des héritages de groupes) 
     558     // Rsolution des hritages descendants (cd des hritages de groupes) 
    558559     // pour chacun des contextes. 
    559560      solveDescInheritance(apply); 
    560561 
    561      // Résolution des héritages par référence au niveau des fichiers. 
     562     // Rsolution des hritages par rfrence au niveau des fichiers. 
    562563      const vector<CFile*> allFiles=CFile::getAll(); 
    563564      const vector<CGrid*> allGrids= CGrid::getAll(); 
     
    583584 
    584585      for (unsigned int i = 0; i < allFiles.size(); i++) 
    585          if (!allFiles[i]->enabled.isEmpty()) // Si l'attribut 'enabled' est défini. 
     586         if (!allFiles[i]->enabled.isEmpty()) // Si l'attribut 'enabled' est dfini. 
    586587         { 
    587             if (allFiles[i]->enabled.getValue()) // Si l'attribut 'enabled' est fixé à vrai. 
     588            if (allFiles[i]->enabled.getValue()) // Si l'attribut 'enabled' est fix  vrai. 
    588589            { 
    589590              if ((initDate + allFiles[i]->output_freq.getValue()) < (initDate + this->getCalendar()->getTimeStep())) 
     
    610611 
    611612      if (enabledFiles.size() == 0) 
    612          DEBUG(<<"Aucun fichier ne va être sorti dans le contexte nommé \"" 
     613         DEBUG(<<"Aucun fichier ne va tre sorti dans le contexte nomm \"" 
    613614               << getId() << "\" !"); 
    614615   } 
     
    847848      prepareTimeseries(); 
    848849 
    849       //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 
     850      //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers sortir. 
    850851      this->findEnabledFiles(); 
    851852      this->findEnabledReadModeFiles(); 
     
    12571258    CContext* context = CObjectFactory::CreateObject<CContext>(id).get(); 
    12581259    getRoot(); 
    1259     if (!hasctxt) CGroupFactory::AddChild(root, context->getShared()); 
     1260    if (!hasctxt) CGroupFactory::AddChild(*root_ptr, context->getShared()); 
    12601261 
    12611262#define DECLARE_NODE(Name_, name_) \ 
  • XIOS/dev/branch_openmp/src/node/context.hpp

    r1328 r1331  
    206206 
    207207         // Context root 
    208          static shared_ptr<CContextGroup> root; 
     208         static shared_ptr<CContextGroup> *root_ptr; 
     209         #pragma omp threadprivate(root_ptr) 
    209210 
    210211         // Determine context on client or not 
  • XIOS/dev/branch_openmp/src/node/domain.hpp

    r1328 r1331  
    217217         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    218218         static bool initializeTransformationMap(); 
    219          //static std::map<StdString, ETranformationType> transformationMapList_; 
    220219         static std::map<StdString, ETranformationType> *transformationMapList_ptr; 
     220         #pragma omp threadprivate(transformationMapList_ptr) 
    221221         static bool _dummyTransformationMapList; 
     222         #pragma omp threadprivate(_dummyTransformationMapList) 
    222223 
    223224         DECLARE_REF_FUNC(Domain,domain) 
  • XIOS/dev/branch_openmp/src/node/expand_domain.hpp

    r1328 r1331  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      #pragma omp threadprivate(_dummyRegistered) 
    6263  }; // class CExpandDomain 
    6364 
  • XIOS/dev/branch_openmp/src/node/extract_axis_to_scalar.hpp

    r1328 r1331  
    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_openmp/src/node/extract_domain_to_axis.hpp

    r1328 r1331  
    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_openmp/src/node/generate_rectilinear_domain.hpp

    r1328 r1331  
    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_openmp/src/node/interpolate_axis.hpp

    r1328 r1331  
    6262      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6363      static bool _dummyRegistered; 
     64      #pragma omp threadprivate(_dummyRegistered) 
    6465  }; // class CInterpolateAxis 
    6566 
  • XIOS/dev/branch_openmp/src/node/interpolate_domain.hpp

    r1328 r1331  
    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_openmp/src/node/inverse_axis.hpp

    r1328 r1331  
    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_openmp/src/node/mesh.hpp

    r1328 r1331  
    8080      int nbFaces_; 
    8181 
    82       //static std::map <StdString, CMesh> meshList; 
    8382      static std::map <StdString, CMesh> *meshList_ptr; 
    84       //static std::map <StdString, vector<int> > domainList; 
     83      #pragma omp threadprivate(meshList_ptr) 
    8584      static std::map <StdString, vector<int> > *domainList_ptr; 
     85      #pragma omp threadprivate(domainList_ptr) 
    8686      CClientClientDHTSizet* pNodeGlobalIndex;                    // pointer to a map <nodeHash, nodeIdxGlo> 
    8787      CClientClientDHTSizet* pEdgeGlobalIndex;                    // pointer to a map <edgeHash, edgeIdxGlo> 
  • XIOS/dev/branch_openmp/src/node/reduce_axis_to_scalar.hpp

    r1328 r1331  
    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_openmp/src/node/reduce_domain_to_axis.hpp

    r1328 r1331  
    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_openmp/src/node/reduce_domain_to_scalar.hpp

    r1328 r1331  
    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_openmp/src/node/scalar.hpp

    r1328 r1331  
    8888           static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    8989           static bool initializeTransformationMap(); 
    90            //static std::map<StdString, ETranformationType> transformationMapList_; 
    9190           static std::map<StdString, ETranformationType> *transformationMapList_ptr; 
     91           #pragma omp threadprivate(transformationMapList_ptr) 
    9292           static bool dummyTransformationMapList_; 
     93           #pragma omp threadprivate(dummyTransformationMapList_) 
    9394 
    9495 
  • XIOS/dev/branch_openmp/src/node/transformation.hpp

    r1328 r1331  
    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_openmp/src/node/zoom_axis.hpp

    r1328 r1331  
    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_openmp/src/node/zoom_domain.hpp

    r1328 r1331  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
     62      #pragma omp threadprivate(_dummyRegistered) 
    6263  }; // class CZoomDomain 
    6364 
  • XIOS/dev/branch_openmp/src/object_factory.hpp

    r1328 r1331  
    1212namespace xios 
    1313{ 
    14    /// ////////////////////// Déclarations ////////////////////// /// 
    15    class CObjectFactory 
    16    { 
    17       public : 
     14  /// ////////////////////// Déclarations ////////////////////// /// 
     15  class CObjectFactory 
     16  { 
     17    public : 
    1818 
    19          /// Mutateurs /// 
    20          static void SetCurrentContextId(const StdString & context); 
     19      /// Mutateurs /// 
     20      static void SetCurrentContextId(const StdString & context); 
    2121 
    22          /// Accesseurs /// 
    23          static StdString & GetCurrentContextId(void); 
     22      /// Accesseurs /// 
     23      static StdString & GetCurrentContextId(void); 
    2424 
    25          template <typename U> 
    26             static  boost::shared_ptr<U> GetObject(const StdString & id); 
     25      template <typename U> 
     26      static  boost::shared_ptr<U> GetObject(const StdString & id); 
    2727 
    28          template <typename U> 
    29             static  boost::shared_ptr<U> GetObject(const StdString& context,const StdString & id); 
     28      template <typename U> 
     29      static  boost::shared_ptr<U> GetObject(const StdString& context,const StdString & id); 
    3030 
    31          template <typename U> 
    32             static  boost::shared_ptr<U> GetObject(const U * const object); 
     31      template <typename U> 
     32      static  boost::shared_ptr<U> GetObject(const U * const object); 
    3333 
    34          template <typename U> 
    35             static  int GetObjectNum(void); 
    36          template <typename U> 
    37             static  int GetObjectIdNum(void); 
     34      template <typename U> 
     35      static  int GetObjectNum(void); 
     36      template <typename U> 
     37      static  int GetObjectIdNum(void); 
    3838 
    39          template <typename U> 
    40             static  const std::vector<boost::shared_ptr<U> > & 
    41                GetObjectVector(const StdString & context = CObjectFactory::GetCurrentContextId()); 
     39      template <typename U> 
     40      static  const std::vector<boost::shared_ptr<U> > & 
     41             GetObjectVector(const StdString & context = CObjectFactory::GetCurrentContextId()); 
    4242 
    43          /// Tests /// 
    44          template <typename U> 
    45             static  bool HasObject(const StdString & id); 
     43      /// Tests /// 
     44      template <typename U> 
     45      static  bool HasObject(const StdString & id); 
    4646 
    47          template <typename U> 
    48             static  bool HasObject(const StdString& context,const StdString & id); 
     47      template <typename U> 
     48      static  bool HasObject(const StdString& context,const StdString & id); 
    4949 
    50          /// Instanciateur /// 
    51          template <typename U> 
    52             static  boost::shared_ptr<U> CreateObject(const StdString & id = StdString("")); 
     50      /// Instanciateur /// 
     51      template <typename U> 
     52      static  boost::shared_ptr<U> CreateObject(const StdString & id = StdString("")); 
    5353 
    54          template <typename U> static const StdString& GetUIdBase(void); 
    55          template <typename U> static StdString GenUId(void); 
    56          template <typename U> static bool IsGenUId(const StdString& id); 
     54      template <typename U> static const StdString& GetUIdBase(void); 
     55      template <typename U> static StdString GenUId(void); 
     56      template <typename U> static bool IsGenUId(const StdString& id); 
    5757 
    58       private : 
     58    private : 
    5959 
    60          /// Propriétés statiques /// 
    61          static StdString CurrContext; 
     60      /// Propriétés statiques /// 
     61      static StdString CurrContext; 
     62//      #pragma omp threadprivate(CurrContext) 
    6263 
    63    }; // class CObjectFactory 
     64  }; // class CObjectFactory 
    6465} // namespace xios 
    6566 
  • XIOS/dev/branch_openmp/src/object_template.hpp

    r1328 r1331  
    1212namespace xios 
    1313{ 
    14    /// ////////////////////// Déclarations ////////////////////// /// 
    15    template <class T> 
    16       class CObjectTemplate 
    17          : public CObject 
    18          , public virtual CAttributeMap 
    19    { 
     14  /// ////////////////////// Déclarations ////////////////////// /// 
     15  template <class T> 
     16  class CObjectTemplate 
     17    : public CObject 
     18    , public virtual CAttributeMap 
     19  { 
    2020 
    21          /// Friend /// 
    22          friend class CObjectFactory; 
     21    /// Friend /// 
     22    friend class CObjectFactory; 
    2323 
    24          /// Typedef /// 
    25          typedef CAttributeMap SuperClassMap; 
    26          typedef CObject SuperClass; 
    27          typedef T DerivedType; 
     24    /// Typedef /// 
     25    typedef CAttributeMap SuperClassMap; 
     26    typedef CObject SuperClass; 
     27    typedef T DerivedType; 
    2828 
    29          enum EEventId 
    30          { 
    31            EVENT_ID_SEND_ATTRIBUTE=100 
    32          } ; 
     29    enum EEventId 
     30    { 
     31      EVENT_ID_SEND_ATTRIBUTE=100 
     32    } ; 
    3333 
    34       public : 
     34    public : 
    3535 
    36          /// Autres /// 
    37          virtual StdString toString(void) const; 
    38          virtual void fromString(const StdString & str); 
     36      /// Autres /// 
     37      virtual StdString toString(void) const; 
     38      virtual void fromString(const StdString & str); 
    3939 
    40 //         virtual void toBinary  (StdOStream & os) const; 
    41 //         virtual void fromBinary(StdIStream & is); 
    42          virtual string getName(void) const ; 
    43          virtual void parse(xml::CXMLNode & node); 
     40//      virtual void toBinary  (StdOStream & os) const; 
     41//      virtual void fromBinary(StdIStream & is); 
     42      virtual string getName(void) const ; 
     43      virtual void parse(xml::CXMLNode & node); 
    4444 
    45          /// Accesseurs /// 
    46          ENodeType getType(void) const; 
     45      /// Accesseurs /// 
     46      ENodeType getType(void) const; 
    4747 
    48          /// Test /// 
    49          virtual bool hasChild(void) const; 
     48      /// Test /// 
     49      virtual bool hasChild(void) const; 
    5050 
    51          /// Traitements /// 
    52          virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); 
     51      /// Traitements /// 
     52      virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); 
    5353 
    54          /// Traitement statique /// 
    55          static void ClearAllAttributes(void); 
    56          std::map<int, size_t> getMinimumBufferSizeForAttributes(); 
    57          void sendAttributToServer(const string& id); 
    58          void sendAttributToServer(CAttribute& attr) ; 
    59          void sendAllAttributesToServer(); 
    60          static void recvAttributFromClient(CEventServer& event) ; 
    61          static bool dispatchEvent(CEventServer& event) ; 
     54      /// Traitement statique /// 
     55      static void ClearAllAttributes(void); 
     56      std::map<int, size_t> getMinimumBufferSizeForAttributes(); 
     57      void sendAttributToServer(const string& id); 
     58      void sendAttributToServer(CAttribute& attr) ; 
     59      void sendAllAttributesToServer(); 
     60      static void recvAttributFromClient(CEventServer& event) ; 
     61      static bool dispatchEvent(CEventServer& event) ; 
    6262 
    63          bool isEqual(const string& id, const vector<StdString>& excludedAttrs); 
    64          bool isEqual(T* obj, const vector<StdString>& excludedAttrs); 
     63      bool isEqual(const string& id, const vector<StdString>& excludedAttrs); 
     64      bool isEqual(T* obj, const vector<StdString>& excludedAttrs); 
    6565 
    66          /// Accesseur statique /// 
    67          static std::vector<boost::shared_ptr<DerivedType> > & 
    68             GetAllVectobject(const StdString & contextId); 
     66      /// Accesseur statique /// 
     67      static std::vector<boost::shared_ptr<DerivedType> > & 
     68      GetAllVectobject(const StdString & contextId); 
    6969 
    70          /// Destructeur /// 
    71          virtual ~CObjectTemplate(void); 
     70      /// Destructeur /// 
     71      virtual ~CObjectTemplate(void); 
    7272 
    73          static bool has(const string& id) ; 
    74          static bool has(const string& contextId, const string& id) ; 
    75          static T* get(const string& id) ; 
    76          static T* get(const T* ptr) ; 
    77          static T* get(const string& contextId, const string& id) ; 
    78          T* get(void) ; 
    79          shared_ptr<T> getShared(void) ; 
    80          static shared_ptr<T> getShared(const T* ptr) ; 
     73      static bool has(const string& id) ; 
     74      static bool has(const string& contextId, const string& id) ; 
     75      static T* get(const string& id) ; 
     76      static T* get(const T* ptr) ; 
     77      static T* get(const string& contextId, const string& id) ; 
     78      T* get(void) ; 
     79      shared_ptr<T> getShared(void) ; 
     80      static shared_ptr<T> getShared(const T* ptr) ; 
    8181 
    82          static T* create(const string& id=string("")) ; 
    83          static const vector<T*> getAll() ; 
    84          static const vector<T*> getAll(const string& contextId) ; 
     82      static T* create(const string& id=string("")) ; 
     83      static const vector<T*> getAll() ; 
     84      static const vector<T*> getAll(const string& contextId) ; 
    8585 
    86          void generateCInterface(ostream& oss) ; 
    87          void generateFortran2003Interface(ostream& oss) ; 
    88          void generateFortranInterface(ostream& oss) ; 
     86      void generateCInterface(ostream& oss) ; 
     87      void generateFortran2003Interface(ostream& oss) ; 
     88      void generateFortranInterface(ostream& oss) ; 
    8989 
    90       protected : 
     90    protected : 
    9191 
    92          /// Constructeurs /// 
    93          CObjectTemplate(void); 
    94          explicit CObjectTemplate(const StdString & id); 
    95          CObjectTemplate(const CObjectTemplate<T> & object, 
    96                          bool withAttrList = true, bool withId = true); 
    97          CObjectTemplate(const CObjectTemplate<T> * const object); // Not implemented. 
     92      /// Constructeurs /// 
     93      CObjectTemplate(void); 
     94      explicit CObjectTemplate(const StdString & id); 
     95      CObjectTemplate(const CObjectTemplate<T> & object, 
     96                      bool withAttrList = true, bool withId = true); 
     97      CObjectTemplate(const CObjectTemplate<T> * const object); // Not implemented. 
    9898 
    99       private : 
     99    private : 
    100100 
    101          /// Propriétés statiques /// 
    102          static xios_map<StdString, 
    103                 xios_map<StdString, 
    104                 boost::shared_ptr<DerivedType> > > *AllMapObj_ptr; 
    105          static xios_map<StdString, 
    106                 std::vector<boost::shared_ptr<DerivedType> > > *AllVectObj_ptr; 
     101      /// Propriétés statiques /// 
     102      static xios_map<StdString, 
     103             xios_map<StdString, 
     104             boost::shared_ptr<DerivedType> > > *AllMapObj_ptr; 
     105      #pragma omp threadprivate(AllMapObj_ptr) 
     106      static xios_map<StdString, 
     107             std::vector<boost::shared_ptr<DerivedType> > > *AllVectObj_ptr; 
     108      #pragma omp threadprivate(AllVectObj_ptr) 
    107109 
    108          static xios_map< StdString, long int > *GenId_ptr ; 
     110      static xios_map< StdString, long int > *GenId_ptr ; 
     111      #pragma omp threadprivate(GenId_ptr) 
    109112 
    110    }; // class CObjectTemplate 
     113  }; // class CObjectTemplate 
    111114} // namespace xios 
    112115 
  • XIOS/dev/branch_openmp/src/test/test_remap_omp.f90

    r1329 r1331  
    5353  if(rank < size-2) then 
    5454  
    55   !$omp parallel default(firstprivate)  
     55  !$omp parallel default(private)  
    5656 
    5757!!! XIOS Initialization (get the local communicator) 
  • XIOS/dev/branch_openmp/src/timer.hpp

    r1328 r1331  
    2222      //static std::map<std::string,CTimer> allTimer; 
    2323      static std::map<std::string,CTimer> *allTimer_ptr; 
     24      #pragma omp threadprivate(allTimer_ptr) 
    2425      static double getTime(void); 
    2526      static CTimer& get(std::string name); 
  • XIOS/dev/branch_openmp/src/transformation/Functions/reduction.hpp

    r1328 r1331  
    2525  //static std::map<StdString,EReductionType> ReductionOperations; 
    2626  static std::map<StdString,EReductionType> *ReductionOperations_ptr; 
    27  
     27  #pragma omp threadprivate(ReductionOperations_ptr) 
    2828public: 
    2929  CReductionAlgorithm() {} 
     
    6262  typedef std::map<EReductionType, CreateOperationCallBack> CallBackMap; 
    6363  static CallBackMap* reductionCreationCallBacks_; 
     64  #pragma omp threadprivate(reductionCreationCallBacks_) 
    6465 
    6566  static bool registerOperation(EReductionType reduceType, CreateOperationCallBack createFn); 
     
    7071  static bool initReductionOperation(); 
    7172  static bool _dummyInit; 
     73  #pragma omp threadprivate(_dummyInit) 
    7274}; 
    7375 
  • XIOS/dev/branch_openmp/src/transformation/grid_transformation_factory_impl.hpp

    r1328 r1331  
    6060  static bool unregisterTransformation(ETranformationType transType); 
    6161  static bool initializeTransformation_; 
     62  #pragma omp threadprivate(initializeTransformation_) 
    6263}; 
    6364 
  • XIOS/dev/branch_openmp/src/xml_node.hpp

    r591 r1331  
    1010namespace xios 
    1111{ 
    12    namespace xml 
    13    { 
    14       /// ////////////////////// Déclarations ////////////////////// /// 
    15       typedef xios_map<StdString, StdString> THashAttributes; 
     12  namespace xml 
     13  { 
     14    /// ////////////////////// Déclarations ////////////////////// /// 
     15    typedef xios_map<StdString, StdString> THashAttributes; 
    1616 
    17       class CXMLNode 
    18       { 
    19          public : 
     17    class CXMLNode 
     18    { 
     19      public : 
    2020 
    21             /// Constructeurs /// 
    22             CXMLNode(rapidxml::xml_node<char> * const root); 
     21        /// Constructeurs /// 
     22        CXMLNode(rapidxml::xml_node<char> * const root); 
    2323 
    24             /// Destructeur /// 
    25             ~CXMLNode(void); 
     24        /// Destructeur /// 
     25        ~CXMLNode(void); 
    2626 
    27             /// Accesseurs /// 
    28             StdString getElementName(void) const; 
    29             THashAttributes getAttributes(void) const; 
     27        /// Accesseurs /// 
     28        StdString getElementName(void) const; 
     29        THashAttributes getAttributes(void) const; 
    3030 
    31             /// Mutateurs /// 
    32             bool goToNextElement(void); 
    33             bool goToChildElement(void); 
    34             bool goToParentElement(void); 
    35             bool getContent(StdString & content); 
     31        /// Mutateurs /// 
     32        bool goToNextElement(void); 
     33        bool goToChildElement(void); 
     34        bool goToParentElement(void); 
     35        bool getContent(StdString & content); 
    3636 
    37             /// Accesseurs statiques /// 
    38             static const StdString & GetRootName(void); 
     37        /// Accesseurs statiques /// 
     38        static const StdString & GetRootName(void); 
    3939 
    40          private : 
     40      private : 
    4141 
    42             /// Constructeurs /// 
    43             CXMLNode(void);                        // Not implemented yet. 
    44             CXMLNode(const CXMLNode & node);       // Not implemented yet. 
    45             CXMLNode(const CXMLNode * const node); // Not implemented yet. 
     42        /// Constructeurs /// 
     43        CXMLNode(void);                        // Not implemented yet. 
     44        CXMLNode(const CXMLNode & node);       // Not implemented yet. 
     45        CXMLNode(const CXMLNode * const node); // Not implemented yet. 
    4646 
    47             rapidxml::xml_node<char> * node; 
    48             int level; 
     47        rapidxml::xml_node<char> * node; 
     48        int level; 
    4949 
    50             static StdString RootName; 
     50        static StdString RootName; 
     51        #pragma omp threadprivate(RootName) 
    5152 
    52       }; //class CXMLParser 
    53  
    54    }// namespace xml 
     53    }; //class CXMLParser 
     54  
     55  }// namespace xml 
    5556} // namespace xios 
    5657 
  • XIOS/dev/branch_openmp/src/xml_parser.cpp

    r1031 r1331  
    1111   namespace xml 
    1212   { 
    13       /// ////////////////////// Définitions ////////////////////// /// 
     13      /// ////////////////////// Dfinitions ////////////////////// /// 
    1414 
    1515      void CXMLParser::ParseFile(const StdString & filename, const std::set<StdString>& parseContextList) 
  • XIOS/dev/branch_openmp/src/xml_parser.hpp

    r591 r1331  
    1010namespace xios 
    1111{ 
    12    namespace xml 
    13    { 
    14       /// ////////////////////// Déclarations ////////////////////// /// 
    15       class CXMLParser 
    16       { 
    17          public : 
     12  namespace xml 
     13  { 
     14    /// ////////////////////// Déclarations ////////////////////// /// 
     15    class CXMLParser 
     16    { 
     17      public : 
     18        static void ParseFile(const StdString & filename, const std::set<StdString>& parseList = std::set<StdString>()); 
     19        static void ParseString(const StdString & xmlContent); 
     20        static void ParseStream(StdIStream & stream, const string& fluxId, const std::set<StdString>& parseList); 
     21        template <class T> 
     22        static void ParseInclude(StdIStream & stream, const string& fluxId, T & object); 
    1823 
    19             static void ParseFile(const StdString & filename, const std::set<StdString>& parseList = std::set<StdString>()); 
    20             static void ParseString(const StdString & xmlContent); 
    21             static void ParseStream(StdIStream & stream, const string& fluxId, const std::set<StdString>& parseList); 
    22             template <class T> 
    23                static void ParseInclude(StdIStream & stream, const string& fluxId, T & object); 
    24  
    25       }; //class CXMLParser 
    26 /* 
    27       template <class T> 
    28          void CXMLParser::ParseInclude(StdIStream & stream, T& object) 
    29       { 
    30          StdOStringStream oss; 
    31          while(!stream.eof() && !stream.fail ()) 
    32             oss.put(stream.get()); 
    33          try 
    34          { 
    35             const StdString xmlcontent( oss.str(), 0, oss.str().size()-1 ); 
    36             rapidxml::xml_document<char> doc; 
    37             doc.parse<0>(const_cast<char*>(xmlcontent.c_str())); 
    38             CXMLNode node(doc.first_node()); 
    39             object.parse(node); 
    40          } 
    41          catch (rapidxml::parse_error & exc) 
    42          { 
    43             ERROR("CXMLParser::ParseStream(StdIStream & stream)", 
    44                   << "RapidXML error : " << exc.what() << " !"); 
    45          } 
    46       } 
    47 */ 
    48    }// namespace xml 
     24    }; //class CXMLParser 
     25  }// namespace xml 
    4926} // namespace xios 
    5027 
Note: See TracChangeset for help on using the changeset viewer.