22 , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false)
23 , isClientAfterTransformationChecked(false)
24 , hasBounds(false), isCompressible_(false)
25 , numberWrittenIndexes_(), totalNumberWrittenIndexes_(), offsetWrittenIndexes_()
26 , transformationMap_(), hasValue(false), hasLabel(false)
27 , computedWrittenIndex_(false)
34 , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false)
35 , isClientAfterTransformationChecked(false)
36 , hasBounds(false), isCompressible_(false)
37 , numberWrittenIndexes_(), totalNumberWrittenIndexes_(), offsetWrittenIndexes_()
38 , transformationMap_(), hasValue(false), hasLabel(false)
39 , computedWrittenIndex_(false)
77 return (this->relFiles.find(filename) != this->relFiles.end());
84 return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end());
91 bool distributed = (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) ||
92 (!this->n.isEmpty() && (this->n != this->n_glo));
115 this->relFiles.insert(filename);
122 this->relFilesCompressed.insert(filename);
136 MPI_Comm_size(writtenCom, &writtenSize);
137 return numberWrittenIndexes_[writtenSize];
149 MPI_Comm_size(writtenCom, &writtenSize);
150 return totalNumberWrittenIndexes_[writtenSize];
162 MPI_Comm_size(writtenCom, &writtenSize);
163 return offsetWrittenIndexes_[writtenSize];
171 MPI_Comm_size(writtenCom, &writtenSize);
172 return compressedIndexToWriteOnServer[writtenSize];
188 std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes(client);
192 || (index.numElements() != n_glo);
194 if (client->isServerLeader())
197 size_t size = 6 *
sizeof(size_t);
213 const std::list<int>& ranks = client->getRanksServerLeader();
214 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
216 if (size > attributesSizes[*itRank])
217 attributesSizes[*itRank] = size;
219 const std::list<int>& ranksNonLeaders = client->getRanksServerNotLeader();
220 for (std::list<int>::const_iterator itRank = ranksNonLeaders.begin(), itRankEnd = ranksNonLeaders.end(); itRank != itRankEnd; ++itRank)
222 if (size > attributesSizes[*itRank])
223 attributesSizes[*itRank] = size;
231 std::unordered_map<int, vector<size_t> >::const_iterator it, ite = indSrv_[client->serverSize].end();
232 for (it = indSrv_[client->serverSize].begin(); it != ite; ++it)
234 size_t size = 6 *
sizeof(size_t);
245 if (size > attributesSizes[it->first])
246 attributesSizes[it->first] = size;
249 return attributesSizes;
264 CAxis* axis = CAxisGroup::get(
"axis_definition")->createChild();
278 if (this->n_glo.isEmpty())
279 ERROR(
"CAxis::checkAttributes(void)",
281 <<
"The axis is wrongly defined, attribute 'n_glo' must be specified");
282 StdSize size = this->n_glo.getValue();
284 if (!this->index.isEmpty())
286 if (n.isEmpty()) n = index.numElements();
290 if (begin.isEmpty()) begin = index(0);
294 if (!this->begin.isEmpty())
296 if (begin < 0 || begin > size - 1)
297 ERROR(
"CAxis::checkAttributes(void)",
299 <<
"The axis is wrongly defined, attribute 'begin' (" << begin.getValue() <<
") must be non-negative and smaller than size-1 (" << size - 1 <<
").");
301 else this->begin.setValue(0);
303 if (!this->n.isEmpty())
305 if (n < 0 || n > size)
306 ERROR(
"CAxis::checkAttributes(void)",
308 <<
"The axis is wrongly defined, attribute 'n' (" << n.getValue() <<
") must be non-negative and smaller than size (" << size <<
").");
310 else this->n.setValue(size);
314 for (
int i = 0; i < n; ++i) index(i) = i+begin;
318 if (!this->value.isEmpty())
323 StdSize true_size = value.numElements();
324 if (this->n.getValue() != true_size)
325 ERROR(
"CAxis::checkAttributes(void)",
327 <<
"The axis is wrongly defined, attribute 'value' has a different size (" << true_size
328 <<
") than the one defined by the \'size\' attribute (" << n.getValue() <<
").");
350 if (data_begin.isEmpty()) data_begin.setValue(0);
352 if (data_n.isEmpty())
356 else if (data_n.getValue() < 0)
358 ERROR(
"CAxis::checkData(void)",
360 <<
"The data size should be strictly positive ('data_n' = " << data_n.getValue() <<
").");
363 if (data_index.isEmpty())
365 data_index.resize(data_n);
366 for (
int i = 0; i < data_n; ++i)
368 if ((i+data_begin) >= 0 && (i+data_begin<n))
370 if (mask(i+data_begin))
371 data_index(i) = i+data_begin;
381 if (data_index.numElements() != data_n)
383 ERROR(
"CAxis::checkData(void)",
385 <<
"The size of data_index = "<< data_index.numElements() <<
"is not equal to the data size data_n = " << data_n.getValue() <<
").");
387 for (
int i = 0; i < data_n; ++i)
389 if ((i+data_begin) >= 0 && (i+data_begin<n) && !mask(i+data_begin))
410 if (mask.extent(0) != n)
412 ERROR(
"CAxis::checkMask(void)",
414 <<
"The mask does not have the same size as the local domain." << std::endl
415 <<
"Local size is " << n.getValue() <<
"." << std::endl
416 <<
"Mask size is " << mask.extent(0) <<
".");
433 if (!bounds.isEmpty())
435 if (bounds.extent(0) != 2 || bounds.extent(1) != n)
436 ERROR(
"CAxis::checkAttributes(void)",
438 <<
"Axis size is " << n.getValue() <<
"." << std::endl
439 <<
"Bounds size is "<< bounds.extent(0) <<
" x " << bounds.extent(1) <<
".");
449 if (!label.isEmpty())
451 if (label.extent(0) != n)
452 ERROR(
"CAxis::checkLabel(void)",
454 <<
"Axis size is " << n.getValue() <<
"." << std::endl
455 <<
"label size is "<< label.extent(0)<<
" .");
479 if (SuperClass::dispatchEvent(event))
return true;
484 case EVENT_ID_DISTRIBUTION_ATTRIBUTE :
485 recvDistributionAttribute(event);
488 case EVENT_ID_NON_DISTRIBUTED_ATTRIBUTES:
489 recvNonDistributedAttributes(event);
492 case EVENT_ID_DISTRIBUTED_ATTRIBUTES:
493 recvDistributedAttributes(event);
497 ERROR(
"bool CAxis::dispatchEvent(CEventServer& event)",
530 if (this->isClientAfterTransformationChecked)
return;
534 computeConnectedClients(globalDim, orderPositionInGrid, distType);
538 this->isClientAfterTransformationChecked =
true;
553 if (!this->areClientAttributesChecked_) checkAttributesOnClient();
554 if (!this->isClientAfterTransformationChecked) checkAttributesOnClientAfterTransformation(globalDim, orderPositionInGrid, distType);
557 if (this->isChecked)
return;
558 if (context->
hasClient) sendAttributes(globalDim, orderPositionInGrid, distType);
560 this->isChecked =
true;
573 sendDistributionAttribute(globalDim, orderPositionInGrid, distType);
577 || (index.numElements() != n_glo))
579 sendDistributedAttributes();
583 sendNonDistributedAttributes();
604 connectedServerRank_.clear();
607 for (
int p = 0; p < nbSrvPools; ++p)
614 if (connectedServerRank_.find(nbServer) == connectedServerRank_.end())
616 size_t ni = this->n.getValue();
617 size_t ibegin = this->begin.getValue();
618 size_t nbIndex = index.numElements();
621 if (globalLocalIndexMap_.empty())
623 for (
size_t idx = 0; idx < nbIndex; ++idx)
625 globalLocalIndexMap_[index(idx)] = idx;
646 std::vector<int> nGlobAxis(1);
647 nGlobAxis[0] = n_glo.getValue();
649 size_t globalSizeIndex = 1, indexBegin, indexEnd;
650 for (
int i = 0; i < nGlobAxis.size(); ++i) globalSizeIndex *= nGlobAxis[i];
652 if (globalSizeIndex <= clientSize)
654 indexBegin = rank%globalSizeIndex;
655 indexEnd = indexBegin;
659 for (
int i = 0; i < clientSize; ++i)
661 range = globalSizeIndex / clientSize;
662 if (i < (globalSizeIndex%clientSize)) ++range;
666 indexEnd = indexBegin + range - 1;
670 for (
size_t idx = 0; idx < globalIndex.numElements(); ++idx)
671 globalIndex(idx) = index(idx);
677 std::vector<int> serverZeroIndex;
680 std::list<int> serverZeroIndexLeader;
681 std::list<int> serverZeroIndexNotLeader;
683 for (std::list<int>::iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it)
684 *it = serverZeroIndex[*it];
691 indSrv_[nbServer].swap(globalIndexAxisOnServer);
695 for(
int i=1; i<nbServer; ++i) indSrv_[nbServer].insert(pair<
int, vector<size_t> >(i,indSrv_[nbServer][0]) ) ;
696 serverZeroIndexLeader.clear() ;
699 CClientServerMapping::GlobalIndexMap::const_iterator it = indSrv_[nbServer].begin(),
700 ite = indSrv_[nbServer].end();
702 for (it = indSrv_[nbServer].begin(); it != ite; ++it) connectedServerRank_[nbServer].push_back(it->first);
704 for (std::list<int>::const_iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it)
705 connectedServerRank_[nbServer].push_back(*it);
709 if (connectedServerRank_[nbServer].empty())
714 delete clientServerMap;
735 std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1);
745 size_t nbWritten = 0, indGlo;
749 itSrve = writtenGlobalIndex.end(), itSrv;
753 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
774 MPI_Comm_size(writtenComm, &writtenCommSize);
775 if (compressedIndexToWriteOnServer.find(writtenCommSize) != compressedIndexToWriteOnServer.end())
778 if (isCompressible())
780 size_t nbWritten = 0, indGlo;
785 std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1);
792 std::unordered_map<size_t,size_t>::const_iterator itb = globalLocalIndexMap_.begin(),
793 ite = globalLocalIndexMap_.end(), it;
796 itSrve = writtenGlobalIndex.end(), itSrv;
797 std::unordered_map<size_t,size_t> localGlobalIndexMap;
798 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
801 if (ite != globalLocalIndexMap_.find(indGlo))
803 localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo;
829 for (
int idx = 0; idx < data_index.numElements(); ++idx)
831 if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx)))
837 compressedIndexToWriteOnServer[writtenCommSize].resize(nbWritten);
839 for (
int idx = 0; idx < data_index.numElements(); ++idx)
841 if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx)))
843 compressedIndexToWriteOnServer[writtenCommSize](nbWritten) = localGlobalIndexMap[data_index(idx)];
848 numberWrittenIndexes_[writtenCommSize] = nbWritten;
850 bool distributed_glo, distributed=isDistributed() ;
851 MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, writtenComm) ;
855 MPI_Allreduce(&numberWrittenIndexes_[writtenCommSize], &totalNumberWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm);
856 MPI_Scan(&numberWrittenIndexes_[writtenCommSize], &offsetWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm);
857 offsetWrittenIndexes_[writtenCommSize] -= numberWrittenIndexes_[writtenCommSize];
860 totalNumberWrittenIndexes_[writtenCommSize] = numberWrittenIndexes_[writtenCommSize];
876 std::list<CContextClient*>::iterator it;
877 for (it=clients.begin(); it!=clients.end(); ++it)
888 CEventClient event(getType(),EVENT_ID_DISTRIBUTION_ATTRIBUTE);
891 std::list<CMessage> msgs;
894 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
897 const int begin = serverIndexBegin[*itRank][orderPositionInGrid];
898 const int ni = serverDimensionSizes[*itRank][orderPositionInGrid];
902 msg << this->getId();
904 msg << isCompressible_;
906 event.
push(*itRank,1,msg);
925 get(axisId)->recvDistributionAttribute(*buffer);
936 int ni_srv, begin_srv;
937 buffer >> ni_srv >> begin_srv;
938 buffer >> isCompressible_;
942 begin.setValue(begin_srv);
954 std::list<CContextClient*>::iterator it;
960 size_t nbIndex = index.numElements();
961 size_t nbDataIndex = 0;
963 for (
int idx = 0; idx < data_index.numElements(); ++idx)
965 int ind = data_index(idx);
966 if (ind >= 0 && ind < nbIndex) ++nbDataIndex;
971 for (
int idx = 0; idx < data_index.numElements(); ++idx)
973 int ind = data_index(idx);
974 if (ind >= 0 && ind < nbIndex)
976 dataIndex(nbDataIndex) =
ind;
983 std::list<CMessage> msgs;
986 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
990 msg << this->
getId();
991 msg << index.getValue() << dataIndex << mask.getValue();
993 if (hasValue) msg << value.getValue();
995 if (hasBounds) msg << bounds.getValue();
997 if (hasLabel) msg << label.getValue();
999 event.
push(*itRank, 1, msg);
1015 list<CEventServer::SSubEvent>::iterator it;
1016 for (it = event.subEvents.begin(); it !=
event.subEvents.end(); ++it)
1021 get(axisId)->recvNonDistributedAttributes(it->rank, *buffer);
1040 buffer >> tmp_index;
1042 buffer >> tmp_data_index;
1054 buffer >> hasBounds;
1064 buffer >> tmp_label;
1069 data_begin.setValue(0);
1070 globalLocalIndexMap_.rehash(std::ceil(index.numElements()/globalLocalIndexMap_.max_load_factor()));
1072 for (
int idx = 0; idx < index.numElements(); ++idx) globalLocalIndexMap_[index(idx)] = idx;
1085 std::list<CContextClient*>::iterator it;
1094 list<CMessage> listData;
1095 list<CArray<int,1> > list_indi, list_dataInd;
1096 list<CArray<double,1> > list_val;
1097 list<CArray<double,2> > list_bounds;
1098 list<CArray<string,1> > list_label;
1101 int nbIndex = index.numElements();
1104 for (idx = 0; idx < data_index.numElements(); ++idx)
1106 if (0 <= data_index(idx) && data_index(idx) < nbIndex)
1107 dataIndex(data_index(idx)) = 1;
1110 std::unordered_map<int, std::vector<size_t> >::const_iterator it, iteMap;
1111 iteMap =
indSrv_[nbServer].end();
1114 int nbData = 0, nbDataCount = 0;
1116 it =
indSrv_[nbServer].find(rank);
1118 nbData = it->second.size();
1136 for (
int n = 0; n < nbData; ++n)
1138 idx =
static_cast<int>(it->second[n]);
1142 dataIndi(n) = dataIndex(ind);
1147 val(n) = value(ind);
1153 boundsVal(0, n) = bounds(0,ind);
1154 boundsVal(1, n) = bounds(1,ind);
1160 labelVal(n) = label(ind);
1165 listData.back() << this->
getId()
1166 << list_indi.back() << list_dataInd.back();
1170 listData.back() << list_val.back();
1174 listData.back() << list_bounds.back();
1178 listData.back() << list_label.back();
1180 eventData.
push(rank,
nbSenders[nbServer][rank], listData.back());
1197 vector<CBufferIn*> buffers;
1199 list<CEventServer::SSubEvent>::iterator it;
1200 for (it = event.subEvents.begin(); it !=
event.subEvents.end(); ++it)
1202 ranks.push_back(it->rank);
1205 buffers.push_back(buffer);
1207 get(axisId)->recvDistributedAttributes(ranks, buffers);
1219 int nbReceived = ranks.size(), idx,
ind, gloInd, locInd;
1220 vector<CArray<int,1> > vec_indi(nbReceived), vec_dataInd(nbReceived);
1221 vector<CArray<double,1> > vec_val(nbReceived);
1222 vector<CArray<double,2> > vec_bounds(nbReceived);
1223 vector<CArray<string,1> > vec_label(nbReceived);
1225 for (idx = 0; idx < nbReceived; ++idx)
1228 buffer >> vec_indi[idx];
1229 buffer >> vec_dataInd[idx];
1233 buffer >> vec_val[idx];
1235 buffer >> hasBounds;
1237 buffer >> vec_bounds[idx];
1241 buffer >> vec_label[idx];
1245 int nbIndexGlob = 0;
1246 for (idx = 0; idx < nbReceived; ++idx)
1248 nbIndexGlob += vec_indi[idx].numElements();
1253 index.resize(nbIndexGlob);
1254 globalLocalIndexMap_.rehash(std::ceil(index.numElements()/globalLocalIndexMap_.max_load_factor()));
1257 for (idx = 0; idx < nbReceived; ++idx)
1260 for (ind = 0; ind < tmp.numElements(); ++
ind)
1263 nbIndLoc = (gloInd % n_glo)-begin;
1264 if (0 == globalLocalIndexMap_.count(gloInd))
1266 index(nbIndexGlob) = gloInd % n_glo;
1267 globalLocalIndexMap_[gloInd] = nbIndexGlob;
1274 if (nbIndexGlob==0) index.resize(nbIndexGlob) ;
1275 else index.resizeAndPreserve(nbIndexGlob);
1277 int nbData = nbIndexGlob;
1279 nonCompressedData = -1;
1283 value.resize(nbData);
1285 bounds.resize(2,nbData);
1287 label.resize(nbData);
1290 for (idx = 0; idx < nbReceived; ++idx)
1294 int nb = indi.numElements();
1295 for (
int n = 0; n < nb; ++n)
1297 locInd = globalLocalIndexMap_[size_t(indi(n))];
1299 nonCompressedData(locInd) = (-1 == nonCompressedData(locInd)) ? dataIndi(n) : nonCompressedData(locInd);
1302 value(locInd) = vec_val[idx](n);
1306 bounds(0,locInd) = vec_bounds[idx](0,n);
1307 bounds(1,locInd) = vec_bounds[idx](1,n);
1311 label(locInd) = vec_label[idx](n);
1315 int nbCompressedData = 0;
1316 for (idx = 0; idx < nonCompressedData.numElements(); ++idx)
1318 if (0 <= nonCompressedData(idx))
1322 data_index.resize(nbCompressedData);
1323 nbCompressedData = 0;
1324 for (idx = 0; idx < nonCompressedData.numElements(); ++idx)
1326 if (0 <= nonCompressedData(idx))
1328 data_index(nbCompressedData) = idx % n;
1333 data_begin.setValue(0);
1334 data_n.setValue(data_index.numElements());
1348 vector<StdString> excludedAttr;
1349 excludedAttr.push_back(
"axis_ref");
1351 bool objEqual = SuperClass::isEqual(obj, excludedAttr);
1352 if (!objEqual)
return objEqual;
1357 TransMapTypes::const_iterator it, itb, ite;
1358 std::vector<ETranformationType> thisTransType, objTransType;
1359 for (it = thisTrans.begin(); it != thisTrans.end(); ++it)
1360 thisTransType.push_back(it->first);
1361 for (it = objTrans.begin(); it != objTrans.end(); ++it)
1362 objTransType.push_back(it->first);
1364 if (thisTransType.size() != objTransType.size())
return false;
1365 for (
int idx = 0; idx < thisTransType.size(); ++idx)
1366 objEqual &= (thisTransType[idx] == objTransType[idx]);
1381 return transformationMap_.back().second;
1402 transformationMap_ = axisTrans;
1424 if (src->hasTransformation())
1426 this->setTransformations(src->getAllTransformations());
1441 std::vector<CAxis*> refAxis;
1444 refAxis.push_back(axis);
1445 axis = axis->getDirectAxisReference();
1449 for (
size_t i = 0; i < refAxis.size(); ++i)
1457 if (clientsSet.find(contextClient)==clientsSet.end())
1459 clients.push_back(contextClient) ;
1460 clientsSet.insert(contextClient);
1468 SuperClass::parse(node);
1470 if (node.goToChildElement())
1476 if (node.getAttributes().end() != node.getAttributes().find(
"id"))
1477 { nodeId = node.getAttributes()[
"id"]; }
1479 nodeElementName = node.getElementName();
1480 std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it;
1481 it = transformationMapList_.find(nodeElementName);
1490 ERROR(
"void CAxis::parse(xml::CXMLNode & node)",
1491 <<
"The transformation " << nodeElementName <<
" has not been supported yet.");
1493 }
while (node.goToNextElement()) ;
1494 node.goToParentElement();
This class contains information that describe distribution of servers.
static const size_t headerSize
virtual void parse(xml::CXMLNode &node)
CATCH CDomainAlgorithmReorder::CDomainAlgorithmReorder(CDomain *domainDestination, CDomain *domainSource, CReorderDomain *reorderDomain if)(domainDestination->type!=CDomain::type_attr::rectilinear)
static void computeLeader(int clientRank, int clientSize, int serverSize, std::list< int > &rankRecvLeader, std::list< int > &rankRecvNotLeader)
void sendEvent(CEventClient &event)
In case of attached mode, the current context must be reset to context for client.
CArray< int, 1 > & getCompressedIndexToWriteOnServer(MPI_Comm writtenCom)
int getNumberWrittenIndexes(MPI_Comm writtenCom)
Returns the number of indexes written by each server.
static void recvDistributionAttribute(CEventServer &event)
static StdString GetName(void)
Accesseurs statiques ///.
MPI_Comm intraComm
Communicator of client group.
virtual size_t size(void) const
std::map< int, std::unordered_map< int, vector< size_t > > > indSrv_
static bool dispatchEvent(CEventServer &event)
Dispatch event from the lower communication layer then process event according to its type...
#define DEFINE_REF_FUNC(type, name_)
void checkAttributesOnClient()
Check attributes on client side (This name is still adequate???)
enum xios::transformation_type ETranformationType
////////////////////// Définitions ////////////////////// ///
void solveInheritanceTransformation()
Go through the hierarchy to find the axis from which the transformations must be inherited.
bool isEqual(CAxis *axis)
Compare two axis objects.
bool isCompressible_
True if and only if the data defined on the axis can be outputted in a compressed way...
int getTotalNumberWrittenIndexes(MPI_Comm writtenCom)
Returns the total number of indexes written by the servers.
void computeConnectedClients(const std::vector< int > &globalDim, int orderPositionInGrid, CServerDistributionDescription::ServerDistributionType distType)
int getOffsetWrittenIndexes(MPI_Comm writtenCom)
Returns the offset of indexes written by each server.
void addRelFile(const StdString &filename)
Mutateur ///.
int clientSize
Size of client group.
std::vector< CContextClient * > clientPrimServer
static CAxis * createAxis()
CContextServer * server
Concrete context server.
std::vector< int > computeServerGlobalIndexInRange(const std::pair< size_t, size_t > &indexBeginEnd, int positionDimensionDistributed=1)
Compute global index assigned to a server with a range.E.g: if a grid has 100 points and there are 2 ...
void sendAttributes(const std::vector< int > &globalDim, int orderPositionInGrid, CServerDistributionDescription::ServerDistributionType distType)
Send attributes from one client to other clients.
void checkEligibilityForCompressedOutput()
Check whether we can do compressed output.
std::vector< std::vector< int > > getServerDimensionSizes() const
Get size of each dimension on distributed server.
bool isCompressible(void) const
Test whether the data defined on the axis can be outputted in a compressed way.
CTransformation< CAxis >::TransformationMapTypes TransMapTypes
static bool initializeTransformationMap(std::map< StdString, ETranformationType > &m)
std::list< CContextClient * > clients
void sendDistributedAttributes(void)
const std::list< int > & getRanksServerLeader(void) const
Get leading server in the group of connected server.
virtual ~CAxis(void)
Destructeur ///.
const StdString & getId(void) const
Accesseurs ///.
Description of index distribution on server(s).
std::vector< std::vector< int > > getServerIndexBegin() const
Get index begin of each dimension on distributed server.
const GlobalIndexMap & getGlobalIndexOnServer() const
Return global index of data on each connected server.
CTransformation< CAxis > * addTransformation(ETranformationType transType, const StdString &id="")
bool isDistributed(void) const
void checkAttributes(void)
Vérifications ///.
void computeWrittenIndex()
This class computes index of data which are sent to server as well as index of data on server side...
static bool dummyTransformationMapList_
const CArray< size_t, 1 > & getGlobalIndex() const
Get rank of current process.
static StdString GetDefName(void)
void checkMask()
Check validity of mask info and fill in values if any.
static void recvNonDistributedAttributes(CEventServer &event)
static void recvDistributedAttributes(CEventServer &event)
virtual void computeServerIndexMapping(const CArray< size_t, 1 > &globalIndexOnClient, int nbServer)=0
CArray< int, 1 > localIndexToWriteOnServer
std::unordered_map< int, std::vector< size_t > > GlobalIndexMap
CATCH CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar *scalarDestination, CScalar *scalarSource, CReduceScalarToScalar *algo ERROR)("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)",<< "Operation must be defined."<< "Scalar source "<< scalarSource->getId()<< std::endl<< "Scalar destination "<< scalarDestination->getId())
A context can be both on client and on server side.
////////////////////// Déclarations ////////////////////// ///
void push(int rank, int nbSender, CMessage &msg)
void checkData()
Check the validity of data, fill in values if any, and apply mask.
const std::set< StdString > & getRelFiles(void) const
Accesseurs ///.
CMessage & push(const CBaseType &type)
std::map< int, map< int, int > > nbSenders
int clientRank
Rank of current client.
void setContextClient(CContextClient *contextClient)
void sendCheckedAttributes(const std::vector< int > &globalDim, int orderPositionInGrid, CServerDistributionDescription::ServerDistributionType disType=CServerDistributionDescription::BAND_DISTRIBUTION)
std::map< int, std::vector< int > > connectedServerRank_
size_t getGlobalWrittenSize(void)
int serverSize
Size of server group.
void addRelFileCompressed(const StdString &filename)
static ENodeType GetType(void)
static std::map< StdString, ETranformationType > transformationMapList_
std::map< int, StdSize > getAttributesBufferSize(CContextClient *client, const std::vector< int > &globalDim, int orderPositionInGrid, CServerDistributionDescription::ServerDistributionType disType=CServerDistributionDescription::BAND_DISTRIBUTION)
Compute the minimum buffer size required to send the attributes to the server(s). ...
void computeServerDistribution(bool doComputeGlobalIndex=false, int positionDimensionDistributed=1)
Compute pre-defined global index distribution of server(s).
Index distribution on client side.
void checkBounds()
Check validity of bounds info and fill in values if any.
enum xios::_node_type ENodeType
////////////////////// Définitions ////////////////////// ///
void sendDistributionAttribute(const std::vector< int > &globalDim, int orderPositionInGrid, CServerDistributionDescription::ServerDistributionType distType)
Send distribution information from a group of client (client role) to another group of client (server...
std::unordered_map< size_t, size_t > globalLocalIndexMap_
which implements a simple distributed hashed table; Moreover, by extending with hierarchical structur...
TransMapTypes transformationMap_
void computeWrittenCompressedIndex(MPI_Comm)
bool areClientAttributesChecked_
bool isWrittenCompressed(const StdString &filename) const
const std::unordered_map< size_t, int > & getGlobalIndexRange() const
Get global index calculated by computeServerGlobalIndexInRange.
TransMapTypes getAllTransformations()
static std::map< int, int > computeConnectedClients(int nbServer, int nbClient, MPI_Comm &clientIntraComm, const std::vector< int > &connectedServerRank)
Compute how many clients each server will receive data from On client can send data to several server...
CAxis(void)
Constructeurs ///.
void sendNonDistributedAttributes(void)
static int defaultDistributedDimension(int gridDimension, ServerDistributionType serType=BAND_DISTRIBUTION)
ENodeType getType(void) const
Accesseurs ///.
bool IsWritten(const StdString &filename) const
Test ///.
bool computedWrittenIndex_
The class, for now, plays a role of computing local index for writing data on server.
std::set< StdString > relFiles
void setTransformations(const TransMapTypes &)
void checkAttributesOnClientAfterTransformation(const std::vector< int > &globalDim, int orderPositionInGrid, CServerDistributionDescription::ServerDistributionType distType=CServerDistributionDescription::BAND_DISTRIBUTION)
static CContext * getCurrent(void)
Get current context.
CContextClient * client
Concrete contex client.
bool isServerLeader(void) const
Check if client connects to leading server.
void duplicateTransformation(CAxis *)
static StdString & GetCurrentContextId(void)
Accesseurs ///.
void reference(const CArray< T_numtype, N_rank > &array)