Changeset 1088


Ignore:
Timestamp:
04/12/17 15:18:22 (5 years ago)
Author:
yushan
Message:

save

Location:
XIOS/dev/branch_yushan/src
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan/src/attribute_map.hpp

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

    r1072 r1088  
    1616    public: 
    1717      static size_t maxRequestSize; 
    18       //#pragma omp threadprivate(maxRequestSize) 
     18      #pragma omp threadprivate(maxRequestSize) 
    1919 
    2020      CClientBuffer(MPI_Comm intercomm, int serverRank, StdSize bufferSize, StdSize maxBufferedEvents); 
  • XIOS/dev/branch_yushan/src/cxios.hpp

    r1081 r1088  
    6666       
    6767      static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers 
    68  
     68     
    6969       
    7070       
  • XIOS/dev/branch_yushan/src/event_client.hpp

    r1072 r1088  
    1212    public: 
    1313      static const size_t headerSize; 
    14       //#pragma omp threadprivate(headerSize) 
    1514 
    1615      CEventClient(int classId, int typeId); 
  • XIOS/dev/branch_yushan/src/filter/spatial_transform_filter.cpp

    r1053 r1088  
    6464  } 
    6565 
    66   std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> > CSpatialTransformFilterEngine::engines; 
     66  std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> > *CSpatialTransformFilterEngine::engines_ptr = 0; 
    6767 
    6868  CSpatialTransformFilterEngine* CSpatialTransformFilterEngine::get(CGridTransformation* gridTransformation) 
     
    7171      ERROR("CSpatialTransformFilterEngine& CSpatialTransformFilterEngine::get(CGridTransformation* gridTransformation)", 
    7272            "Impossible to get the requested engine, the grid transformation is invalid."); 
    73  
    74     std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> >::iterator it = engines.find(gridTransformation); 
    75     if (it == engines.end()) 
     73     
     74    if(engines_ptr == NULL) engines_ptr = new std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> >; 
     75 
     76    std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> >::iterator it = engines_ptr->find(gridTransformation); 
     77    if (it == engines_ptr->end()) 
    7678    { 
    7779      boost::shared_ptr<CSpatialTransformFilterEngine> engine(new CSpatialTransformFilterEngine(gridTransformation)); 
    78       it = engines.insert(std::make_pair(gridTransformation, engine)).first; 
     80      it = engines_ptr->insert(std::make_pair(gridTransformation, engine)).first; 
    7981    } 
    8082 
  • XIOS/dev/branch_yushan/src/filter/spatial_transform_filter.hpp

    r1072 r1088  
    103103      //! The allocated engines 
    104104      static std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> > engines; 
    105       // #pragma omp threadprivate(engines) 
     105      static std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> > *engines_ptr; 
     106      #pragma omp threadprivate(engines_ptr) 
    106107       
    107108  }; // class CSpatialTransformFilterEngine 
  • XIOS/dev/branch_yushan/src/group_factory.cpp

    r501 r1088  
    55   /// ////////////////////// Définitions ////////////////////// /// 
    66   StdString CGroupFactory::CurrContext(""); 
     7   StdString *CGroupFactory::CurrContext_ptr = new StdString; 
    78 
    89   void CGroupFactory::SetCurrentContextId(const StdString & context) 
    910   {  
    1011      CGroupFactory::CurrContext = context; 
     12      *CGroupFactory::CurrContext_ptr = context; 
    1113   } 
    1214 
    1315   StdString & CGroupFactory::GetCurrentContextId(void) 
    1416   {  
    15       return (CGroupFactory::CurrContext); 
     17      //return (CGroupFactory::CurrContext); 
     18      return (*CGroupFactory::CurrContext_ptr); 
    1619   } 
    1720 
  • XIOS/dev/branch_yushan/src/group_factory.hpp

    r1087 r1088  
    7070         /// Propriétés statiques /// 
    7171         static StdString CurrContext; 
    72          #pragma omp threadprivate(CurrContext) 
     72         static StdString *CurrContext_ptr; 
     73         #pragma omp threadprivate(CurrContext_ptr) 
    7374 
    7475   }; // class CGroupFactory 
  • XIOS/dev/branch_yushan/src/indent.hpp

    r1072 r1088  
    1010    public: 
    1111    static int defaultIncSize; 
    12     //#pragma omp threadprivate(defaultIncSize) 
     12    #pragma omp threadprivate(defaultIncSize) 
    1313     
    1414    static int index ; 
    15     //#pragma omp threadprivate(index) 
     15    #pragma omp threadprivate(index) 
    1616     
    1717    int incSize ; 
  • XIOS/dev/branch_yushan/src/indent_xml.cpp

    r1079 r1088  
    1515   { 
    1616      static unsigned int LineNB = 1; 
    17       //#pragma omp threadprivate(LineNB) 
     17      #pragma omp threadprivate(LineNB) 
    1818       
    1919      if (CIndent::WithLine) out << LineNB++ << ". "; 
  • XIOS/dev/branch_yushan/src/indent_xml.hpp

    r1072 r1088  
    2222         /// Propriétés  statiques /// 
    2323         static unsigned int Indent; 
    24          //#pragma omp threadprivate(Indent) 
     24         #pragma omp threadprivate(Indent) 
    2525 
    2626         static StdString    Increm; 
    27          //#pragma omp threadprivate(Increm) 
     27         #pragma omp threadprivate(Increm) 
    2828 
    2929         static bool         WithLine; 
    30          //#pragma omp threadprivate(WithLine) 
     30         #pragma omp threadprivate(WithLine) 
    3131 
    3232   }; // class CIndent 
  • XIOS/dev/branch_yushan/src/interface/c/icdata.cpp

    r1081 r1088  
    131131      
    132132     CContext* context = CContext::getCurrent(); 
    133      printf("Check : CContext::getCurrent() = %p\n", CContext::getCurrent()); 
     133     //printf("Check : CContext::getCurrent() = %p\n", CContext::getCurrent()); 
    134134     context->finalize(); 
    135135           
  • XIOS/dev/branch_yushan/src/io/netCdf_cf_constant.hpp

    r1079 r1088  
    2828  static const std::set<StdString> XIOS_CF_Longitude_units; 
    2929 
    30   // #pragma omp threadprivate(XIOS_CF_Latitude_units, XIOS_CF_Longitude_units) 
    31  
    3230private: 
    3331  CCFConvention(); 
  • XIOS/dev/branch_yushan/src/memtrack.cpp

    r1072 r1088  
    6868        private:    // static member variables 
    6969            static BlockHeader *ourFirstNode; 
    70             //#pragma omp threadprivate(ourFirstNode) 
     70            #pragma omp threadprivate(ourFirstNode) 
    7171     
    7272        private:    // member variables 
     
    245245            static const unsigned int SIGNATURE1 = 0xCAFEBABE; 
    246246            static const unsigned int SIGNATURE2 = 0xFACEFACE; 
    247  
    248             //#pragma omp threadprivate(SIGNATURE1, SIGNATURE2) 
    249247         
    250248        private:    // member variables 
  • XIOS/dev/branch_yushan/src/node/axis.cpp

    r1053 r1088  
    4444   { /* Ne rien faire de plus */ } 
    4545 
    46    std::map<StdString, ETranformationType> CAxis::transformationMapList_ = std::map<StdString, ETranformationType>(); 
    47    bool CAxis::dummyTransformationMapList_ = CAxis::initializeTransformationMap(CAxis::transformationMapList_); 
     46   //std::map<StdString, ETranformationType> CAxis::transformationMapList_ = std::map<StdString, ETranformationType>(); 
     47   std::map<StdString, ETranformationType> *CAxis::transformationMapList_ptr = new std::map<StdString, ETranformationType>; 
     48   bool CAxis::dummyTransformationMapList_ = CAxis::initializeTransformationMap(*CAxis::transformationMapList_ptr); 
    4849   bool CAxis::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
    4950   { 
     
    10041005 
    10051006        nodeElementName = node.getElementName(); 
    1006         std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it; 
    1007         it = transformationMapList_.find(nodeElementName); 
     1007        std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_ptr->end(), it; 
     1008        it = transformationMapList_ptr->find(nodeElementName); 
    10081009        if (ite != it) 
    10091010        { 
  • XIOS/dev/branch_yushan/src/node/axis.hpp

    r1072 r1088  
    166166       private: 
    167167         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    168          static std::map<StdString, ETranformationType> transformationMapList_; 
    169          // #pragma omp threadprivate(transformationMapList_) 
     168         //static std::map<StdString, ETranformationType> transformationMapList_; 
     169         static std::map<StdString, ETranformationType> *transformationMapList_ptr; 
     170         #pragma omp threadprivate(transformationMapList_ptr) 
    170171 
    171172         static bool dummyTransformationMapList_; 
    172          //#pragma omp threadprivate(dummyTransformationMapList_) 
     173         #pragma omp threadprivate(dummyTransformationMapList_) 
    173174 
    174175         DECLARE_REF_FUNC(Axis,axis) 
  • XIOS/dev/branch_yushan/src/node/compute_connectivity_domain.hpp

    r1072 r1088  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       //#pragma omp threadprivate(_dummyRegistered) 
     62      #pragma omp threadprivate(_dummyRegistered) 
    6363       
    6464  }; // class CComputeConnectivityDomain 
  • XIOS/dev/branch_yushan/src/node/domain.cpp

    r1070 r1088  
    6565   } 
    6666 
    67    std::map<StdString, ETranformationType> CDomain::transformationMapList_ = std::map<StdString, ETranformationType>(); 
    68    bool CDomain::_dummyTransformationMapList = CDomain::initializeTransformationMap(CDomain::transformationMapList_); 
     67   std::map<StdString, ETranformationType> * CDomain::transformationMapList_ptr = new std::map<StdString, ETranformationType>; 
     68   bool CDomain::_dummyTransformationMapList = CDomain::initializeTransformationMap(*CDomain::transformationMapList_ptr); 
    6969 
    7070   bool CDomain::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
     
    21892189 
    21902190        nodeElementName = node.getElementName(); 
    2191         std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it; 
    2192         it = transformationMapList_.find(nodeElementName); 
     2191        std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_ptr->end(), it; 
     2192        it = transformationMapList_ptr->find(nodeElementName); 
    21932193        if (ite != it) 
    21942194        { 
  • XIOS/dev/branch_yushan/src/node/domain.hpp

    r1072 r1088  
    211211       private: 
    212212         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    213          static std::map<StdString, ETranformationType> transformationMapList_; 
     213         static std::map<StdString, ETranformationType> *transformationMapList_ptr; 
    214214         static bool _dummyTransformationMapList; 
    215          //#pragma omp threadprivate(_dummyTransformationMapList) 
     215         #pragma omp threadprivate(transformationMapList_ptr, _dummyTransformationMapList) 
    216216 
    217217         DECLARE_REF_FUNC(Domain,domain) 
  • XIOS/dev/branch_yushan/src/node/expand_domain.hpp

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

    r1072 r1088  
    6060      static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       //#pragma omp threadprivate(_dummyRegistered) 
     62      #pragma omp threadprivate(_dummyRegistered) 
    6363  }; // class CExtractAxisToScalar 
    6464 
  • XIOS/dev/branch_yushan/src/object_factory.cpp

    r501 r1088  
    66 
    77   StdString CObjectFactory::CurrContext(""); 
     8         StdString *CObjectFactory::CurrContext_ptr = new StdString; 
    89 
    910   void CObjectFactory::SetCurrentContextId(const StdString & context) 
    10    { CObjectFactory::CurrContext = context; } 
     11   {  
     12         CObjectFactory::CurrContext = context;  
     13         *CObjectFactory::CurrContext_ptr = context;  
     14   } 
    1115 
    1216   StdString & CObjectFactory::GetCurrentContextId(void) 
    13    { return (CObjectFactory::CurrContext); } 
     17   {  
     18         //return (CObjectFactory::CurrContext);  
     19         return (*CObjectFactory::CurrContext_ptr);  
     20   } 
    1421 
    1522} // namespace xios 
  • XIOS/dev/branch_yushan/src/object_factory.hpp

    r1087 r1088  
    6060         /// Propriétés statiques /// 
    6161         static StdString CurrContext; 
    62          #pragma omp threadprivate(CurrContext) 
     62         static StdString *CurrContext_ptr; 
     63         #pragma omp threadprivate(CurrContext_ptr) 
    6364 
    6465   }; // class CObjectFactory 
  • XIOS/dev/branch_yushan/src/object_factory_impl.hpp

    r1087 r1088  
    1010       int CObjectFactory::GetObjectNum(void) 
    1111   { 
    12       if (CurrContext.size() == 0) 
     12      if (CurrContext_ptr->size() == 0) 
    1313         ERROR("CObjectFactory::GetObjectNum(void)", 
    1414               << "please define current context id !"); 
     
    1717       
    1818       
    19       return (*U::AllVectObj)[CObjectFactory::CurrContext].size(); 
     19      return (*U::AllVectObj)[*CObjectFactory::CurrContext_ptr].size(); 
    2020   } 
    2121 
     
    2323      int CObjectFactory::GetObjectIdNum(void) 
    2424   { 
    25       if (CurrContext.size() == 0) 
     25      if (CurrContext_ptr->size() == 0) 
    2626         ERROR("CObjectFactory::GetObjectIdNum(void)", 
    2727               << "please define current context id !"); 
     
    3030       
    3131 
    32       return (* U::AllMapObj) [CObjectFactory::CurrContext].size(); 
     32      return (* U::AllMapObj) [*CObjectFactory::CurrContext_ptr].size(); 
    3333   } 
    3434 
     
    3636      bool CObjectFactory::HasObject(const StdString & id) 
    3737   { 
    38       if (CurrContext.size() == 0) 
     38      if (CurrContext_ptr->size() == 0) 
    3939         ERROR("CObjectFactory::HasObject(const StdString & id)", 
    4040               << "[ id = " << id << " ] please define current context id !"); 
     
    4444       
    4545 
    46       return ((*U::AllMapObj)[CObjectFactory::CurrContext].find(id) != 
    47               (*U::AllMapObj)[CObjectFactory::CurrContext].end()); 
     46      return ((*U::AllMapObj)[*CObjectFactory::CurrContext_ptr].find(id) != 
     47              (*U::AllMapObj)[*CObjectFactory::CurrContext_ptr].end()); 
    4848   } 
    4949 
     
    6767      if(U::AllVectObj == NULL) return (boost::shared_ptr<U>()); 
    6868    
    69       if (CurrContext.size() == 0) 
     69      if (CurrContext_ptr->size() == 0) 
    7070         ERROR("CObjectFactory::GetObject(const U * const object)", 
    7171               << "please define current context id !"); 
    7272      std::vector<boost::shared_ptr<U> > & vect = 
    73                      (*U::AllVectObj)[CObjectFactory::CurrContext]; 
     73                     (*U::AllVectObj)[*CObjectFactory::CurrContext_ptr]; 
    7474 
    7575      typename std::vector<boost::shared_ptr<U> >::const_iterator 
     
    9494      if(U::AllMapObj  == NULL) return (boost::shared_ptr<U>()); 
    9595 
    96       if (CurrContext.size() == 0) 
     96      if (CurrContext_ptr->size() == 0) 
    9797         ERROR("CObjectFactory::GetObject(const StdString & id)", 
    9898               << "[ id = " << id << " ] please define current context id !"); 
     
    101101               << "[ id = " << id << ", U = " << U::GetName() << " ] " 
    102102               << "object was not found."); 
    103       return (*U::AllMapObj)[CObjectFactory::CurrContext][id]; 
     103      return (*U::AllMapObj)[*CObjectFactory::CurrContext_ptr][id]; 
    104104   } 
    105105 
     
    123123      if(U::AllMapObj  == NULL) U::AllMapObj  = new xios_map<StdString, xios_map<StdString, boost::shared_ptr<U> > >; 
    124124       
    125       if (CurrContext.empty()) 
     125      if (CurrContext_ptr->empty()) 
    126126         ERROR("CObjectFactory::CreateObject(const StdString& id)", 
    127127               << "[ id = " << id << " ] please define current context id !"); 
     
    135135         boost::shared_ptr<U> value(new U(id.empty() ? CObjectFactory::GenUId<U>() : id)); 
    136136 
    137          (* U::AllVectObj)[CObjectFactory::CurrContext].insert((*U::AllVectObj)[CObjectFactory::CurrContext].end(), value); 
    138          (* U::AllMapObj) [CObjectFactory::CurrContext].insert(std::make_pair(value->getId(), value)); 
     137         (* U::AllVectObj)[*CObjectFactory::CurrContext_ptr].insert((*U::AllVectObj)[*CObjectFactory::CurrContext_ptr].end(), value); 
     138         (* U::AllMapObj) [*CObjectFactory::CurrContext_ptr].insert(std::make_pair(value->getId(), value)); 
    139139 
    140140         return value; 
     
    164164      StdOStringStream oss; 
    165165      if(U::GenId == NULL) U::GenId = new xios_map< StdString, long int >; 
    166       oss << GetUIdBase<U>() << (*U::GenId)[CObjectFactory::CurrContext]++; 
     166      oss << GetUIdBase<U>() << (*U::GenId)[*CObjectFactory::CurrContext_ptr]++; 
    167167      return oss.str(); 
    168168   } 
  • XIOS/dev/branch_yushan/src/test/test_omp.f90

    r1087 r1088  
    8888    print*, "xios_context_initialize OK", rank, size 
    8989 
    90 !     CALL xios_get_handle("test",ctx_hdl) 
    91 !     CALL xios_set_current_context(ctx_hdl) 
    92    
    93    
    94 !     CALL xios_get_calendar_type(calendar_type) 
    95 !     print*, "xios_get_calendar_type OK", rank, size 
    96  
    97 !     CALL xios_set_axis_attr("axis_A",n_glo=llm ,value=lval) ; 
    98 !     CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj,type='curvilinear') 
    99 !     CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4) 
    100 !     CALL xios_set_domain_attr("domain_A",lonvalue_2D=lon,latvalue_2D=lat) 
    101 !     CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.) 
    102 !     print*, "test block OK", rank, size 
     90    CALL xios_get_handle("test",ctx_hdl) 
     91    CALL xios_set_current_context(ctx_hdl) 
     92   
     93   
     94    CALL xios_get_calendar_type(calendar_type) 
     95    print*, "xios_get_calendar_type OK", rank, size 
     96 
     97    CALL xios_set_axis_attr("axis_A",n_glo=llm ,value=lval) ; 
     98    CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj,type='curvilinear') 
     99    CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4) 
     100    CALL xios_set_domain_attr("domain_A",lonvalue_2D=lon,latvalue_2D=lat) 
     101    CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.) 
     102    print*, "test block OK", rank, size 
     103 
     104    CALL xios_get_handle("field_definition",fieldgroup_hdl) 
     105    CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B") 
     106    CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B") 
     107     
     108    CALL xios_get_handle("output",file_hdl) 
     109    CALL xios_add_child(file_hdl,field_hdl) 
     110    CALL xios_set_attr(field_hdl,field_ref="field_A_zoom",name="field_C") 
     111    print*, "test block 2 OK", rank, size 
     112 
     113!     dtime%second = 3600 
     114!     CALL xios_set_timestep(dtime) 
     115!     print*, "xios_set_timestep OK", rank, size 
     116 
     117    ! The calendar is created as soon as the calendar type is defined. This way 
     118    ! calendar operations can be used before the context definition is closed 
     119!     CALL xios_get_time_origin(date) 
     120!     PRINT *, "--> year length = ", xios_get_year_length_in_seconds(date%year) 
     121!     PRINT *, "--> day length = ", xios_get_day_length_in_seconds() 
     122!     CALL xios_date_convert_to_string(date, date_str) 
     123!     PRINT *, "time_origin = ", date_str 
     124!     PRINT *, "xios_date_get_second_of_year(time_origin) = ", xios_date_get_second_of_year(date) 
     125!     PRINT *, "xios_date_get_day_of_year(time_origin) = ", xios_date_get_day_of_year(date) 
     126!     PRINT *, "xios_date_get_fraction_of_year(time_origin) = ", xios_date_get_fraction_of_year(date) 
     127!     PRINT *, "xios_date_get_second_of_day(time_origin) = ", xios_date_get_second_of_day(date) 
     128!     PRINT *, "xios_date_get_fraction_of_day(time_origin) = ", xios_date_get_fraction_of_day(date) 
     129!     dtime%timestep = 1 
     130!     dtime = 0.5 * dtime 
     131!     CALL xios_duration_convert_to_string(dtime, dtime_str) 
     132!     PRINT *, "duration = ", dtime_str 
     133!     date = date + 3 * (dtime + dtime) 
     134!     CALL xios_date_convert_to_string(date, date_str) 
     135!     PRINT *, "date = time_origin + 3 * (duration + duration) = ", date_str 
     136!     PRINT *, "xios_date_convert_to_seconds(date) = ", xios_date_convert_to_seconds(date) 
     137!     PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour) 
     138 
    103139 
    104140    CALL xios_context_finalize() 
Note: See TracChangeset for help on using the changeset viewer.