Changeset 1129 for XIOS/dev/dev_olga/src/node/axis.cpp
- Timestamp:
- 05/11/17 18:25:20 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/axis.cpp
r1099 r1129 28 28 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 29 29 , transformationMap_(), hasValue(false), doZoomByIndex_(false) 30 , computedWrittenIndex_(false) 30 31 { 31 32 } … … 38 39 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 39 40 , transformationMap_(), hasValue(false), doZoomByIndex_(false) 41 , computedWrittenIndex_(false) 40 42 { 41 43 } … … 129 131 { 130 132 return offsetWrittenIndexes_; 131 }132 133 /*!134 Returns the start of indexes written by each server.135 \return the start of indexes written by each server136 */137 int CAxis::getStartWriteIndex() const138 {139 return start_write_index_;140 }141 142 /*!143 Returns the count of indexes written by each server.144 \return the count of indexes written by each server145 */146 int CAxis::getCountWriteIndex() const147 {148 return count_write_index_;149 }150 151 /*!152 Returns the local data written by each server.153 */154 int CAxis::getLocalWriteSize() const155 {156 return local_write_size_;157 }158 159 /*!160 Returns the global data written by all server.161 */162 int CAxis::getGlobalWriteSize() const163 {164 return global_write_size_;165 133 } 166 134 … … 454 422 else 455 423 { 456 sendDistributedAttributes(); 457 sendDistributionAttribute(globalDim, orderPositionInGrid, distType); 424 sendDistributedAttributes(); 458 425 } 426 sendDistributionAttribute(globalDim, orderPositionInGrid, distType); 459 427 } 460 428 … … 639 607 } 640 608 } 609 610 void CAxis::computeWrittenIndex() 611 { 612 if (computedWrittenIndex_) return; 613 computedWrittenIndex_ = true; 614 615 CContext* context=CContext::getCurrent() ; 616 CContextClient* client = context->client; 617 618 std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1); 619 nBegin[0] = zoom_begin; 620 nSize[0] = zoom_n; 621 nBeginGlobal[0] = 0; 622 nGlob[0] = n_glo; 623 CDistributionServer srvDist(client->clientSize, nBegin, nSize, nBeginGlobal, nGlob); 624 const CArray<size_t,1>& writtenGlobalIndex = srvDist.getGlobalIndex(); 625 626 size_t nbWritten = 0, indGlo; 627 boost::unordered_map<size_t,size_t>::const_iterator itb = globalLocalIndexMap_.begin(), 628 ite = globalLocalIndexMap_.end(), it; 629 CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(), 630 itSrve = writtenGlobalIndex.end(), itSrv; 631 localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 632 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 633 { 634 indGlo = *itSrv; 635 if (ite != globalLocalIndexMap_.find(indGlo)) 636 { 637 localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[indGlo]; 638 ++nbWritten; 639 } 640 } 641 642 } 643 641 644 642 645 … … 875 878 CMessage& msg = msgs.back(); 876 879 msg << this->getId(); 877 msg << index.getValue() << dataIndex << zoom_index.getValue() << mask.getValue(); 880 msg << index.getValue() << dataIndex << mask.getValue(); 881 882 msg << doZoomByIndex_; 883 if (doZoomByIndex_) msg << zoom_index.getValue(); 878 884 msg << hasValue; 879 885 if (hasValue) msg << value.getValue(); 880 881 886 msg << hasBounds_; 882 887 if (hasBounds_) msg << bounds.getValue(); … … 913 918 buffer >> tmp_data_index; 914 919 data_index.reference(tmp_data_index); 915 buffer >> tmp_zoom_index;916 zoom_index.reference(tmp_zoom_index);917 920 buffer >> tmp_mask; 918 921 mask.reference(tmp_mask); 922 923 buffer >> doZoomByIndex_; 924 if (doZoomByIndex_) 925 { 926 buffer >> tmp_zoom_index; 927 zoom_index.reference(tmp_zoom_index); 928 } 929 919 930 buffer >> hasValue; 920 931 if (hasValue) … … 931 942 } 932 943 933 { 934 count_write_index_ = zoom_index.numElements(); 935 start_write_index_ = 0; 936 local_write_size_ = count_write_index_; 937 global_write_size_ = count_write_index_; 938 } 944 data_begin.setValue(0); 945 globalLocalIndexMap_.rehash(std::ceil(index.numElements()/globalLocalIndexMap_.max_load_factor())); 946 for (int idx = 0; idx < index.numElements(); ++idx) globalLocalIndexMap_[idx] = index(idx); 939 947 } 940 948 … … 1065 1073 get(axisId)->recvDistributedAttributes(ranks, buffers); 1066 1074 } 1075 1067 1076 1068 1077 void CAxis::recvDistributedAttributes(vector<int>& ranks, vector<CBufferIn*> buffers) … … 1099 1108 nbData += vec_indi[idx].numElements(); 1100 1109 } 1101 1110 1102 1111 index.resize(nbData); 1112 globalLocalIndexMap_.rehash(std::ceil(index.numElements()/globalLocalIndexMap_.max_load_factor())); 1103 1113 CArray<int,1> nonCompressedData(nbData); 1104 1114 mask.resize(nbData); … … 1118 1128 { 1119 1129 index(nbData) = indi(n); 1130 globalLocalIndexMap_[indi(n)] = nbData; 1120 1131 nonCompressedData(nbData) = (0 <= dataIndi(n)) ? nbData : -1; 1121 1132 mask(nbData) = maskIndi(n); … … 1149 1160 } 1150 1161 } 1162 data_begin.setValue(0); 1151 1163 1152 1164 if (doZoomByIndex_) … … 1170 1182 } 1171 1183 } 1172 1173 1174 // {1175 // CContextServer* server = CContext::getCurrent()->server;1176 // count_write_index_ = zoom_index.numElements();1177 // MPI_Scan(&count_write_index_, &start_write_index_, 1, MPI_INT, MPI_SUM, server->intraComm);1178 // global_write_size_ = start_write_index_;1179 // start_write_index_ -= count_write_index_;1180 // local_write_size_ = count_write_index_;1181 // }1182 1184 } 1183 1185
Note: See TracChangeset
for help on using the changeset viewer.