Changeset 1215
- Timestamp:
- 07/15/17 10:49:26 (7 years ago)
- Location:
- XIOS/dev/XIOS_DEV_CMIP6/src/node
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.cpp
r1202 r1215 310 310 if (zoom_begin.isEmpty()) zoom_begin.setValue(begin); 311 311 } 312 313 size_t CAxis::getGlobalWrittenSize(void) 314 { 315 if (zoomByIndex()) return zoom_index.numElements(); 316 else return global_zoom_n ; 317 } 312 318 313 319 /*! -
XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.hpp
r1202 r1215 111 111 112 112 void checkEligibilityForCompressedOutput(); 113 size_t getGlobalWrittenSize(void) ; 113 114 114 115 void computeWrittenIndex(); -
XIOS/dev/XIOS_DEV_CMIP6/src/node/context.cpp
r1212 r1215 16 16 #include "timer.hpp" 17 17 #include "memtrack.hpp" 18 18 #include <limits> 19 19 #include "server.hpp" 20 20 … … 822 822 void CContext::distributeFiles(void) 823 823 { 824 double eps=std::numeric_limits<double>::epsilon()*10 ; 825 824 826 // If primary server 825 827 if (hasServer && hasClient) … … 836 838 // (2) Estimate the data volume for each file 837 839 int size = this->enabledWriteModeFiles.size(); 838 std::vector<std::pair<StdSize, CFile*> > dataSizeMap; 839 StdSize dataPerPool = 0; 840 std::vector<std::pair<double, CFile*> > dataSizeMap; 841 double dataPerPool = 0; 842 int nfield=0 ; 840 843 for (size_t i = 0; i < size; ++i) 841 844 { 842 845 CFile* file = this->enabledWriteModeFiles[i]; 843 StdSize dataSize ;846 StdSize dataSize=0; 844 847 std::vector<CField*> enabledFields = file->getEnabledFields(); 845 848 size_t numEnabledFields = enabledFields.size(); 846 for (size_t j = 0; j < numEnabledFields; ++j) 847 { 848 const std::vector<std::map<int, StdSize> > mapSize = enabledFields[j]->getGridDataBufferSize(); 849 for (size_t c = 0; c < mapSize.size(); ++c) 850 { 851 std::map<int, StdSize>::const_iterator it = mapSize[c].begin(), itE = mapSize[c].end(); 852 for (; it != itE; ++it) 853 { 854 dataSize += it->second; 855 } 856 } 857 } 858 CDuration outFreq = file->output_freq.getValue(); 859 if (outFreq.timestep != 0.0) 860 { 861 outFreq = calendar->getTimeStep(); 862 } 863 double outFreqSec = outFreq.second + 60.*(outFreq.minute + 60.*(outFreq.hour + 24.*(outFreq.day + outFreq.year*365.25) ) ); 864 dataSize /= outFreqSec; 865 dataSizeMap.push_back(make_pair(dataSize,file)); 866 dataPerPool += dataSize; 849 for (size_t j = 0; j < numEnabledFields; ++j) dataSize += enabledFields[j]->getGlobalWrittenSize() ; 850 851 double outFreqSec = (Time)(calendar->getCurrentDate()+file->output_freq)-(Time)(calendar->getCurrentDate()) ; 852 double dataSizeSec= dataSize/ outFreqSec; 853 nfield++ ; 854 // add epsilon*nField to dataSizeSec in order to preserve reproductive ordering when sorting 855 dataSizeMap.push_back(make_pair(dataSizeSec + dataSizeSec * eps * nfield , file)); 856 dataPerPool += dataSizeSec; 867 857 } 868 858 dataPerPool /= nbPools; … … 870 860 871 861 // (3) Assign contextClient to each enabled file 872 std::vector<StdSize> poolData(nbPools); 873 int lazyPool = 0; 862 863 std::multimap<double,int> poolDataSize ; 864 // multimap is not garanty to preserve stable sorting in c++98 but it seems it does for c++11 865 866 int j; 867 double dataSize ; 868 for (j = 0 ; j < nbPools ; ++j) poolDataSize.insert(std::pair<double,int>(0.,j)) ; 869 874 870 for (int i = dataSizeMap.size()-1; i >= 0; --i) 875 871 { 876 bool contextSet = false; 877 for (int j = 0; j < nbPools; ++j) 878 { 879 if (!contextSet) 880 { 881 if (dataSizeMap[i].first + poolData[j] < dataPerPool) 882 { 883 dataSizeMap[i].second->setContextClient(clientPrimServer[j]); 884 poolData[j] += dataSizeMap[i].first; 885 contextSet = true; 886 } 887 } 888 if (poolData[j] < poolData[lazyPool]) 889 lazyPool = j; 890 } 891 if (!contextSet) 892 { 893 dataSizeMap[i].second->setContextClient(clientPrimServer[lazyPool]); 894 poolData[lazyPool] += dataSizeMap[i].first; 895 } 896 } 897 872 dataSize=(*poolDataSize.begin()).first ; 873 j=(*poolDataSize.begin()).second ; 874 dataSizeMap[i].second->setContextClient(clientPrimServer[j]); 875 dataSize+=dataSizeMap[i].first; 876 poolDataSize.erase(poolDataSize.begin()) ; 877 poolDataSize.insert(std::pair<double,int>(dataSize,j)) ; 878 } 879 880 for (std::multimap<double,int>:: iterator it=poolDataSize.begin() ; it!=poolDataSize.end(); ++it) info(30)<<"Load Balancing for servers (perfect=1) : "<<it->second<<" : ratio "<<it->first*1./dataPerPool<<endl ; 881 898 882 for (int i = 0; i < this->enabledReadModeFiles.size(); ++i) 899 883 enabledReadModeFiles[i]->setContextClient(client); -
XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.cpp
r1202 r1215 876 876 } 877 877 878 size_t CDomain::getGlobalWrittenSize(void) 879 { 880 return global_zoom_ni*global_zoom_nj ; 881 } 878 882 //---------------------------------------------------------------- 879 883 -
XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.hpp
r1158 r1215 153 153 void recvArea(std::map<int, CBufferIn*>& rankBuffers); 154 154 void recvDataIndex(std::map<int, CBufferIn*>& rankBuffers); 155 155 size_t getGlobalWrittenSize() ; 156 156 /// Destructeur /// 157 157 virtual ~CDomain(void); -
XIOS/dev/XIOS_DEV_CMIP6/src/node/field.cpp
r1201 r1215 796 796 } 797 797 798 size_t CField::getGlobalWrittenSize() 799 { 800 return grid->getGlobalWrittenSize(); 801 } 802 798 803 //---------------------------------------------------------------- 799 804 -
XIOS/dev/XIOS_DEV_CMIP6/src/node/field.hpp
r1158 r1215 127 127 128 128 void buildFilterGraph(CGarbageCollector& gc, bool enableOutput); 129 size_t getGlobalWrittenSize(void) ; 130 131 129 132 boost::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc); 130 133 boost::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc); -
XIOS/dev/XIOS_DEV_CMIP6/src/node/grid.cpp
r1202 r1215 170 170 dataSizes[p].insert(std::make_pair(rank, extraSize + CArray<double,1>::size(count))); 171 171 } 172 172 173 } 173 174 … … 175 176 } 176 177 178 size_t CGrid::getGlobalWrittenSize(void) 179 { 180 std::vector<CDomain*> domainP = this->getDomains(); 181 std::vector<CAxis*> axisP = this->getAxis(); 182 183 size_t globalGridSize=1 ; 184 for (std::vector<CDomain*>::iterator it=domainP.begin(); it!=domainP.end();++it) globalGridSize*=(*it)->getGlobalWrittenSize() ; 185 for (std::vector<CAxis*>::iterator it=axisP.begin(); it!=axisP.end();++it) globalGridSize*=(*it)->getGlobalWrittenSize() ; 186 return globalGridSize ; 187 } 188 189 177 190 void CGrid::checkAttributesAfterTransformation() 178 191 { -
XIOS/dev/XIOS_DEV_CMIP6/src/node/grid.hpp
r1202 r1215 199 199 std::map<CGrid*, std::pair<bool,StdString> >& getTransGridSource(); 200 200 bool hasTransform(); 201 201 size_t getGlobalWrittenSize(void) ; 202 202 public: 203 203
Note: See TracChangeset
for help on using the changeset viewer.