Changeset 1334


Ignore:
Timestamp:
11/20/17 09:49:26 (4 years ago)
Author:
yushan
Message:

omp_dev

Location:
XIOS/dev/branch_openmp
Files:
37 edited

Legend:

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

    r1331 r1334  
    3939#bld::target test_unstruct_complete.exe  
    4040#bld::target test_omp.exe  
    41 #bld::target test_complete_omp.exe  
     41bld::target test_complete_omp.exe  
    4242#bld::target test_remap.exe  
    4343bld::target test_remap_ref.exe  
  • XIOS/dev/branch_openmp/extern/remap/src/gridRemap.cpp

    r1328 r1334  
    1111 
    1212CRemapGrid srcGrid; 
     13 
    1314CRemapGrid tgtGrid; 
    1415 
  • XIOS/dev/branch_openmp/extern/remap/src/timerRemap.hpp

    r1328 r1334  
    2828    //static map<string,CTimer*> allTimer; 
    2929    static map<string,CTimer*> *allTimer_ptr; 
     30    #pragma omp threadprivate(allTimer_ptr) 
    3031    static double getTime(void); 
    3132    static CTimer& get(string name); 
  • XIOS/dev/branch_openmp/inputs/REMAP/iodef.xml

    r1328 r1334  
    3939          <field field_ref="tmp_field_0" name="field_regular_0" enabled=".TRUE."/> 
    4040          <field field_ref="dst_field_regular" name="field_regular" enabled=".TRUE."/> 
    41           <field field_ref="dst_field_regular_pole_0" name="field_regular_pole_0" enabled=".FALSE." /> 
    42           <field field_ref="dst_field_regular_pole_1" name="field_regular_pole_1" enabled=".FALSE." /> 
     41          <field field_ref="dst_field_regular_pole_0" name="field_regular_pole_0" enabled=".TRUE." /> 
     42          <field field_ref="dst_field_regular_pole_1" name="field_regular_pole_1" enabled=".TRUE." /> 
    4343       </file> 
    4444       <file id="output_dst_curvilinear" name="output_dst_curvilinear" enabled=".TRUE." > 
  • XIOS/dev/branch_openmp/src/array_new.hpp

    r1328 r1334  
    554554        TinyVector<int,N_rank> vect; 
    555555        size_t ne; 
    556          
     556 
    557557        ret =  buffer.get(numDim); 
    558558        ret &= buffer.get(vect.data(), N_rank); 
  • XIOS/dev/branch_openmp/src/calendar.cpp

    r1328 r1334  
    117117      const CDate& CCalendar::update(int step) 
    118118      { 
    119         info(20) << "update step : " << step << " timestep " << this->timestep << std::endl; 
     119        //info(20) << "update step : " << step << " timestep " << this->timestep << std::endl; 
    120120        return (this->currentDate = this->getInitDate() + step * this->timestep); 
    121121      } 
  • XIOS/dev/branch_openmp/src/client.cpp

    r1328 r1334  
    186186 
    187187        MPI_Intercomm_create(contextComm,0,CXios::globalComm,serverLeader,10+globalRank,&contextInterComm) ; 
    188         info(10)<<"Register new Context : "<<id<<endl ; 
     188        #pragma omp critical (std_output) 
     189        { 
     190          //info(10)<<"Register new Context : "<<id<<endl ; 
     191        } 
    189192 
    190193        MPI_Comm inter ; 
  • XIOS/dev/branch_openmp/src/data_output.hpp

    r1328 r1334  
    5959            virtual void writeTimeDimension_(void)           = 0; 
    6060            virtual void writeTimeAxis_ (CField*     field, 
    61                                          const shared_ptr<CCalendar> cal) = 0; 
     61                                         const boost::shared_ptr<CCalendar> cal) = 0; 
    6262 
    6363            /// Propriétés protégées /// 
  • XIOS/dev/branch_openmp/src/filter/spatial_transform_filter.hpp

    r1331 r1334  
    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) 
     107      #pragma omp threadprivate(engines_ptr) 
    108108  }; // class CSpatialTransformFilterEngine 
    109109} // namespace xios 
  • XIOS/dev/branch_openmp/src/group_factory.cpp

    r1328 r1334  
    44{ 
    55   /// ////////////////////// Définitions ////////////////////// /// 
    6    StdString CGroupFactory::CurrContext(""); 
     6   StdString *CGroupFactory::CurrContext_ptr = 0; 
    77 
    88   void CGroupFactory::SetCurrentContextId(const StdString & context) 
    9    {  
    10       CGroupFactory::CurrContext = context; 
     9   {   
     10      if(CGroupFactory::CurrContext_ptr == 0 ) CGroupFactory::CurrContext_ptr = new StdString;  
     11      CGroupFactory::CurrContext_ptr->assign(context); 
    1112   } 
    1213 
    1314   StdString & CGroupFactory::GetCurrentContextId(void) 
    1415   {  
    15       return (CGroupFactory::CurrContext); 
     16      return (*CGroupFactory::CurrContext_ptr); 
    1617   } 
    1718 
  • XIOS/dev/branch_openmp/src/group_factory.hpp

    r1331 r1334  
    6969 
    7070         /// Propriétés statiques /// 
    71          static StdString CurrContext; 
    72 //         #pragma omp threadprivate(CurrContext) 
     71         static StdString *CurrContext_ptr; 
     72         #pragma omp threadprivate(CurrContext_ptr) 
    7373 
    7474   }; // class CGroupFactory 
  • XIOS/dev/branch_openmp/src/group_factory_decl.cpp

    r1328 r1334  
    55{ 
    66# define  macro(U) \ 
    7   template void CGroupFactory::AddGroup<U>(shared_ptr<U> pgroup,shared_ptr<U> cgroup); \ 
    8   template void CGroupFactory::AddChild<U>(shared_ptr<U> group, shared_ptr<U::RelChild> child); \ 
    9   template shared_ptr<U>  CGroupFactory::GetGroup<U>(shared_ptr<U> group, const StdString & id); \ 
    10   template shared_ptr<U::RelChild> CGroupFactory::GetChild<U>(shared_ptr<U> group, const StdString & id); \ 
    11   template int CGroupFactory::GetGroupNum<U>(shared_ptr<U> group); \ 
    12   template int CGroupFactory::GetGroupIdNum<U>(shared_ptr<U> group); \ 
    13   template int CGroupFactory::GetChildNum<U>(shared_ptr<U> group); \ 
     7  template void CGroupFactory::AddGroup<U>(boost::shared_ptr<U> pgroup,boost::shared_ptr<U> cgroup); \ 
     8  template void CGroupFactory::AddChild<U>(boost::shared_ptr<U> group, boost::shared_ptr<U::RelChild> child); \ 
     9  template boost::shared_ptr<U>  CGroupFactory::GetGroup<U>(boost::shared_ptr<U> group, const StdString & id); \ 
     10  template boost::shared_ptr<U::RelChild> CGroupFactory::GetChild<U>(boost::shared_ptr<U> group, const StdString & id); \ 
     11  template int CGroupFactory::GetGroupNum<U>(boost::shared_ptr<U> group); \ 
     12  template int CGroupFactory::GetGroupIdNum<U>(boost::shared_ptr<U> group); \ 
     13  template int CGroupFactory::GetChildNum<U>(boost::shared_ptr<U> group); \ 
    1414  template int CGroupFactory::GetChildIdNum<U>(boost::shared_ptr<U> group); \ 
    15   template bool CGroupFactory::HasGroup<U>(shared_ptr<U> group, const StdString & id); \ 
     15  template bool CGroupFactory::HasGroup<U>(boost::shared_ptr<U> group, const StdString & id); \ 
    1616  template bool CGroupFactory::HasChild<U>(boost::shared_ptr<U> group, const StdString & id); \ 
    17   template shared_ptr<U> CGroupFactory::CreateGroup<U>(shared_ptr<U> group, const StdString & id ); \ 
    18   template shared_ptr<U::RelChild>  CGroupFactory::CreateChild<U>(shared_ptr<U> group, const StdString & id); 
     17  template boost::shared_ptr<U> CGroupFactory::CreateGroup<U>(boost::shared_ptr<U> group, const StdString & id ); \ 
     18  template boost::shared_ptr<U::RelChild>  CGroupFactory::CreateChild<U>(boost::shared_ptr<U> group, const StdString & id); 
    1919 
    2020  macro(CFieldGroup) 
  • XIOS/dev/branch_openmp/src/interface/c/icdata.cpp

    r1328 r1334  
    5656      ep_lib::MPI_Comm return_comm; 
    5757       
    58       ep_lib::fc_comm_map.clear(); 
     58      //ep_lib::fc_comm_map.clear(); 
    5959 
    6060      if (!cstr2string(client_id, len_client_id, str)) return; 
  • XIOS/dev/branch_openmp/src/io/netCdfInterface.cpp

    r1328 r1334  
    102102int CNetCdfInterface::openPar(const StdString& fileName, int oMode, MPI_Comm comm, MPI_Info info, int& ncId) 
    103103{ 
    104   //int status = xios::nc_open_par(fileName.c_str(), oMode, comm, info, &ncId); 
    105   int status = xios::nc_open_par(fileName.c_str(), oMode, comm, MPI_INFO_NULL.mpi_info, &ncId); 
     104  int status; 
     105  #pragma omp critical (_netcdf) 
     106  status = xios::nc_open_par(fileName.c_str(), oMode, comm, MPI_INFO_NULL.mpi_info, &ncId); 
     107   
    106108  if (NC_NOERR != status) 
    107109  { 
  • XIOS/dev/branch_openmp/src/io/netCdfInterface_impl.hpp

    r1328 r1334  
    8585  int CNetCdfInterface::getVaraType(int ncid, int varId, const StdSize* start, const StdSize* count, T* data) 
    8686  { 
    87     int status = ncGetVaraType(ncid, varId, start, count, data); 
     87    int status; 
     88    #pragma omp critical (_netcdf) 
     89    status = ncGetVaraType(ncid, varId, start, count, data); 
    8890    if (NC_NOERR != status) 
    8991    { 
  • XIOS/dev/branch_openmp/src/node/axis.cpp

    r1328 r1334  
    4444   { /* Ne rien faire de plus */ } 
    4545 
    46    //std::map<StdString, ETranformationType> CAxis::transformationMapList_ = std::map<StdString, ETranformationType>(); 
    4746   std::map<StdString, ETranformationType> *CAxis::transformationMapList_ptr = 0; 
    48    //bool CAxis::dummyTransformationMapList_ = CAxis::initializeTransformationMap(CAxis::transformationMapList_); 
    49     
     47 
    5048   bool CAxis::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
    5149   { 
     
    499497        globalAxisZoom[nZoomCount] = globalZoomIndex; 
    500498        ++nZoomCount; 
    501       }  
     499      } 
    502500    } 
    503501 
     
    977975        msg << ni << begin << end; 
    978976        msg << global_zoom_begin.getValue() << global_zoom_n.getValue(); 
    979         msg << isCompressible_;         
     977        msg << isCompressible_; 
    980978        msg << zoomIndex; 
    981979        if (zoomIndex) 
     
    11561154 
    11571155        nodeElementName = node.getElementName(); 
    1158         //std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it; 
     1156 
    11591157        if(transformationMapList_ptr == 0) initializeTransformationMap(); 
    1160         std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_ptr->end(), it; 
    1161         //it = transformationMapList_.find(nodeElementName); 
    1162         it = transformationMapList_ptr->find(nodeElementName); 
     1158        std::map<StdString, ETranformationType>::const_iterator ite = (*CAxis::transformationMapList_ptr).end(), it; 
     1159        it = (*CAxis::transformationMapList_ptr).find(nodeElementName); 
    11631160        if (ite != it) 
    11641161        { 
  • XIOS/dev/branch_openmp/src/node/context.cpp

    r1331 r1334  
    2323namespace xios { 
    2424 
    25   shared_ptr<CContextGroup> * CContext::root_ptr = 0; 
     25  boost::shared_ptr<CContextGroup> * CContext::root_ptr = 0; 
    2626 
    2727   /// ////////////////////// Dfinitions ////////////////////// /// 
     
    5959   CContextGroup* CContext::getRoot(void) 
    6060   { 
    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())); 
     61      if(root_ptr == 0) root_ptr = new boost::shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName())); 
    6362      return root_ptr->get(); 
    6463   } 
  • XIOS/dev/branch_openmp/src/node/context.hpp

    r1331 r1334  
    206206 
    207207         // Context root 
    208          static shared_ptr<CContextGroup> *root_ptr; 
     208         static boost::shared_ptr<CContextGroup> *root_ptr; 
    209209         #pragma omp threadprivate(root_ptr) 
    210210 
  • XIOS/dev/branch_openmp/src/node/domain.cpp

    r1328 r1334  
    6565   } 
    6666 
    67    //std::map<StdString, ETranformationType> CDomain::transformationMapList_ = std::map<StdString, ETranformationType>(); 
     67 
    6868   std::map<StdString, ETranformationType> *CDomain::transformationMapList_ptr = 0; 
    69    //bool CDomain::_dummyTransformationMapList = CDomain::initializeTransformationMap(CDomain::transformationMapList_); 
    7069 
    7170   bool CDomain::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
     
    23632362        nodeElementName = node.getElementName(); 
    23642363        if(transformationMapList_ptr == 0) initializeTransformationMap(); 
    2365         //std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it; 
     2364 
    23662365        std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_ptr->end(), it; 
    2367         //it = transformationMapList_.find(nodeElementName); 
     2366 
    23682367        it = transformationMapList_ptr->find(nodeElementName); 
    23692368        if (ite != it) 
  • XIOS/dev/branch_openmp/src/node/file.cpp

    r1328 r1334  
    483483         if (isOpen) data_out->closeFile(); 
    484484 
    485         data_out = shared_ptr<CDataOutput>(new CNc4DataOutput(this, oss.str(), append, useClassicFormat, useCFConvention, 
     485        data_out = boost::shared_ptr<CDataOutput>(new CNc4DataOutput(this, oss.str(), append, useClassicFormat, useCFConvention, 
    486486                                                              fileComm, multifile, isCollective, time_counter_name)); 
    487487        isOpen = true; 
     
    598598 
    599599      if (isOpen) data_out->closeFile(); 
    600       if (time_counter_name.isEmpty()) data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective)); 
    601       else data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective, time_counter_name)); 
     600      if (time_counter_name.isEmpty()) data_in = boost::shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective)); 
     601      else data_in = boost::shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective, time_counter_name)); 
    602602      isOpen = true; 
    603603    } 
     
    646646 
    647647        // Read necessary value from file 
    648         this->data_in->readFieldAttributesValues(enabledFields[idx]); 
    649  
     648        #pragma omp critical (_func) 
     649        { 
     650          this->data_in->readFieldAttributesValues(enabledFields[idx]); 
     651        } 
    650652        // Fill attributes for base reference 
    651653        enabledFields[idx]->solveGridDomainAxisBaseRef(); 
  • XIOS/dev/branch_openmp/src/node/grid.cpp

    r1328 r1334  
    11141114          outLocalIndexToServer(idx) = itIndex->second; 
    11151115        } 
    1116          
     1116 
    11171117        const std::list<int>& ranks = client->getRanksServerLeader(); 
    11181118        for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     
    17501750        pDom->solveRefInheritance(apply); 
    17511751        pDom->solveInheritanceTransformation(); 
    1752         //cout<<"pDom check"<<endl; 
    17531752      } 
    17541753    } 
  • XIOS/dev/branch_openmp/src/node/transformation.hpp

    r1331 r1334  
    3535      typedef std::map<ETranformationType, CreateTransformationCallBack> CallBackMap; 
    3636      static CallBackMap* transformationCreationCallBacks_; 
    37       #pragma omp threadprivate(transformationCreationCallBacks_) 
     37      //#pragma omp threadprivate(transformationCreationCallBacks_) 
    3838 
    3939      static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn); 
     
    6666    if (0 == transformationCreationCallBacks_) 
    6767      transformationCreationCallBacks_ = new CallBackMap(); 
    68  
    6968    return (*transformationCreationCallBacks_).insert(make_pair(transType, createFn)).second; 
    7069  } 
  • XIOS/dev/branch_openmp/src/object_factory.cpp

    r1328 r1334  
    55   /// ////////////////////// Définitions ////////////////////// /// 
    66 
    7    StdString CObjectFactory::CurrContext(""); 
     7   StdString *CObjectFactory::CurrContext_ptr = 0; 
    88 
    99   void CObjectFactory::SetCurrentContextId(const StdString & context) 
    10    { CObjectFactory::CurrContext = context; } 
     10   { 
     11     if(CObjectFactory::CurrContext_ptr == 0 ) CObjectFactory::CurrContext_ptr = new StdString; 
     12     CObjectFactory::CurrContext_ptr->assign(context);  
     13   } 
    1114 
    1215   StdString & CObjectFactory::GetCurrentContextId(void) 
    13    { return (CObjectFactory::CurrContext); } 
     16   {  
     17     return (*CObjectFactory::CurrContext_ptr);  
     18   } 
    1419 
    1520} // namespace xios 
  • XIOS/dev/branch_openmp/src/object_factory.hpp

    r1331 r1334  
    5959 
    6060      /// Propriétés statiques /// 
    61       static StdString CurrContext; 
    62 //      #pragma omp threadprivate(CurrContext) 
     61      static StdString *CurrContext_ptr; 
     62      #pragma omp threadprivate(CurrContext_ptr) 
    6363 
    6464  }; // class CObjectFactory 
  • XIOS/dev/branch_openmp/src/object_factory_decl.cpp

    r1328 r1334  
    55{ 
    66#define macro(U) \ 
    7   template shared_ptr<U> CObjectFactory::GetObject<U>(const StdString& id);  \ 
    8   template shared_ptr<U> CObjectFactory::GetObject<U>(const StdString& context,const StdString& id); \ 
    9   template shared_ptr<U> CObjectFactory::GetObject<U>(const U* const object); \ 
     7  template boost::shared_ptr<U> CObjectFactory::GetObject<U>(const StdString& id);  \ 
     8  template boost::shared_ptr<U> CObjectFactory::GetObject<U>(const StdString& context,const StdString& id); \ 
     9  template boost::shared_ptr<U> CObjectFactory::GetObject<U>(const U* const object); \ 
    1010  template int CObjectFactory::GetObjectNum<U>(void); \ 
    1111  template int CObjectFactory::GetObjectIdNum<U>(void); \ 
    12   template const std::vector<shared_ptr<U> >& CObjectFactory::GetObjectVector<U>(const StdString& context ); \ 
     12  template const std::vector<boost::shared_ptr<U> >& CObjectFactory::GetObjectVector<U>(const StdString& context ); \ 
    1313  template bool CObjectFactory::HasObject<U>(const StdString& id); \ 
    1414  template bool CObjectFactory::HasObject<U>(const StdString& context,const StdString& id); \ 
  • XIOS/dev/branch_openmp/src/object_factory_impl.hpp

    r1328 r1334  
    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 !"); 
    1515      //return (U::AllVectObj[CObjectFactory::CurrContext].size()); 
    1616      if(U::AllVectObj_ptr == NULL) return 0; 
    17       return (*U::AllVectObj_ptr)[CObjectFactory::CurrContext].size(); 
     17      return (*U::AllVectObj_ptr)[*CObjectFactory::CurrContext_ptr].size(); 
    1818   } 
    1919 
     
    2121      int CObjectFactory::GetObjectIdNum(void) 
    2222   { 
    23       if (CurrContext.size() == 0) 
     23      if (CurrContext_ptr->size() == 0) 
    2424         ERROR("CObjectFactory::GetObjectIdNum(void)", 
    2525               << "please define current context id !"); 
    2626      //return (U::AllMapObj[CObjectFactory::CurrContext].size()); 
    2727      if(U::AllMapObj_ptr == NULL) return 0; 
    28       return (*U::AllMapObj_ptr)[CObjectFactory::CurrContext].size(); 
     28      return (*U::AllMapObj_ptr)[*CObjectFactory::CurrContext_ptr].size(); 
    2929   } 
    3030 
     
    3232      bool CObjectFactory::HasObject(const StdString & id) 
    3333   { 
    34       if (CurrContext.size() == 0) 
     34      if (CurrContext_ptr->size() == 0) 
    3535         ERROR("CObjectFactory::HasObject(const StdString & id)", 
    3636               << "[ id = " << id << " ] please define current context id !"); 
     
    3838      //        U::AllMapObj[CObjectFactory::CurrContext].end()); 
    3939      if(U::AllMapObj_ptr  == NULL)  return false; 
    40       return ((*U::AllMapObj_ptr)[CObjectFactory::CurrContext].find(id) != 
    41               (*U::AllMapObj_ptr)[CObjectFactory::CurrContext].end()); 
     40      return ((*U::AllMapObj_ptr)[*CObjectFactory::CurrContext_ptr].find(id) != 
     41              (*U::AllMapObj_ptr)[*CObjectFactory::CurrContext_ptr].end()); 
    4242 
    4343   } 
     
    5959   { 
    6060      if(U::AllVectObj_ptr == NULL) return (boost::shared_ptr<U>()); 
    61       if (CurrContext.size() == 0) 
     61      if (CurrContext_ptr->size() == 0) 
    6262         ERROR("CObjectFactory::GetObject(const U * const object)", 
    6363               << "please define current context id !"); 
    6464      //std::vector<boost::shared_ptr<U> > & vect = U::AllVectObj[CObjectFactory::CurrContext]; 
    65       std::vector<boost::shared_ptr<U> > & vect = (*U::AllVectObj_ptr)[CObjectFactory::CurrContext]; 
     65      std::vector<boost::shared_ptr<U> > & vect = (*U::AllVectObj_ptr)[*CObjectFactory::CurrContext_ptr]; 
    6666 
    6767      typename std::vector<boost::shared_ptr<U> >::const_iterator 
     
    8585   { 
    8686      if(U::AllMapObj_ptr  == NULL) return (boost::shared_ptr<U>()); 
    87       if (CurrContext.size() == 0) 
     87      if (CurrContext_ptr->size() == 0) 
    8888         ERROR("CObjectFactory::GetObject(const StdString & id)", 
    8989               << "[ id = " << id << " ] please define current context id !"); 
     
    100100 
    101101      //return (U::AllMapObj[CObjectFactory::CurrContext][id]); 
    102       return (*U::AllMapObj_ptr)[CObjectFactory::CurrContext][id]; 
     102      return (*U::AllMapObj_ptr)[*CObjectFactory::CurrContext_ptr][id]; 
    103103   } 
    104104 
     
    129129      if(U::AllMapObj_ptr  == NULL) U::AllMapObj_ptr  = new xios_map<StdString, xios_map<StdString, boost::shared_ptr<U> > >; 
    130130 
    131       if (CurrContext.empty()) 
     131      if (CurrContext_ptr->empty()) 
    132132         ERROR("CObjectFactory::CreateObject(const StdString& id)", 
    133133               << "[ id = " << id << " ] please define current context id !"); 
     
    144144         //U::AllMapObj[CObjectFactory::CurrContext].insert(std::make_pair(value->getId(), value)); 
    145145 
    146          (*U::AllVectObj_ptr)[CObjectFactory::CurrContext].insert((*U::AllVectObj_ptr)[CObjectFactory::CurrContext].end(), value); 
    147          (*U::AllMapObj_ptr) [CObjectFactory::CurrContext].insert(std::make_pair(value->getId(), value)); 
     146         (*U::AllVectObj_ptr)[*CObjectFactory::CurrContext_ptr].insert((*U::AllVectObj_ptr)[*CObjectFactory::CurrContext_ptr].end(), value); 
     147         (*U::AllMapObj_ptr) [*CObjectFactory::CurrContext_ptr].insert(std::make_pair(value->getId(), value)); 
    148148         //cout<<"CObjectFactory::CreateObject(const StdString& id) [ id = " << id << " ]" <<endl; 
    149149 
     
    172172      StdOStringStream oss; 
    173173      if(U::GenId_ptr == NULL) U::GenId_ptr = new xios_map< StdString, long int >; 
    174       oss << GetUIdBase<U>() << (*U::GenId_ptr)[CObjectFactory::CurrContext]++; 
     174      oss << GetUIdBase<U>() << (*U::GenId_ptr)[*CObjectFactory::CurrContext_ptr]++; 
    175175      return oss.str(); 
    176176   } 
  • XIOS/dev/branch_openmp/src/object_template.hpp

    r1331 r1334  
    7777      static T* get(const string& contextId, const string& id) ; 
    7878      T* get(void) ; 
    79       shared_ptr<T> getShared(void) ; 
    80       static shared_ptr<T> getShared(const T* ptr) ; 
     79      boost::shared_ptr<T> getShared(void) ; 
     80      static boost::shared_ptr<T> getShared(const T* ptr) ; 
     81 
    8182 
    8283      static T* create(const string& id=string("")) ; 
  • XIOS/dev/branch_openmp/src/object_template_impl.hpp

    r1328 r1334  
    325325 
    326326   template <typename T> 
    327    shared_ptr<T> CObjectTemplate<T>::getShared(const T* ptr) 
     327   boost::shared_ptr<T> CObjectTemplate<T>::getShared(const T* ptr) 
    328328   { 
    329329     return CObjectFactory::GetObject<T>(ptr); 
     
    331331 
    332332   template <typename T> 
    333    shared_ptr<T> CObjectTemplate<T>::getShared(void) 
     333   boost::shared_ptr<T> CObjectTemplate<T>::getShared(void) 
    334334   { 
    335335     return CObjectFactory::GetObject<T>((T*)this); 
     
    339339   const vector<T*> CObjectTemplate<T>::getAll() 
    340340   { 
    341      const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(); 
     341     const vector< boost::shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(); 
    342342     vector<T*> vect; 
    343343 
    344      typename vector<shared_ptr<T> >::const_iterator it; 
     344     typename vector<boost::shared_ptr<T> >::const_iterator it; 
    345345     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()); 
    346346     return vect; 
     
    350350   const vector<T*> CObjectTemplate<T>::getAll(const string & id) 
    351351   { 
    352      const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(id); 
     352     const vector< boost::shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(id); 
    353353     vector<T*> vect; 
    354354 
    355      typename vector<shared_ptr<T> >::const_iterator it; 
     355     typename vector<boost::shared_ptr<T> >::const_iterator it; 
    356356     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()); 
    357357     return vect; 
  • XIOS/dev/branch_openmp/src/parse_expr/yacc_parser.cpp

    r1328 r1334  
    8080} 
    8181 
    82   IFilterExprNode* parsed; 
    83   std::string globalInputText; 
    84   size_t globalReadOffset = 0; 
    85  
     82  static IFilterExprNode* parsed; 
     83  static std::string globalInputText; 
     84  static std::string *globalInputText_ptr = 0; 
     85  static size_t globalReadOffset = 0; 
     86  #pragma omp threadprivate(parsed, globalInputText_ptr, globalReadOffset) 
     87   
    8688  int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) 
    8789  { 
     90    if(globalInputText_ptr == 0) globalInputText_ptr = new std::string; 
    8891    size_t numBytesToRead = maxBytesToRead; 
    89     size_t bytesRemaining = globalInputText.length()-globalReadOffset; 
     92    size_t bytesRemaining = (*globalInputText_ptr).length()-globalReadOffset; 
    9093    size_t i; 
    9194    if (numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining; 
    92     for (i = 0; i < numBytesToRead; i++) buffer[i] = globalInputText.c_str()[globalReadOffset + i]; 
     95    for (i = 0; i < numBytesToRead; i++) buffer[i] = (*globalInputText_ptr).c_str()[globalReadOffset + i]; 
    9396    *numBytesRead = numBytesToRead; 
    9497    globalReadOffset += numBytesToRead; 
     
    20022005  IFilterExprNode* parseExpr(const string& strExpr) 
    20032006  { 
    2004     globalInputText = strExpr; 
    2005     globalReadOffset = 0; 
    2006     yyparse(); 
     2007    #pragma omp critical (_parser) 
     2008    { 
     2009      if(globalInputText_ptr == 0) globalInputText_ptr = new std::string; 
     2010      (*globalInputText_ptr).assign (strExpr); 
     2011      globalReadOffset = 0; 
     2012      yyparse(); 
     2013    } 
    20072014    return parsed; 
    20082015  } 
  • XIOS/dev/branch_openmp/src/parse_expr/yacc_parser.yacc

    r1328 r1334  
    1515} 
    1616 
    17   IFilterExprNode* parsed; 
    18   std::string globalInputText; 
    19   size_t globalReadOffset = 0; 
     17  static IFilterExprNode* parsed; 
     18  static std::string globalInputText; 
     19  static std::string *globalInputText_ptr = 0; 
     20  static size_t globalReadOffset = 0; 
     21  #pragma omp threadprivate(parsed, globalInputText_ptr, globalReadOffset) 
    2022 
    2123  int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) 
    2224  { 
     25    if(globalInputText_ptr == 0) globalInputText_ptr = new std::string; 
    2326    size_t numBytesToRead = maxBytesToRead; 
    24     size_t bytesRemaining = globalInputText.length()-globalReadOffset; 
     27    size_t bytesRemaining = (*globalInputText_ptr).length()-globalReadOffset; 
    2528    size_t i; 
    2629    if (numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining; 
    27     for (i = 0; i < numBytesToRead; i++) buffer[i] = globalInputText.c_str()[globalReadOffset + i]; 
     30    for (i = 0; i < numBytesToRead; i++) buffer[i] = (*globalInputText_ptr).c_str()[globalReadOffset + i]; 
    2831    *numBytesRead = numBytesToRead; 
    2932    globalReadOffset += numBytesToRead; 
     
    145148  IFilterExprNode* parseExpr(const string& strExpr) 
    146149  { 
    147     globalInputText = strExpr; 
    148     globalReadOffset = 0; 
    149     yyparse(); 
     150    #pragma omp critical (_parser) 
     151    { 
     152      if(globalInputText_ptr == 0) globalInputText_ptr = new std::string; 
     153      (*globalInputText_ptr).assign (strExpr); 
     154      globalReadOffset = 0; 
     155      yyparse(); 
     156    } 
    150157    return parsed; 
    151158  } 
  • XIOS/dev/branch_openmp/src/test/test_remap_omp.f90

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

    r1328 r1334  
    4444  zoomBegin_ = zoomAxis->begin.getValue(); 
    4545  zoomSize_  = zoomAxis->n.getValue(); 
    46   zoomEnd_   = zoomBegin_ + zoomSize_ - 1;   
     46  zoomEnd_   = zoomBegin_ + zoomSize_ - 1; 
    4747 
    4848  if (zoomSize_ > axisSource->n_glo.getValue()) 
  • XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.cpp

    r1328 r1334  
    114114  nVertexSrc = nVertexDest = constNVertex; 
    115115 
    116  
    117  
    118116  // First of all, try to retrieve the boundary values of domain source and domain destination 
    119117  int localDomainSrcSize = domainSrc_->i_index.numElements(); 
     
    283281    globalSrc[idx] = globalIndex; 
    284282  } 
    285  
    286283 
    287284  for (int idx = 0; idx < nDstLocal; ++idx) 
  • XIOS/dev/branch_openmp/src/transformation/grid_transformation_factory_impl.hpp

    r1331 r1334  
    5757  typedef std::map<ETranformationType, CreateTransformationCallBack> CallBackMap; 
    5858  static CallBackMap* transformationCreationCallBacks_; 
     59  #pragma omp threadprivate(transformationCreationCallBacks_) 
    5960  static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn); 
    6061  static bool unregisterTransformation(ETranformationType transType); 
  • XIOS/dev/branch_openmp/src/transformation/scalar_algorithm_reduce_axis.cpp

    r1328 r1334  
    1313#include "grid.hpp" 
    1414#include "grid_transformation_factory_impl.hpp" 
    15 #include "reduction.hpp" 
    16  
    1715#include "reduction.hpp" 
    1816 
  • XIOS/dev/branch_openmp/src/type/type.hpp

    r1328 r1334  
    9494    const CType_ref& operator = (CType<T>& val) const ; 
    9595    const CType_ref& operator = (const CType_ref& val) const; 
    96     operator T&() const;     
     96    operator T&() const; 
    9797 
    9898    inline virtual CBaseType* clone(void) const   { return _clone(); } 
  • XIOS/dev/branch_openmp/src/xml_node.hpp

    r1331 r1334  
    4949 
    5050        static StdString RootName; 
    51         #pragma omp threadprivate(RootName) 
     51        //#pragma omp threadprivate(RootName) 
    5252 
    5353    }; //class CXMLParser 
Note: See TracChangeset for help on using the changeset viewer.