Changeset 1331
- Timestamp:
- 11/16/17 16:20:41 (7 years ago)
- Location:
- XIOS/dev/branch_openmp
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/bld.cfg
r1329 r1331 40 40 #bld::target test_omp.exe 41 41 #bld::target test_complete_omp.exe 42 bld::target test_remap.exe42 #bld::target test_remap.exe 43 43 bld::target test_remap_ref.exe 44 44 bld::target test_remap_omp.exe 45 45 #bld::target test_unstruct_omp.exe 46 46 #bld::target test_netcdf_omp.exe 47 bld::target test_client.exe48 bld::target test_complete.exe47 #bld::target test_client.exe 48 #bld::target test_complete.exe 49 49 #bld::target test_remap.exe 50 50 #bld::target test_unstruct.exe -
XIOS/dev/branch_openmp/src/attribute_map.hpp
r1328 r1331 76 76 /// Propriété statique /// 77 77 static CAttributeMap * Current; 78 #pragma omp threadprivate(Current) 78 79 79 80 }; // class CAttributeMap -
XIOS/dev/branch_openmp/src/buffer_client.hpp
r1328 r1331 13 13 public: 14 14 static size_t maxRequestSize; 15 #pragma omp threadprivate(maxRequestSize) 15 16 16 17 CClientBuffer(ep_lib::MPI_Comm intercomm, int serverRank, StdSize bufferSize, StdSize estimatedMaxEventSize, StdSize maxBufferedEvents); -
XIOS/dev/branch_openmp/src/client.hpp
r1328 r1331 7 7 namespace xios 8 8 { 9 10 11 12 13 14 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); 15 15 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) 22 21 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) 25 25 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) 32 31 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(); 39 34 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(); 44 41 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 }; 47 60 } 48 61 -
XIOS/dev/branch_openmp/src/cxios.cpp
r1328 r1331 15 15 namespace xios 16 16 { 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"; 21 21 22 22 bool CXios::isClient ; … … 37 37 { 38 38 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 40 48 parseXiosConfig(); 41 49 } … … 78 86 if(isServer) 79 87 { 80 num_ep = omp_get_num_threads();88 num_ep = 1; 81 89 } 82 90 -
XIOS/dev/branch_openmp/src/cxios.hpp
r1328 r1331 14 14 { 15 15 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) ; 21 21 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) ; 24 24 25 template <typename T>26 static T getin(const string& id) ;25 template <typename T> 26 static T getin(const string& id) ; 27 27 28 28 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) 33 34 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) 36 39 37 static ep_lib::MPI_Comm globalComm ; //!< Global communicator 40 static ep_lib::MPI_Comm globalComm ; //!< Global communicator 41 #pragma omp threadprivate(globalComm) 38 42 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) 48 60 49 61 public: 50 //! Setting xios to use server mode51 static void setUsingServer();62 //! Setting xios to use server mode 63 static void setUsingServer(); 52 64 53 //! Setting xios NOT to use server mode54 static void setNotUsingServer();65 //! Setting xios NOT to use server mode 66 static void setNotUsingServer(); 55 67 56 //! Initialize server (if any)57 static void initServer();68 //! Initialize server (if any) 69 static void initServer(); 58 70 59 71 private: -
XIOS/dev/branch_openmp/src/filter/spatial_transform_filter.hpp
r1328 r1331 105 105 //static std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> > engines; 106 106 static std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> > *engines_ptr; 107 #pragma om threadprivate(engines_ptr) 107 108 }; // class CSpatialTransformFilterEngine 108 109 } // namespace xios -
XIOS/dev/branch_openmp/src/group_factory.hpp
r1328 r1331 70 70 /// Propriétés statiques /// 71 71 static StdString CurrContext; 72 // #pragma omp threadprivate(CurrContext) 72 73 73 74 }; // class CGroupFactory -
XIOS/dev/branch_openmp/src/indent.hpp
r1328 r1331 10 10 public: 11 11 static int defaultIncSize; 12 #pragma omp threadprivate(defaultIncSize) 12 13 static int index ; 14 #pragma omp threadprivate(index) 13 15 int incSize ; 14 16 int offset ; -
XIOS/dev/branch_openmp/src/indent_xml.hpp
r1328 r1331 8 8 namespace xios 9 9 { 10 11 12 13 10 /// ////////////////////// Déclarations ////////////////////// /// 11 class CIndent 12 { 13 public : 14 14 15 16 17 18 15 /// Méthodes statiques /// 16 static StdOStream & NIndent (StdOStream & out); 17 static StdOStream & IncIndent(StdOStream & out); 18 static StdOStream & DecEndl (StdOStream & out); 19 19 20 20 private : 21 21 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) 26 29 27 30 }; // class CIndent 28 31 29 32 ///-------------------------------------------------------------- 30 33 31 class CIndentedXml 32 { 33 public : 34 class CIndentedXml 35 { 36 public : 37 /// Méthode statique /// 38 static StdString Indented(const StdString & content); 34 39 35 /// Méthode statique /// 36 static StdString Indented(const StdString & content); 40 }; // class CIndentedXml 37 41 38 }; // class CIndentedXml 39 40 ///-------------------------------------------------------------- 42 ///-------------------------------------------------------------- 41 43 42 44 } // namespace xios -
XIOS/dev/branch_openmp/src/node/axis.hpp
r1328 r1331 173 173 static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 174 174 static bool initializeTransformationMap(); 175 //static std::map<StdString, ETranformationType> transformationMapList_;176 175 static std::map<StdString, ETranformationType> *transformationMapList_ptr; 176 #pragma omp threadprivate(transformationMapList_ptr) 177 177 static bool dummyTransformationMapList_; 178 #pragma omp threadprivate(dummyTransformationMapList_) 178 179 179 180 DECLARE_REF_FUNC(Axis,axis) -
XIOS/dev/branch_openmp/src/node/compute_connectivity_domain.hpp
r1328 r1331 60 60 static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 61 61 static bool _dummyRegistered; 62 #pragma omp threadprivate(_dummyRegistered) 62 63 }; // class CComputeConnectivityDomain 63 64 -
XIOS/dev/branch_openmp/src/node/context.cpp
r1328 r1331 23 23 namespace xios { 24 24 25 shared_ptr<CContextGroup> CContext::root;26 27 /// ////////////////////// D éfinitions ////////////////////// ///25 shared_ptr<CContextGroup> * CContext::root_ptr = 0; 26 27 /// ////////////////////// Dfinitions ////////////////////// /// 28 28 29 29 CContext::CContext(void) … … 59 59 CContextGroup* CContext::getRoot(void) 60 60 { 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(); 63 64 } 64 65 … … 182 183 if (!this->hasChild()) 183 184 { 184 //oss << "<!-- No definition -->" << std::endl; // fait planter l'incr émentation185 //oss << "<!-- No definition -->" << std::endl; // fait planter l'incrmentation 185 186 } 186 187 else … … 555 556 void CContext::solveAllInheritance(bool apply) // default : apply = true 556 557 { 557 // R ésolution des héritages descendants (cà d des héritages de groupes)558 // Rsolution des hritages descendants (cd des hritages de groupes) 558 559 // pour chacun des contextes. 559 560 solveDescInheritance(apply); 560 561 561 // R ésolution des héritages par référence au niveau des fichiers.562 // Rsolution des hritages par rfrence au niveau des fichiers. 562 563 const vector<CFile*> allFiles=CFile::getAll(); 563 564 const vector<CGrid*> allGrids= CGrid::getAll(); … … 583 584 584 585 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. 586 587 { 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. 588 589 { 589 590 if ((initDate + allFiles[i]->output_freq.getValue()) < (initDate + this->getCalendar()->getTimeStep())) … … 610 611 611 612 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 \"" 613 614 << getId() << "\" !"); 614 615 } … … 847 848 prepareTimeseries(); 848 849 849 //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers Ãsortir.850 //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers sortir. 850 851 this->findEnabledFiles(); 851 852 this->findEnabledReadModeFiles(); … … 1257 1258 CContext* context = CObjectFactory::CreateObject<CContext>(id).get(); 1258 1259 getRoot(); 1259 if (!hasctxt) CGroupFactory::AddChild( root, context->getShared());1260 if (!hasctxt) CGroupFactory::AddChild(*root_ptr, context->getShared()); 1260 1261 1261 1262 #define DECLARE_NODE(Name_, name_) \ -
XIOS/dev/branch_openmp/src/node/context.hpp
r1328 r1331 206 206 207 207 // Context root 208 static shared_ptr<CContextGroup> root; 208 static shared_ptr<CContextGroup> *root_ptr; 209 #pragma omp threadprivate(root_ptr) 209 210 210 211 // Determine context on client or not -
XIOS/dev/branch_openmp/src/node/domain.hpp
r1328 r1331 217 217 static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 218 218 static bool initializeTransformationMap(); 219 //static std::map<StdString, ETranformationType> transformationMapList_;220 219 static std::map<StdString, ETranformationType> *transformationMapList_ptr; 220 #pragma omp threadprivate(transformationMapList_ptr) 221 221 static bool _dummyTransformationMapList; 222 #pragma omp threadprivate(_dummyTransformationMapList) 222 223 223 224 DECLARE_REF_FUNC(Domain,domain) -
XIOS/dev/branch_openmp/src/node/expand_domain.hpp
r1328 r1331 60 60 static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 61 61 static bool _dummyRegistered; 62 #pragma omp threadprivate(_dummyRegistered) 62 63 }; // class CExpandDomain 63 64 -
XIOS/dev/branch_openmp/src/node/extract_axis_to_scalar.hpp
r1328 r1331 60 60 static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node); 61 61 static bool _dummyRegistered; 62 #pragma omp threadprivate(_dummyRegistered) 62 63 }; // class CExtractAxisToScalar 63 64 -
XIOS/dev/branch_openmp/src/node/extract_domain_to_axis.hpp
r1328 r1331 60 60 static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 61 61 static bool _dummyRegistered; 62 #pragma omp threadprivate(_dummyRegistered) 62 63 }; // class CExtractDomainToAxis 63 64 -
XIOS/dev/branch_openmp/src/node/generate_rectilinear_domain.hpp
r1328 r1331 60 60 static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 61 61 static bool _dummyRegistered; 62 #pragma omp threadprivate(_dummyRegistered) 62 63 }; // class CGenerateRectilinearDomain 63 64 -
XIOS/dev/branch_openmp/src/node/interpolate_axis.hpp
r1328 r1331 62 62 static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 63 63 static bool _dummyRegistered; 64 #pragma omp threadprivate(_dummyRegistered) 64 65 }; // class CInterpolateAxis 65 66 -
XIOS/dev/branch_openmp/src/node/interpolate_domain.hpp
r1328 r1331 60 60 static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 61 61 static bool _dummyRegistered; 62 #pragma omp threadprivate(_dummyRegistered) 62 63 }; // class CInterpolateDomain 63 64 -
XIOS/dev/branch_openmp/src/node/inverse_axis.hpp
r1328 r1331 59 59 static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 60 60 static bool _dummyRegistered; 61 #pragma omp threadprivate(_dummyRegistered) 61 62 62 63 }; // class CInverseAxis -
XIOS/dev/branch_openmp/src/node/mesh.hpp
r1328 r1331 80 80 int nbFaces_; 81 81 82 //static std::map <StdString, CMesh> meshList;83 82 static std::map <StdString, CMesh> *meshList_ptr; 84 //static std::map <StdString, vector<int> > domainList;83 #pragma omp threadprivate(meshList_ptr) 85 84 static std::map <StdString, vector<int> > *domainList_ptr; 85 #pragma omp threadprivate(domainList_ptr) 86 86 CClientClientDHTSizet* pNodeGlobalIndex; // pointer to a map <nodeHash, nodeIdxGlo> 87 87 CClientClientDHTSizet* pEdgeGlobalIndex; // pointer to a map <edgeHash, edgeIdxGlo> -
XIOS/dev/branch_openmp/src/node/reduce_axis_to_scalar.hpp
r1328 r1331 59 59 static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node); 60 60 static bool _dummyRegistered; 61 #pragma omp threadprivate(_dummyRegistered) 61 62 }; // class CReduceAxisToScalar 62 63 -
XIOS/dev/branch_openmp/src/node/reduce_domain_to_axis.hpp
r1328 r1331 60 60 static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 61 61 static bool _dummyRegistered; 62 #pragma omp threadprivate(_dummyRegistered) 62 63 }; // class CReduceDomainToAxis 63 64 -
XIOS/dev/branch_openmp/src/node/reduce_domain_to_scalar.hpp
r1328 r1331 60 60 static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node); 61 61 static bool _dummyRegistered; 62 #pragma omp threadprivate(_dummyRegistered) 62 63 }; // class CReduceDomainToScalar 63 64 -
XIOS/dev/branch_openmp/src/node/scalar.hpp
r1328 r1331 88 88 static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 89 89 static bool initializeTransformationMap(); 90 //static std::map<StdString, ETranformationType> transformationMapList_;91 90 static std::map<StdString, ETranformationType> *transformationMapList_ptr; 91 #pragma omp threadprivate(transformationMapList_ptr) 92 92 static bool dummyTransformationMapList_; 93 #pragma omp threadprivate(dummyTransformationMapList_) 93 94 94 95 -
XIOS/dev/branch_openmp/src/node/transformation.hpp
r1328 r1331 35 35 typedef std::map<ETranformationType, CreateTransformationCallBack> CallBackMap; 36 36 static CallBackMap* transformationCreationCallBacks_; 37 #pragma omp threadprivate(transformationCreationCallBacks_) 37 38 38 39 static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn); -
XIOS/dev/branch_openmp/src/node/zoom_axis.hpp
r1328 r1331 60 60 static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 61 61 static bool _dummyRegistered; 62 #pragma omp threadprivate(_dummyRegistered) 62 63 }; // class CZoomAxis 63 64 -
XIOS/dev/branch_openmp/src/node/zoom_domain.hpp
r1328 r1331 60 60 static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 61 61 static bool _dummyRegistered; 62 #pragma omp threadprivate(_dummyRegistered) 62 63 }; // class CZoomDomain 63 64 -
XIOS/dev/branch_openmp/src/object_factory.hpp
r1328 r1331 12 12 namespace xios 13 13 { 14 15 16 17 14 /// ////////////////////// Déclarations ////////////////////// /// 15 class CObjectFactory 16 { 17 public : 18 18 19 20 19 /// Mutateurs /// 20 static void SetCurrentContextId(const StdString & context); 21 21 22 23 22 /// Accesseurs /// 23 static StdString & GetCurrentContextId(void); 24 24 25 26 25 template <typename U> 26 static boost::shared_ptr<U> GetObject(const StdString & id); 27 27 28 29 28 template <typename U> 29 static boost::shared_ptr<U> GetObject(const StdString& context,const StdString & id); 30 30 31 32 31 template <typename U> 32 static boost::shared_ptr<U> GetObject(const U * const object); 33 33 34 35 36 37 34 template <typename U> 35 static int GetObjectNum(void); 36 template <typename U> 37 static int GetObjectIdNum(void); 38 38 39 40 41 39 template <typename U> 40 static const std::vector<boost::shared_ptr<U> > & 41 GetObjectVector(const StdString & context = CObjectFactory::GetCurrentContextId()); 42 42 43 44 45 43 /// Tests /// 44 template <typename U> 45 static bool HasObject(const StdString & id); 46 46 47 48 47 template <typename U> 48 static bool HasObject(const StdString& context,const StdString & id); 49 49 50 51 52 50 /// Instanciateur /// 51 template <typename U> 52 static boost::shared_ptr<U> CreateObject(const StdString & id = StdString("")); 53 53 54 55 56 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); 57 57 58 58 private : 59 59 60 /// Propriétés statiques /// 61 static StdString CurrContext; 60 /// Propriétés statiques /// 61 static StdString CurrContext; 62 // #pragma omp threadprivate(CurrContext) 62 63 63 64 }; // class CObjectFactory 64 65 } // namespace xios 65 66 -
XIOS/dev/branch_openmp/src/object_template.hpp
r1328 r1331 12 12 namespace xios 13 13 { 14 15 16 17 18 19 14 /// ////////////////////// Déclarations ////////////////////// /// 15 template <class T> 16 class CObjectTemplate 17 : public CObject 18 , public virtual CAttributeMap 19 { 20 20 21 22 21 /// Friend /// 22 friend class CObjectFactory; 23 23 24 25 26 27 24 /// Typedef /// 25 typedef CAttributeMap SuperClassMap; 26 typedef CObject SuperClass; 27 typedef T DerivedType; 28 28 29 30 31 32 29 enum EEventId 30 { 31 EVENT_ID_SEND_ATTRIBUTE=100 32 } ; 33 33 34 34 public : 35 35 36 37 38 36 /// Autres /// 37 virtual StdString toString(void) const; 38 virtual void fromString(const StdString & str); 39 39 40 // 41 // 42 43 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); 44 44 45 46 45 /// Accesseurs /// 46 ENodeType getType(void) const; 47 47 48 49 48 /// Test /// 49 virtual bool hasChild(void) const; 50 50 51 52 51 /// Traitements /// 52 virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); 53 53 54 55 56 57 58 59 60 61 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) ; 62 62 63 64 63 bool isEqual(const string& id, const vector<StdString>& excludedAttrs); 64 bool isEqual(T* obj, const vector<StdString>& excludedAttrs); 65 65 66 67 68 66 /// Accesseur statique /// 67 static std::vector<boost::shared_ptr<DerivedType> > & 68 GetAllVectobject(const StdString & contextId); 69 69 70 71 70 /// Destructeur /// 71 virtual ~CObjectTemplate(void); 72 72 73 74 75 76 77 78 79 80 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) ; 81 81 82 83 84 82 static T* create(const string& id=string("")) ; 83 static const vector<T*> getAll() ; 84 static const vector<T*> getAll(const string& contextId) ; 85 85 86 87 88 86 void generateCInterface(ostream& oss) ; 87 void generateFortran2003Interface(ostream& oss) ; 88 void generateFortranInterface(ostream& oss) ; 89 89 90 90 protected : 91 91 92 93 94 95 96 97 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. 98 98 99 99 private : 100 100 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) 107 109 108 static xios_map< StdString, long int > *GenId_ptr ; 110 static xios_map< StdString, long int > *GenId_ptr ; 111 #pragma omp threadprivate(GenId_ptr) 109 112 110 113 }; // class CObjectTemplate 111 114 } // namespace xios 112 115 -
XIOS/dev/branch_openmp/src/test/test_remap_omp.f90
r1329 r1331 53 53 if(rank < size-2) then 54 54 55 !$omp parallel default( firstprivate)55 !$omp parallel default(private) 56 56 57 57 !!! XIOS Initialization (get the local communicator) -
XIOS/dev/branch_openmp/src/timer.hpp
r1328 r1331 22 22 //static std::map<std::string,CTimer> allTimer; 23 23 static std::map<std::string,CTimer> *allTimer_ptr; 24 #pragma omp threadprivate(allTimer_ptr) 24 25 static double getTime(void); 25 26 static CTimer& get(std::string name); -
XIOS/dev/branch_openmp/src/transformation/Functions/reduction.hpp
r1328 r1331 25 25 //static std::map<StdString,EReductionType> ReductionOperations; 26 26 static std::map<StdString,EReductionType> *ReductionOperations_ptr; 27 27 #pragma omp threadprivate(ReductionOperations_ptr) 28 28 public: 29 29 CReductionAlgorithm() {} … … 62 62 typedef std::map<EReductionType, CreateOperationCallBack> CallBackMap; 63 63 static CallBackMap* reductionCreationCallBacks_; 64 #pragma omp threadprivate(reductionCreationCallBacks_) 64 65 65 66 static bool registerOperation(EReductionType reduceType, CreateOperationCallBack createFn); … … 70 71 static bool initReductionOperation(); 71 72 static bool _dummyInit; 73 #pragma omp threadprivate(_dummyInit) 72 74 }; 73 75 -
XIOS/dev/branch_openmp/src/transformation/grid_transformation_factory_impl.hpp
r1328 r1331 60 60 static bool unregisterTransformation(ETranformationType transType); 61 61 static bool initializeTransformation_; 62 #pragma omp threadprivate(initializeTransformation_) 62 63 }; 63 64 -
XIOS/dev/branch_openmp/src/xml_node.hpp
r591 r1331 10 10 namespace xios 11 11 { 12 13 14 15 12 namespace xml 13 { 14 /// ////////////////////// Déclarations ////////////////////// /// 15 typedef xios_map<StdString, StdString> THashAttributes; 16 16 17 18 19 17 class CXMLNode 18 { 19 public : 20 20 21 22 21 /// Constructeurs /// 22 CXMLNode(rapidxml::xml_node<char> * const root); 23 23 24 25 24 /// Destructeur /// 25 ~CXMLNode(void); 26 26 27 28 29 27 /// Accesseurs /// 28 StdString getElementName(void) const; 29 THashAttributes getAttributes(void) const; 30 30 31 32 33 34 35 31 /// Mutateurs /// 32 bool goToNextElement(void); 33 bool goToChildElement(void); 34 bool goToParentElement(void); 35 bool getContent(StdString & content); 36 36 37 38 37 /// Accesseurs statiques /// 38 static const StdString & GetRootName(void); 39 39 40 40 private : 41 41 42 43 44 45 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. 46 46 47 48 47 rapidxml::xml_node<char> * node; 48 int level; 49 49 50 static StdString RootName; 50 static StdString RootName; 51 #pragma omp threadprivate(RootName) 51 52 52 53 54 53 }; //class CXMLParser 54 55 }// namespace xml 55 56 } // namespace xios 56 57 -
XIOS/dev/branch_openmp/src/xml_parser.cpp
r1031 r1331 11 11 namespace xml 12 12 { 13 /// ////////////////////// D éfinitions ////////////////////// ///13 /// ////////////////////// Dfinitions ////////////////////// /// 14 14 15 15 void CXMLParser::ParseFile(const StdString & filename, const std::set<StdString>& parseContextList) -
XIOS/dev/branch_openmp/src/xml_parser.hpp
r591 r1331 10 10 namespace xios 11 11 { 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); 18 23 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 49 26 } // namespace xios 50 27
Note: See TracChangeset
for help on using the changeset viewer.