Ignore:
Timestamp:
12/18/18 17:34:59 (5 years ago)
Author:
yushan
Message:

bug fix (Nb of files less than Nb of servers)

Location:
XIOS/dev/dev_trunk_omp/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_omp/src/calendar.cpp

    r1601 r1628  
    127127      const CDate& CCalendar::update(int step) 
    128128      { 
    129         #pragma omp critical (_output) 
    130         info(80) << "update step : " << step << " timestep " << this->timestep << std::endl; 
     129        //#pragma omp critical (_output) 
     130        //info(120) << "update step : " << step << " timestep " << this->timestep << std::endl; 
    131131        this->step = step; 
    132132        return (this->currentDate = this->getInitDate() + step * this->timestep); 
     
    160160      //----------------------------------------------------------------- 
    161161 
    162       int CCalendar::getMonthLength(const CDate& date) const 
     162      /*int CCalendar::getMonthLength(const CDate& date) const 
    163163      { // Retourne la durée du mois en jour. 
    164164        static const int NoLeapMonthLength[] = 
    165165          { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 
    166166        return NoLeapMonthLength[date.getMonth() - 1]; 
    167       } 
     167      }*/ 
    168168 
    169169      StdString CCalendar::getType(void) const { return StdString(this->getId()); } 
     
    171171      int CCalendar::getYearTotalLength(const CDate& date) const { return (365 * 86400); } 
    172172 
    173       int CCalendar::getYearLength  (void) const { return 12; } 
    174       int CCalendar::getDayLength   (void) const { return 24; } 
    175       int CCalendar::getHourLength  (void) const { return 60; } 
    176       int CCalendar::getMinuteLength(void) const { return 60; } 
    177       int CCalendar::getDayLengthInSeconds(void) const { return getDayLength() * getHourLength() * getMinuteLength(); } 
     173      //int CCalendar::getYearLength  (void) const { return 12; } 
     174      //int CCalendar::getDayLength   (void) const { return 24; } 
     175      //int CCalendar::getHourLength  (void) const { return 60; } 
     176      //int CCalendar::getMinuteLength(void) const { return 60; } 
     177      //int CCalendar::getDayLengthInSeconds(void) const { return getDayLength() * getHourLength() * getMinuteLength(); } 
    178178 
    179179      bool CCalendar::hasLeapYear() const { return false; } 
  • XIOS/dev/dev_trunk_omp/src/calendar.hpp

    r1357 r1628  
    7272            int getStep(void) const; 
    7373 
    74             virtual int getMonthLength(const CDate& date) const; 
     74            inline int getMonthLength(const CDate& date) const 
     75            { 
     76              static const int NoLeapMonthLength[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 
     77              return NoLeapMonthLength[date.getMonth() - 1]; 
     78            }; 
    7579 
    7680            virtual int getYearTotalLength(const CDate& date) const; // Retourne la durée d'une année en seconde. 
    7781 
    78             virtual int getYearLength  (void) const; // Retourne la durée d'une année en mois. 
    79             virtual int getDayLength   (void) const; // Retourne la durée d'un jour en heures. 
    80             virtual int getHourLength  (void) const; // Retourne la durée d'une heure en minute. 
    81             virtual int getMinuteLength(void) const; // Retourne la durée d'une minute en secondes. 
     82            //virtual int getYearLength  (void) const; // Retourne la durée d'une année en mois. 
     83            inline int getYearLength (void) const { return 12; } ; 
     84            inline int getDayLength   (void) const { return 24; } ; // Retourne la durée d'un jour en heures. 
     85            inline int getHourLength  (void) const { return 60; } ; // Retourne la durée d'une heure en minute. 
     86            inline int getMinuteLength(void) const {return 60; } ; // Retourne la durée d'une minute en secondes. 
    8287            /*! Returns the day length expressed in seconds. */ 
    83             virtual int getDayLengthInSeconds(void) const; 
     88            inline int getDayLengthInSeconds(void) const { return 86400; } ; 
    8489 
    8590            virtual StdString getMonthName(int monthId) const; 
  • XIOS/dev/dev_trunk_omp/src/calendar_util.cpp

    r1472 r1628  
    11#include "calendar_util.hpp" 
     2#include "calendar.hpp" 
    23 
    34namespace xios 
  • XIOS/dev/dev_trunk_omp/src/client.cpp

    r1601 r1628  
    315315        report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ; 
    316316        report(0)<< " Memory report : increasing it by a factor will increase performance, depending of the volume of data wrote in file at each time step of the file"<<endl ; 
    317         report(100)<<CTimer::getAllCumulatedTime()<<endl ; 
     317        report(0)<<CTimer::getAllCumulatedTime()<<endl ; 
    318318      } 
    319319   } 
  • XIOS/dev/dev_trunk_omp/src/date.cpp

    r1496 r1628  
    134134      //---------------------------------------------------------------- 
    135135 
    136       int CDate::getYear  (void) const { return (this->year  ); } 
    137       int CDate::getMonth (void) const { return (this->month ); } 
    138       int CDate::getDay   (void) const { return (this->day   ); } 
    139       int CDate::getHour  (void) const { return (this->hour  ); } 
    140       int CDate::getMinute(void) const { return (this->minute); } 
    141       int CDate::getSecond(void) const { return (this->second); } 
     136      //int CDate::getYear  (void) const { return (this->year  ); } 
     137      //int CDate::getMonth (void) const { return (this->month ); } 
     138      //int CDate::getDay   (void) const { return (this->day   ); } 
     139      //int CDate::getHour  (void) const { return (this->hour  ); } 
     140      //int CDate::getMinute(void) const { return (this->minute); } 
     141      //int CDate::getSecond(void) const { return (this->second); } 
    142142 
    143143      //---------------------------------------------------------------- 
  • XIOS/dev/dev_trunk_omp/src/date.hpp

    r1158 r1628  
    4343 
    4444            /// Divers accesseurs /// 
    45             int getYear  (void) const; 
    46             int getMonth (void) const; 
    47             int getDay   (void) const; 
    48             int getHour  (void) const; 
    49             int getMinute(void) const; 
    50             int getSecond(void) const; 
     45            inline int getYear  (void) const {return year;}; 
     46            inline int getMonth (void) const {return month;}; 
     47            inline int getDay   (void) const {return day;}; 
     48            inline int getHour  (void) const {return hour;}; 
     49            inline int getMinute(void) const {return minute;}; 
     50            inline int getSecond(void) const {return second;}; 
    5151 
    5252            //!< Get the calendar associated to the date 
  • XIOS/dev/dev_trunk_omp/src/node/context.cpp

    r1601 r1628  
    18471847        } 
    18481848 
    1849         #pragma omp critical (_output) 
    1850         info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 
     1849        //#pragma omp critical (_output) 
     1850        info(150) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 
    18511851        calendar->update(step); 
    1852         #pragma omp critical (_output) 
    1853         info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 
     1852        //#pragma omp critical (_output) 
     1853        info(150) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 
    18541854  #ifdef XIOS_MEMTRACK_LIGHT 
    18551855        #pragma omp critical (_output) 
  • XIOS/dev/dev_trunk_omp/src/object_factory.hpp

    r1601 r1628  
    3737 
    3838         template <typename U> 
     39            static  int CheckObjectVector(); 
     40                
     41         template <typename U> 
    3942            static  const std::vector<std::shared_ptr<U> > & 
    4043               GetObjectVector(const StdString & context = CObjectFactory::GetCurrentContextId()); 
  • XIOS/dev/dev_trunk_omp/src/object_factory_decl_macro.hpp

    r1591 r1628  
    1010  template int CObjectFactory::GetObjectIdNum<U>(void); \ 
    1111  template const std::vector<std::shared_ptr<U> >& CObjectFactory::GetObjectVector<U>(const StdString& context ); \ 
     12  template int CObjectFactory::CheckObjectVector<U>( ); \ 
    1213  template bool CObjectFactory::HasObject<U>(const StdString& id); \ 
    1314  template bool CObjectFactory::HasObject<U>(const StdString& context,const StdString& id); \ 
  • XIOS/dev/dev_trunk_omp/src/object_factory_impl.hpp

    r1601 r1628  
    125125 
    126126   template <typename U> 
    127       const std::vector<std::shared_ptr<U> > & 
     127   int CObjectFactory::CheckObjectVector() 
     128   { 
     129      if(U::AllVectObj_ptr) 
     130      { 
     131        return 1; 
     132      } 
     133      return 0; 
     134   } 
     135    
     136 
     137   template <typename U> 
     138   const std::vector<std::shared_ptr<U> > & 
    128139         CObjectFactory::GetObjectVector(const StdString & context) 
    129140   { 
    130       return (*U::AllVectObj_ptr)[context]; 
     141      if(U::AllVectObj_ptr) 
     142      { 
     143        //const std::vector<std::shared_ptr<U> > temp; 
     144        return (*U::AllVectObj_ptr)[context]; 
     145        //return std::vector<std::shared_ptr<U> > (0); 
     146      } 
     147       
    131148   } 
    132149 
  • XIOS/dev/dev_trunk_omp/src/object_template_impl.hpp

    r1601 r1628  
    426426   const vector<T*> CObjectTemplate<T>::getAll() 
    427427   { 
     428     int mycheck = CObjectFactory::CheckObjectVector<T>(); 
     429     if(mycheck==0) 
     430     { 
     431       vector<T*> vect; 
     432       return vect; 
     433     } 
    428434     const vector< std::shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(CObjectFactory::GetCurrentContextId()); 
    429435     vector<T*> vect; 
  • XIOS/dev/dev_trunk_omp/src/test/test_omp.f90

    r1604 r1628  
    4545    CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
    4646    CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr) 
    47     if(rank < size-2) then 
     47    if(rank < size-4) then 
    4848 
    4949    !$omp parallel default(firstprivate) 
Note: See TracChangeset for help on using the changeset viewer.