Changeset 553
- Timestamp:
- 02/11/15 16:23:12 (9 years ago)
- Location:
- XIOS/trunk
- Files:
-
- 4 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/inputs/Version2/iodef.xml
r551 r553 20 20 21 21 <axis_definition> 22 <axis id="axis_A" />22 <axis id="axis_A" zoom_size="2" zoom_end="2"/> 23 23 <axis id="axis_B" zoom_size="2" zoom_end="3" /> 24 24 </axis_definition> -
XIOS/trunk/src/distribution.cpp
r552 r553 1 /*! 2 \file distribution.hpp 3 \author Ha NGUYEN 4 \since 13 Jan 2015 5 \date 09 Feb 2015 6 7 \brief Index distribution on server side. 8 */ 1 9 #include "distribution.hpp" 2 10 … … 18 26 } 19 27 20 //const CArray<size_t,1>*CDistribution::getGlobalIndex() const21 //{22 // return globalIndex_;23 //}28 const CArray<size_t,1>& CDistribution::getGlobalIndex() const 29 { 30 return (*globalIndex_); 31 } 24 32 25 33 int CDistribution::getDims() const -
XIOS/trunk/src/distribution.hpp
r552 r553 1 /*! 2 \file distribution.hpp 3 \author Ha NGUYEN 4 \since 13 Jan 2015 5 \date 09 Feb 2015 6 7 \brief Index distribution on server side. 8 */ 1 9 #ifndef __XIOS_DISTRIBUTION_HPP__ 2 10 #define __XIOS_DISTRIBUTION_HPP__ … … 6 14 7 15 namespace xios { 16 /*! 17 \class CDistribution 18 The parent class of CDistributionClient and CDistributionServer, which declares and defines 19 some basic methods and properties for its children. This class allows its descendants to calculate 20 distribution of index on client or server side. 21 */ 8 22 class CDistribution 9 23 { … … 15 29 virtual ~CDistribution(); 16 30 17 int getDims() const; 18 int getRank() const; 31 int getDims() const; //! Get dimension size 32 int getRank() const; //! Get rank of current process 33 34 //! Get global index 35 const CArray<size_t,1>& getGlobalIndex() const; 19 36 protected: 20 37 virtual void createGlobalIndex() = 0; … … 23 40 int dims_; 24 41 int rank_; 25 private:26 42 }; 27 43 -
XIOS/trunk/src/node/axis.cpp
r551 r553 75 75 StdSize zoom_begin,zoom_end, zoom_size ; 76 76 77 // zoom_begin = (this->zoom_begin.isEmpty()) ? 1 : this->zoom_begin.getValue() ;78 // zoom_end = (this->zoom_end.isEmpty()) ? size : this->zoom_end.getValue() ;79 // zoom_size = (this->zoom_size.isEmpty()) ? size : this->zoom_size.getValue() ;80 81 77 // Maybe index begins at 0 (zero) 82 78 zoom_begin = (this->zoom_begin.isEmpty()) ? 0 : this->zoom_begin.getValue() ; … … 87 83 if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1 ; 88 84 if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1 ; 89 //90 // if ( (zoom_begin < 1) || (zoom_begin > size) || (zoom_end<1) || (zoom_end>size) || (zoom_size<1) || (zoom_size>size) || (zoom_begin>zoom_end))91 // ERROR("CAxis::checkAttributes(void)",<< "One or more attribut of <zoom_begin>, <zoom_end>, <zoom_size>, are not well specified") ;92 85 93 if ( (zoom_begin < 0) || (zoom_begin > size-1) || (zoom_end< 1) || (zoom_end>size-1) || (zoom_size<1) || (zoom_size>size) || (zoom_begin>zoom_end))86 if ( (zoom_begin < 0) || (zoom_begin > size-1) || (zoom_end<0) || (zoom_end>size-1) || (zoom_size<1) || (zoom_size>size) || (zoom_begin>zoom_end)) 94 87 ERROR("CAxis::checkAttributes(void)",<< "One or more attribut of <zoom_begin>, <zoom_end>, <zoom_size>, are not well specified") ; 95 88 … … 117 110 } 118 111 else if (data_n.isEmpty()) 119 data_n.setValue( zoom_size.getValue());112 data_n.setValue(ni.getValue()); 120 113 121 114 if (data_index.isEmpty()) -
XIOS/trunk/src/node/distribution_client.cpp
r552 r553 1 /*! 2 \file distribution_client.cpp 3 \author Ha NGUYEN 4 \since 13 Jan 2015 5 \date 09 Feb 2015 6 7 \brief Index distribution on client side. 8 */ 1 9 #include "distribution_client.hpp" 2 10 … … 5 13 CDistributionClient::CDistributionClient(int rank, int dims, CArray<size_t,1>* globalIndex) 6 14 : CDistribution(rank, dims, globalIndex), 7 localDataIndex_(0), indexGlobalOnServer_(), localIndexSend2Server_(),axisDomainOrder_(),15 localDataIndex_(0), axisDomainOrder_(), 8 16 nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_(),nZoomBegin_(), nZoomEnd_(), 9 17 dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_(), 10 gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), connectedClients_(), 11 isConnectedServerComputed_(false), indexDomainData_() 18 gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_() 12 19 { 13 20 } … … 15 22 CDistributionClient::CDistributionClient(int rank, CGrid* grid) 16 23 : CDistribution(rank, 0, 0), 17 localDataIndex_(0), indexGlobalOnServer_(), localIndexSend2Server_(),axisDomainOrder_(),24 localDataIndex_(0), axisDomainOrder_(), 18 25 nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_(),nZoomBegin_(), nZoomEnd_(), 19 26 dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_(), 20 gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), connectedClients_(), 21 isConnectedServerComputed_(false), indexDomainData_() 27 gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_() 22 28 { 23 29 readDistributionInfo(grid); … … 193 199 else // So it's an axis 194 200 { 195 nLocal_.at(indexMap_[idx]) = axisList[axisIndex]-> zoom_size.getValue();201 nLocal_.at(indexMap_[idx]) = axisList[axisIndex]->ni.getValue(); 196 202 nGlob_.at(indexMap_[idx]) = axisList[axisIndex]->size.getValue(); 197 nBeginLocal_.at(indexMap_[idx]) = axisList[axisIndex]->zoom_begin.getValue(); //ibegin.getValue();203 nBeginLocal_.at(indexMap_[idx]) = 0; 198 204 nBeginGlobal_.at(indexMap_[idx]) = axisList[axisIndex]->ibegin.getValue(); 199 205 nZoomBegin_.at((indexMap_[idx])) = axisList[axisIndex]->zoom_begin; … … 263 269 264 270 localAxisIndex_.resize(numAxis); 271 indexAxisData_.resize(numAxis); 265 272 266 273 int idxAxis = 0; … … 270 277 { 271 278 int iIdx = 0; 279 indexAxisData_[idxAxis].resize(dataNIndex_[i], false); 272 280 for (int j = 0; j < dataNIndex_[i]; ++j) 273 281 { … … 277 285 { 278 286 localAxisIndex_[idxAxis].push_back(iIdx); 287 indexAxisData_[idxAxis][j] = true; 279 288 } 280 289 } … … 333 342 } 334 343 335 // Outer index344 // Find out outer index 336 345 idxDomain = idxAxis = 0; 337 346 for (int i = 1; i < numElement_; ++i) … … 376 385 } 377 386 378 // Fill in the global index 387 388 // Now allocate these arrays 379 389 this->globalIndex_ = new CArray<size_t,1>(indexSend2ServerCount); 380 390 localDataIndex_ = new CArray<int,1>(indexLocalDataOnClientCount); 381 391 382 eachElementSize = dataNIndex_;383 innerLoopSize = eachElementSize[0];384 ssize = 1; for (int i = 0; i < numElement_; ++i) ssize *= eachElementSize[i];392 // We need to loop with data index 393 innerLoopSize = dataNIndex_[0]; 394 ssize = 1; for (int i = 0; i < numElement_; ++i) ssize *= dataNIndex_[i]; 385 395 idxLoop.assign(numElement_,0); 386 396 idx = indexLocalDataOnClientCount = indexSend2ServerCount = 0; 387 int count = 0 ;397 int count = 0, correctOuterIndexDomain = 0, correctOuterIndexAxis = 0; 388 398 while (idx < ssize) 389 399 { 390 400 for (int i = 0; i < numElement_-1; ++i) 391 401 { 392 if (idxLoop[i] == eachElementSize[i])402 if (idxLoop[i] == dataNIndex_[i]) 393 403 { 394 404 idxLoop[i] = 0; … … 399 409 // Outer index 400 410 idxDomain = idxAxis = 0; 401 bool isIndexDataCorrect = false; 411 bool isIndexDomainDataCorrect = false; 412 bool isIndexAxisDataCorrect = false; 413 402 414 for (int i = 1; i < numElement_; ++i) 403 415 { … … 406 418 if (indexDomainData_[idxDomain][idxLoop[i]]) 407 419 { 408 currentIndex[indexMap_[i]] = localDomainIndex_[idxDomain][idxLoop[i]]; 409 currentIndex[indexMap_[i]+1] = localDomainIndex_[idxDomain*2+1][idxLoop[i]]; 410 isIndexDataCorrect = true; 420 currentIndex[indexMap_[i]] = localDomainIndex_[idxDomain][correctOuterIndexDomain]; 421 currentIndex[indexMap_[i]+1] = localDomainIndex_[idxDomain*2+1][correctOuterIndexDomain]; 422 isIndexDomainDataCorrect = true; 423 ++correctOuterIndexDomain; 411 424 } 412 425 ++idxDomain; … … 414 427 else 415 428 { 416 currentIndex[indexMap_[i]] = localAxisIndex_[idxAxis][idxLoop[i]]; 429 if (indexAxisData_[idxAxis][idxLoop[i]]) 430 { 431 currentIndex[indexMap_[i]] = localAxisIndex_[idxAxis][correctOuterIndexAxis]; 432 isIndexAxisDataCorrect = true; 433 ++correctOuterIndexAxis; 434 } 417 435 ++idxAxis; 418 436 } … … 421 439 // Inner most index 422 440 idxDomain = idxAxis = 0; 423 int correctIndexDomain = 0 ;441 int correctIndexDomain = 0, correctIndexAxis = 0; 424 442 for (int i = 0; i < innerLoopSize; ++i) 425 443 { … … 430 448 currentIndex[0] = localDomainIndex_[idxDomain][correctIndexDomain]; 431 449 currentIndex[1] = localDomainIndex_[idxDomain+1][correctIndexDomain]; 432 isIndexD ataCorrect = true;450 isIndexDomainDataCorrect = true; 433 451 ++correctIndexDomain; 434 } else isIndexDataCorrect = false; 452 } 453 else isIndexDomainDataCorrect = false; 435 454 } 436 455 else 437 456 { 438 currentIndex[0] = localAxisIndex_[idxAxis][i]; 439 } 440 441 if (isIndexDataCorrect && gridMask_(currentIndex[0], currentIndex[1], currentIndex[2])) 457 if (indexAxisData_[idxAxis][i]) 458 { 459 currentIndex[0] = localAxisIndex_[idxAxis][correctIndexAxis]; 460 isIndexAxisDataCorrect = true; 461 ++correctIndexAxis; 462 } 463 else isIndexAxisDataCorrect = false; 464 } 465 466 if (isIndexDomainDataCorrect && 467 isIndexAxisDataCorrect && 468 gridMask_(currentIndex[0], currentIndex[1], currentIndex[2])) 442 469 { 443 470 (*localDataIndex_)(indexLocalDataOnClientCount) = count; … … 446 473 bool isIndexOnServer = true; 447 474 for (int j = 0; j < this->dims_; ++j) 448 isIndexOnServer = isIndexOnServer && ((currentIndex[j]+nBeginGlobal_[j]) <= nZoomEnd_[j]) 449 && (nZoomBegin_[j] <= (currentIndex[j]+nBeginGlobal_[j])); 475 isIndexOnServer = isIndexOnServer && 476 ((currentIndex[j]+nBeginGlobal_[j]) <= nZoomEnd_[j]) && 477 (nZoomBegin_[j] <= (currentIndex[j]+nBeginGlobal_[j])); 450 478 if (isIndexOnServer) 451 479 { 480 size_t globalIndex = currentIndex[0] + nBeginGlobal_[0]; 452 481 size_t mulDim = 1; 453 size_t globalIndex = currentIndex[0] + nBeginGlobal_[0];454 482 for (int k = 1; k < this->dims_; ++k) 455 483 { … … 466 494 idx += innerLoopSize; 467 495 } 468 469 // std::cout << "global index " << *this->globalIndex_ << std::endl;470 // std::cout << "local index " << *localDataIndex_ << std::endl;471 496 } 472 497 … … 511 536 int tempI = dataIndex + dataBegin; 512 537 return ((tempI-1)%ni); 513 // return ((tempI)%ni);514 }515 516 /*!517 Compute global index of each server distributed by band518 The classic distribution of servers: each server takes charges of writing data divided519 into blocks on the second dimension of grid. If the grid contain a domain, this second dimension is nj.520 \param [in] nServer number of server521 \return vector of pointer to array of global index of servers522 */523 std::vector<CArray<size_t,1>* > CDistributionClient::computeServerBandDistribution(int nServer)524 {525 // It's not intelligent to allocate dynamic memory inside one function and dellocate in another526 // but it's a way to free a large amount of unnecessary memory527 // This function must NEVER made into public.528 size_t ssize = 1, idx = 0;529 for (int i = 0; i < nGlob_.size(); ++i) ssize *= nGlob_[i];530 std::vector<int> idxLoop(this->dims_,0);531 std::vector<int> indexServer(nServer,0);532 int njRangeSize;533 std::vector<int> njRangeBegin(nServer,0);534 std::vector<int> njRangeEnd(nServer,0);535 std::vector<CArray<size_t,1>* > globalIndexServer(nServer);536 537 int innerLoopSize = nGlob_[0], idxServer;538 if (1<nGlob_.size())539 {540 for (int i = 0; i < nServer; ++i)541 {542 if (0 < i) njRangeBegin[i] = njRangeEnd[i-1];543 njRangeSize = nGlob_[1] / nServer;544 if (i < nGlob_[1]%nServer) ++njRangeSize;545 njRangeEnd[i] = njRangeSize + njRangeBegin[i];546 }547 njRangeEnd[nServer-1] = nGlob_[1];548 549 // Compute size of each global index server array550 while (idx < ssize)551 {552 for (int i = 0; i < this->dims_-1; ++i)553 {554 if (idxLoop[i] == nGlob_[i])555 {556 idxLoop[i] = 0;557 ++idxLoop[i+1];558 }559 }560 561 for (int i = 0; i < nServer; ++i)562 if ((njRangeBegin[i]<=idxLoop[1]) && (idxLoop[1] < njRangeEnd[i]))563 {564 idxServer = i;565 break;566 }567 568 indexServer[idxServer] += innerLoopSize;569 idxLoop[0] += innerLoopSize;570 idx += innerLoopSize;571 }572 573 574 for (int i = 0; i < nServer; ++i) globalIndexServer[i] = new CArray<size_t,1>(indexServer[i]);575 576 // Fill in each global index server array577 idx = 0;578 idxLoop.assign(this->dims_,0);579 indexServer.assign(nServer,0);580 size_t globalIndex = 0;581 while (idx < ssize)582 {583 for (int i = 0; i < this->dims_-1; ++i)584 {585 if (idxLoop[i] == nGlob_[i])586 {587 idxLoop[i] = 0;588 ++idxLoop[i+1];589 }590 }591 592 for (int i = 0; i < nServer; ++i)593 if ((njRangeBegin[i]<=idxLoop[1]) && (idxLoop[1] < njRangeEnd[i]))594 {595 idxServer = i;596 break;597 }598 599 for (int i = 0; i < innerLoopSize; ++i)600 {601 (*globalIndexServer[idxServer])(indexServer[idxServer]) = globalIndex;602 ++indexServer[idxServer];603 ++globalIndex;604 }605 idxLoop[0] += innerLoopSize;606 idx += innerLoopSize;607 }608 }609 610 return globalIndexServer;611 }612 613 /*!614 Compute index mapping between cliens and servers615 On using global index of data on clients and servers, each client calculates which part616 of data will be sent to the corresponding server. After the functions is called, client can use617 all computed information to send correct data to server618 \param [in] nServer number of server619 \param [in] distributionType type of distribution, like band or plan620 */621 void CDistributionClient::computeServerIndexMapping(int nServer, ServerDistributionType distributionType)622 {623 std::vector<CArray<size_t,1>* > globalIndexServer;624 625 switch (distributionType)626 {627 case BAND_DISTRIBUTION:628 globalIndexServer = computeServerBandDistribution(nServer);629 break;630 default:631 break;632 }633 634 std::vector<CArray<size_t,1>::const_iterator> itBegin(nServer), itEnd(nServer), it(nServer);635 for (int i = 0; i < nServer; ++i)636 {637 itBegin[i] = it[i] = globalIndexServer[i]->begin();638 itEnd[i] = globalIndexServer[i]->end();639 }640 641 size_t ssize = (this->globalIndex_)->numElements();642 for (int i = 0; i < ssize; ++i)643 {644 for (int j = 0; j < nServer; ++j)645 {646 // Just temporarily, it's bad.647 648 if (std::binary_search(itBegin[j], itEnd[j], (*this->globalIndex_)(i)))649 {650 // Just try to calculate local index server on client side651 (indexGlobalOnServer_[j]).push_back((*this->globalIndex_)(i));652 (localIndexSend2Server_[j]).push_back(i);653 continue;654 }655 }656 }657 658 for (int i = 0; i < nServer; ++i)659 if (0 != globalIndexServer[i]) delete globalIndexServer[i];660 }661 662 /*!663 Compute how many clients each server will receive data from664 On client can send data to several servers as well as one server can receive data originated from665 some clients. In order to write data correctly, each server must know from how many clients it receives data666 \param [in] nbServer number of servers667 \param [in] nClient number of clients668 \param [in] clientIntraComm MPI communication of clients669 \return mapping of server rank and the number of connected clients670 */671 std::map<int,int> CDistributionClient::computeConnectedClients(int nbServer, int nbClient, MPI_Comm& clientIntraComm)672 {673 if (isConnectedServerComputed_) return connectedClients_;674 std::map<int, std::vector<size_t> >::const_iterator itbMap, iteMap, it;675 itbMap = it = indexGlobalOnServer_.begin();676 iteMap = indexGlobalOnServer_.end();677 678 std::vector<int> connectedServer;679 std::vector<bool> isConnected(nbServer,false);680 681 for (it = itbMap; it != iteMap; ++it)682 {683 for (int serverNum = 0; serverNum < nbServer; ++serverNum)684 if (it->first == serverNum) isConnected[serverNum] = true;685 }686 687 for(int serverNum = 0; serverNum<nbServer; ++serverNum)688 if (isConnected[serverNum])689 connectedServer.push_back(serverNum);690 691 692 int nbConnectedServer=connectedServer.size();693 int* recvCount=new int[nbClient];694 int* displ=new int[nbClient];695 int* sendBuff=new int[nbConnectedServer];696 valarray<int> clientRes(0,nbServer);697 698 for(int n=0;n<nbConnectedServer;n++) sendBuff[n]=connectedServer[n] ;699 700 // get connected server for everybody701 MPI_Allgather(&nbConnectedServer,1,MPI_INT,recvCount,1,MPI_INT,clientIntraComm) ;702 703 displ[0]=0 ;704 for(int n=1;n<nbClient;n++) displ[n]=displ[n-1]+recvCount[n-1] ;705 int recvSize=displ[nbClient-1]+recvCount[nbClient-1] ;706 int* recvBuff=new int[recvSize] ;707 708 709 MPI_Allgatherv(sendBuff,nbConnectedServer,MPI_INT,recvBuff,recvCount,displ,MPI_INT,clientIntraComm) ;710 for(int n=0;n<recvSize;n++) clientRes[recvBuff[n]]++ ;711 712 // std::map<int,int> nbSenders;713 for(int n=0;n<nbConnectedServer;n++)714 {715 connectedClients_[connectedServer[n]] = clientRes[connectedServer[n]];716 }717 718 isConnectedServerComputed_ = true;719 720 delete [] recvCount ;721 delete [] displ ;722 delete [] sendBuff ;723 delete [] recvBuff ;724 725 return connectedClients_;726 }727 728 /*!729 Return local index of data that is send to server730 \return mapping of server rank and local index of sending data on the client731 */732 const std::map<int, std::vector<int> >& CDistributionClient::getLocalIndexSendToServer() const733 {734 return localIndexSend2Server_;735 538 } 736 539 … … 743 546 } 744 547 745 /*!746 Return global index of data on each connected server.747 On receiving data sent from client(s), each server with this global index, is able to748 know where the data should be written.749 \return mapping of server rank and its global index.750 */751 const std::map<int, std::vector<size_t> >& CDistributionClient::getGlobalIndexOnServer() const752 {753 return indexGlobalOnServer_;754 }755 756 548 } // namespace xios -
XIOS/trunk/src/node/distribution_client.hpp
r552 r553 1 /*! 2 \file distribution_client.hpp 3 \author Ha NGUYEN 4 \since 13 Jan 2015 5 \date 09 Feb 2015 6 7 \brief Index distribution on client side. 8 */ 1 9 #ifndef __XIOS_DISTRIBUTIONCLIENT_HPP__ 2 10 #define __XIOS_DISTRIBUTIONCLIENT_HPP__ … … 15 23 /*! 16 24 \class CDistributionClient 17 This class bases on the knowledge of distribution on client side as well as on server side 18 to calculate the index mapping between client and server. Each client awaring of the existences of other clients 19 and servers, firstly, computes the global index of its local data then use this information on taking into account of 20 distribution of servers to calculate to which server(s) it connects (sends data) 25 This class bases on the knowledge of distribution on client side (decided by users) 26 to calculate the global index of its local data. 21 27 */ 22 28 class CDistributionClient : public CDistribution 23 29 { 24 30 public: 25 enum ServerDistributionType26 {27 BAND_DISTRIBUTION, PLAN_DISTRIBUTION28 };29 30 31 /** Default constructor */ 31 32 CDistributionClient(int rank, int dims, CArray<size_t,1>* globalIndex = 0); 32 33 CDistributionClient(int rank, CGrid* grid); 33 CDistributionClient(const CDistributionClient& distClient); //! Not implement34 34 35 35 /** Default destructor */ 36 36 virtual ~CDistributionClient(); 37 37 38 void computeServerIndexMapping(int nServer, ServerDistributionType distType = BAND_DISTRIBUTION);39 std::map<int,int> computeConnectedClients(int nbServer, int nbClient, MPI_Comm& clientIntraComm);40 41 38 const CArray<int,1>& getLocalDataIndexOnClient() const; 42 const std::map<int, std::vector<size_t> >& getGlobalIndexOnServer() const; 43 const std::map<int, std::vector<int> >& getLocalIndexSendToServer() const; 39 std::vector<int> getNGlob() { return nGlob_; } 44 40 45 41 protected: … … 51 47 const CArray<bool,3>& gridMask); 52 48 49 private: 50 //! Create local index of a domain 51 void createLocalDomainDataIndex(); 52 53 //! Create local index of an axis 54 void createLocalAxisDataIndex(); 55 53 56 inline int getDomainIndex(const int& dataIIndex, const int& dataJIndex, 54 57 const int& dataIBegin, const int& dataJBegin, … … 57 60 58 61 private: 59 //! Create local index of a domain60 void createLocalDomainDataIndex();61 //! Create local index of an axis62 void createLocalAxisDataIndex();63 64 //! Compute band distribution on server65 std::vector<CArray<size_t,1>* > computeServerBandDistribution(int nServer);66 private:67 62 //!< LocalData index on client 68 63 CArray<int,1>* localDataIndex_; 69 64 70 //! Index of the local data which will be sent to the corresponding server(s)71 std::map<int, std::vector<int> > localIndexSend2Server_;72 73 //! Global index of data on SERVER, which are calculated by client(s)74 std::map<int, std::vector<size_t> > indexGlobalOnServer_;75 65 private: 76 66 /*! Domains and axis are considered elements. 77 67 * A grid composed of 1 domain and 1 axis has 2 elements */ 78 68 int numElement_; 79 CArray<bool,1> axisDomainOrder_; //!< 69 CArray<bool,1> axisDomainOrder_; //!< Order of axis and domain of a grid 80 70 81 71 std::vector<int> nLocal_; //!< Local size of each dimension (ni, nj, etc, ...) … … 102 92 std::vector<int> indexMap_; //!< Mapping element index to dimension index 103 93 104 std::map<int, int> connectedClients_; //!< number of clients connected to a server 105 bool isConnectedServerComputed_; //!< Guard flag 94 // The correct index of a domain has true value, the ghost one has false value 95 std::vector<std::vector<bool> > indexDomainData_; 96 std::vector<std::vector<bool> > indexAxisData_; 106 97 107 // The real index of a domain has true value, the ghost one has false value108 std::vector<std::vector<bool> > indexDomainData_;98 private: 99 CDistributionClient(const CDistributionClient& distClient); //! Not implement 109 100 }; 110 101 -
XIOS/trunk/src/node/distribution_server.cpp
r552 r553 1 /*! 2 \file distribution_server.cpp 3 \author Ha NGUYEN 4 \since 13 Jan 2015 5 \date 04 Feb 2015 6 7 \brief Index distribution on server side. 8 */ 1 9 #include "distribution_server.hpp" 2 10 3 11 namespace xios { 12 4 13 CDistributionServer::CDistributionServer(int rank, int dims, CArray<size_t,1>* globalIndex) 5 14 : CDistribution(rank, dims, globalIndex), nGlobal_(), nZoomSize_(), nZoomBegin_() -
XIOS/trunk/src/node/distribution_server.hpp
r552 r553 1 /*! 2 \file distribution_server.hpp 3 \author Ha NGUYEN 4 \since 13 Jan 2015 5 \date 04 Feb 2015 6 7 \brief Index distribution on server side. 8 */ 9 1 10 #ifndef __XIOS_DISTRIBUTION_SERVER_HPP__ 2 11 #define __XIOS_DISTRIBUTION_SERVER_HPP__ … … 5 14 6 15 namespace xios { 16 7 17 /*! 8 \class CDistributionServer9 The class, for now, plays a role of computing local index for writing data on server18 \class CDistributionServer 19 The class, for now, plays a role of computing local index for writing data on server 10 20 */ 11 21 class CDistributionServer : public CDistribution -
XIOS/trunk/src/node/domain.cpp
r551 r553 14 14 #include "context_client.hpp" 15 15 #include "array_new.hpp" 16 #include "server_distribution_description.hpp" 16 17 17 18 namespace xios { … … 21 22 CDomain::CDomain(void) 22 23 : CObjectTemplate<CDomain>(), CDomainAttributes() 23 , isChecked(false), relFiles(), isClientChecked(false) 24 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_() 24 25 { /* Ne rien faire de plus */ } 25 26 26 27 CDomain::CDomain(const StdString & id) 27 28 : CObjectTemplate<CDomain>(id), CDomainAttributes() 28 , isChecked(false), relFiles(), isClientChecked(false) 29 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_() 29 30 { /* Ne rien faire de plus */ } 30 31 … … 612 613 void CDomain::sendServerAttribut(void) 613 614 { 615 std::vector<int> nGlobDomain(2); 616 nGlobDomain[0] = ni_glo.getValue(); 617 nGlobDomain[1] = nj_glo.getValue(); 618 CServerDistributionDescription serverDescription(nGlobDomain); 619 614 620 int ni_srv=ni_glo.getValue() ; 615 621 int ibegin_srv=0 ; … … 625 631 int serverRank=client->getServerLeader() ; 626 632 627 // jend_srv=0;628 jend_srv= -1;629 for(int i=0;i<=serverRank;i++)630 {631 jbegin_srv=jend_srv+1;632 nj_srv=nj_glo.getValue()/nbServer;633 if (i<nj_glo.getValue()%nbServer) nj_srv++;634 jend_srv=jbegin_srv+nj_srv-1;635 }633 serverDescription.computeServerDistribution(nbServer); 634 std::vector<std::vector<int> > serverIndexBegin = serverDescription.getServerIndexBegin(); 635 std::vector<std::vector<int> > serverDimensionSizes = serverDescription.getServerDimensionSizes(); 636 ibegin_srv = (serverIndexBegin[serverRank])[0]; 637 jbegin_srv = serverIndexBegin[serverRank][1]; 638 ni_srv = serverDimensionSizes[serverRank][0]; 639 nj_srv = serverDimensionSizes[serverRank][1]; 640 iend_srv = ibegin_srv+ni_srv-1; 641 jend_srv = jbegin_srv+nj_srv-1; 636 642 637 643 CEventClient event(getType(),EVENT_ID_SERVER_ATTRIBUT) ; … … 649 655 void CDomain::computeConnectedServer(void) 650 656 { 651 int i,j,i_ind,j_ind ;652 653 657 ibegin_client=ibegin ; iend_client=iend ; ni_client=ni ; 654 658 jbegin_client=jbegin ; jend_client=jend ; nj_client=nj ; 655 659 656 CContext* context =CContext::getCurrent() ;660 CContext* context=CContext::getCurrent() ; 657 661 CContextClient* client=context->client ; 658 int nbServer=client->serverSize ; 659 660 // find how much client are connected to a server 662 int nbServer=client->serverSize; 663 bool doComputeGlobalIndexServer = true; 664 665 int i,j,i_ind,j_ind ; 661 666 int zoom_iend=zoom_ibegin+zoom_ni-1 ; 662 667 int zoom_jend=zoom_jbegin+zoom_nj-1 ; 663 668 664 int blockSize=nj_glo/nbServer ; 665 int ns=nj_glo%nbServer ; 666 int pos=ns*(blockSize+1) ; 667 // int pos=ns*(blockSize) ; 668 int serverNum ; 669 670 mapConnectedServer.resize(ni,nj) ; 671 vector<int> nbData(nbServer,0) ; 672 vector<int> indServer(nbServer,-1) ; 673 vector<bool> IsConnected(nbServer,false) ; 674 669 std::vector<int> nGlobDomain(2); 670 nGlobDomain[0] = ni_glo.getValue(); 671 nGlobDomain[1] = nj_glo.getValue(); 672 CServerDistributionDescription serverDescription(nGlobDomain); 673 serverDescription.computeServerDistribution(nbServer, doComputeGlobalIndexServer); 674 675 // Precompute number of index 676 int globalIndexCount = 0; 675 677 for(j=0;j<nj;j++) 676 678 for(i=0;i<ni;i++) … … 679 681 j_ind=jbegin+j_index(i,j) ; 680 682 681 if (j_ind<pos) serverNum=j_ind/(blockSize+1) ;682 else serverNum=ns+(j_ind-pos)/blockSize ;683 IsConnected[serverNum]=true ;684 685 683 if (i_ind >= zoom_ibegin && i_ind <= zoom_iend && j_ind >= zoom_jbegin && j_ind <= zoom_jend) 686 684 { 687 mapConnectedServer(i,j)=serverNum ; 688 nbData[serverNum]++ ; 685 ++globalIndexCount; 689 686 } 690 else mapConnectedServer(i,j)=-1 ; 691 } 692 693 694 for(serverNum=0 ; serverNum<nbServer ; serverNum++) 695 if (IsConnected[serverNum]) 696 { 697 ns=connectedServer.size() ; 698 indServer[serverNum]=ns; 699 connectedServer.push_back(serverNum) ; 700 nbDataSrv.push_back(nbData[serverNum]) ; 701 } 702 703 i_indSrv.resize(connectedServer.size()) ; 704 j_indSrv.resize(connectedServer.size()) ; 705 706 for(j=0;j<nj;j++) 687 } 688 689 // Fill in index 690 CArray<size_t,1> globalIndexDomain(globalIndexCount); 691 size_t globalIndex; 692 globalIndexCount = 0; 693 694 for(j=0;j<nj;j++) 707 695 for(i=0;i<ni;i++) 708 696 { 709 if (mapConnectedServer(i,j)>=0) 697 i_ind=ibegin+i_index(i,j) ; 698 j_ind=jbegin+j_index(i,j) ; 699 700 if (i_ind >= zoom_ibegin && i_ind <= zoom_iend && j_ind >= zoom_jbegin && j_ind <= zoom_jend) 710 701 { 711 ns=indServer[mapConnectedServer(i,j)] ; 712 mapConnectedServer(i,j)= ns ; 713 i_indSrv[ns].push_back(i+ibegin) ; 714 j_indSrv[ns].push_back(j+jbegin) ; 702 globalIndex = i_ind + j_ind * ni_glo; 703 globalIndexDomain(globalIndexCount) = globalIndex; 704 ++globalIndexCount; 715 705 } 716 706 } 717 707 718 int nbConnectedServer=connectedServer.size() ; 719 720 int* recvCount=new int[client->clientSize] ; 721 int* displ=new int[client->clientSize] ; 722 int* sendBuff=new int[nbConnectedServer] ; 723 valarray<int> nbClient(0,client->serverSize) ; 724 725 for(int n=0;n<nbConnectedServer;n++) sendBuff[n]=connectedServer[n] ; 726 727 // get connected server for everybody 728 MPI_Allgather(&nbConnectedServer,1,MPI_INT,recvCount,1,MPI_INT,client->intraComm) ; 729 730 displ[0]=0 ; 731 for(int n=1;n<client->clientSize;n++) displ[n]=displ[n-1]+recvCount[n-1] ; 732 int recvSize=displ[client->clientSize-1]+recvCount[client->clientSize-1] ; 733 int* recvBuff=new int[recvSize] ; 734 735 736 MPI_Allgatherv(sendBuff,nbConnectedServer,MPI_INT,recvBuff,recvCount,displ,MPI_INT,client->intraComm) ; 737 for(int n=0;n<recvSize;n++) nbClient[recvBuff[n]]++ ; 738 739 for(int n=0;n<nbConnectedServer;n++) nbSenders.push_back(nbClient[connectedServer[n]]) ; 740 741 delete [] recvCount ; 742 delete [] displ ; 743 delete [] sendBuff ; 744 delete [] recvBuff ; 708 CClientServerMapping clientServerMap; 709 clientServerMap.computeServerIndexMapping(globalIndexDomain, serverDescription.getGlobalIndex()); 710 const std::map<int, std::vector<size_t> >& globalIndexDomainOnServer = clientServerMap.getGlobalIndexOnServer(); 711 std::vector<int> connectedServerRank; 712 for (std::map<int, std::vector<size_t> >::const_iterator it = globalIndexDomainOnServer.begin(); it != globalIndexDomainOnServer.end(); ++it) { 713 connectedServerRank.push_back(it->first); 714 } 715 nbConnectedClients_ = clientServerMap.computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank); 716 indSrv_ = globalIndexDomainOnServer; 745 717 } 746 747 748 // void CDomain::sendLonLat(void)749 // {750 // int ns,n,i,j,ind,nv ;751 // CContext* context = CContext::getCurrent() ;752 // CContextClient* client=context->client ;753 // // send lon lat for each connected server754 //755 // CEventClient eventLon(getType(),EVENT_ID_LON) ;756 // CEventClient eventLat(getType(),EVENT_ID_LAT) ;757 //758 // list<shared_ptr<CMessage> > list_msgLon ;759 // list<shared_ptr<CMessage> > list_msgLat ;760 // list< CArray<int,1>* > list_indi,list_indj ;761 // list< CArray<double,1>* >list_lon,list_lat ;762 // list< CArray<double,2>* >list_boundslon,list_boundslat ;763 //764 // for(int ns=0;ns<connectedServer.size();ns++)765 // {766 // int nbData = nbDataSrv[ns] ;767 // CArray<int,1> indi(nbData) ;768 // CArray<int,1> indj(nbData) ;769 // CArray<double,1> lon(nbData) ;770 // CArray<double,1> lat(nbData) ;771 // CArray<double,2> boundslon(nvertex,nbData) ;772 // CArray<double,2> boundslat(nvertex,nbData) ;773 //774 // for(n=0;n<nbData;n++)775 // {776 // i=i_indSrv[ns][n] ;777 // j=j_indSrv[ns][n] ;778 // ind=(i-(zoom_ibegin_client-1))+(j-(zoom_jbegin_client-1))*zoom_ni_client ;779 //780 // lon(n)=lonvalue(ind) ;781 // lat(n)=latvalue(ind) ;782 // if (hasBounds)783 // {784 // for(nv=0;nv<nvertex;nv++)785 // {786 // boundslon(nv,n)=bounds_lon(nv,ind);787 // boundslat(nv,n)=bounds_lat(nv,ind);788 // }789 // }790 // indi(n)=ibegin+i_index(i-ibegin+1,j-jbegin+1)-1 ;791 // indj(n)=jbegin+j_index(i-ibegin+1,j-jbegin+1)-1 ;792 // }793 //794 // list_indi.push_back(new CArray<int,1>(indi.copy())) ;795 // list_indj.push_back(new CArray<int,1>(indj.copy())) ;796 // list_lon.push_back(new CArray<double,1>(lon.copy())) ;797 // list_lat.push_back(new CArray<double,1>(lat.copy())) ;798 // if (hasBounds) list_boundslon.push_back(new CArray<double,2>(boundslon.copy())) ;799 // if (hasBounds) list_boundslat.push_back(new CArray<double,2>(boundslat.copy())) ;800 //801 // list_msgLon.push_back(shared_ptr<CMessage>(new CMessage)) ;802 // list_msgLat.push_back(shared_ptr<CMessage>(new CMessage)) ;803 //804 // *list_msgLon.back()<<this->getId()<<(int)type ; // enum ne fonctionne pour les message => ToFix805 // *list_msgLat.back()<<this->getId()<<(int)type ;806 // *list_msgLon.back()<<isCurvilinear ;807 // *list_msgLat.back()<<isCurvilinear ;808 // *list_msgLon.back()<<*list_indi.back()<<*list_indj.back()<<*list_lon.back() ;809 // *list_msgLat.back()<<*list_indi.back()<<*list_indj.back()<<*list_lat.back() ;810 //811 // if (hasBounds)812 // {813 // *list_msgLon.back()<<*list_boundslon.back();814 // *list_msgLat.back()<<*list_boundslat.back();815 // }816 // eventLon.push(connectedServer[ns],nbSenders[ns],*list_msgLon.back()) ;817 // eventLat.push(connectedServer[ns],nbSenders[ns],*list_msgLat.back()) ;818 // }819 //820 // client->sendEvent(eventLon) ;821 // client->sendEvent(eventLat) ;822 //823 //824 // for(list<CArray<int,1>* >::iterator it=list_indi.begin();it!=list_indi.end();it++) delete *it;825 // for(list<CArray<int,1>* >::iterator it=list_indj.begin();it!=list_indj.end();it++) delete *it;826 // for(list<CArray<double,1>* >::iterator it=list_lon.begin();it!=list_lon.end();it++) delete *it;827 // for(list<CArray<double,1>* >::iterator it=list_lat.begin();it!=list_lat.end();it++) delete *it;828 // if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslon.begin();it!=list_boundslon.end();it++) delete *it;829 // if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslat.begin();it!=list_boundslat.end();it++) delete *it;830 //831 // }832 718 833 719 void CDomain::sendLonLat(void) 834 720 { 835 int ns,n,i,j,ind,nv 721 int ns,n,i,j,ind,nv, idx; 836 722 CContext* context = CContext::getCurrent() ; 837 723 CContextClient* client=context->client ; … … 847 733 list< CArray<double,2>* >list_boundslon,list_boundslat ; 848 734 849 for(int ns=0;ns<connectedServer.size();ns++) 735 std::map<int, std::vector<size_t> >::const_iterator it, itbMap, iteMap; 736 itbMap = indSrv_.begin(); 737 iteMap = indSrv_.end(); 738 for (it = itbMap; it != iteMap; ++it) 850 739 { 851 int nbData = nbDataSrv[ns] ; 740 int rank = it->first; 741 int nbData = (it->second).size(); 852 742 CArray<int,1> indi(nbData) ; 853 743 CArray<int,1> indj(nbData) ; 854 744 CArray<double,1> lon(nbData) ; 855 745 CArray<double,1> lat(nbData) ; 856 CArray<double,2> boundslon(nvertex,nbData) 857 CArray<double,2> boundslat(nvertex,nbData) 858 859 for (n=0;n<nbData;n++)860 { 861 i =i_indSrv[ns][n];862 j=j_indSrv[ns][n];863 // ind=(i-(zoom_ibegin_client))+(j-(zoom_jbegin_client-1))*zoom_ni_client;746 CArray<double,2> boundslon(nvertex,nbData); 747 CArray<double,2> boundslat(nvertex,nbData); 748 749 for (n = 0; n < nbData; ++n) 750 { 751 idx = static_cast<int>((it->second)[n]); 752 i = idx%ni_glo; 753 j = idx/ni_glo; 864 754 ind=(i-(zoom_ibegin_client))+(j-(zoom_jbegin_client))*zoom_ni_client ; 865 755 … … 876 766 indi(n)=ibegin+i_index(i-ibegin,j-jbegin) ; 877 767 indj(n)=jbegin+j_index(i-ibegin,j-jbegin) ; 878 // indi(n)=ibegin+i_index(i-ibegin+1,j-jbegin+1)-1 ;879 // indj(n)=jbegin+j_index(i-ibegin+1,j-jbegin+1)-1 ;880 768 } 881 769 … … 902 790 *list_msgLat.back()<<*list_boundslat.back(); 903 791 } 904 eventLon.push( connectedServer[ns],nbSenders[ns],*list_msgLon.back()) ;905 eventLat.push( connectedServer[ns],nbSenders[ns],*list_msgLat.back()) ;792 eventLon.push(rank,nbConnectedClients_[rank],*list_msgLon.back()) ; 793 eventLat.push(rank,nbConnectedClients_[rank],*list_msgLat.back()) ; 906 794 } 907 795 … … 916 804 if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslon.begin();it!=list_boundslon.end();it++) delete *it; 917 805 if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslat.begin();it!=list_boundslat.end();it++) delete *it; 918 919 806 } 920 807 … … 1052 939 if (hasBounds) buffer>>boundslat ; 1053 940 type.setValue((type_attr::t_enum)type_int) ; // probleme des type enum avec les buffers : ToFix 1054 1055 941 int i,j,ind_srv ; 1056 942 for(int ind=0;ind<indi.numElements();ind++) … … 1068 954 } 1069 955 } 1070 // void CDomain::recvLonLat(CEventServer& event) 1071 // { 1072 // list<CEventServer::SSubEvent>::iterator it ; 1073 // for (it=event.subEvents.begin();it!=event.subEvents.end();++it) 1074 // { 1075 // CBufferIn* buffer=it->buffer; 1076 // string domainId ; 1077 // *buffer>>domainId ; 1078 // get(domainId)->recvLonLat(*buffer) ; 1079 // } 1080 // } 1081 // 1082 // void CDomain::recvLonLat(CBufferIn& buffer) 1083 // { 1084 // CArray<int,1> indi ; 1085 // CArray<int,1> indj ; 1086 // CArray<double,1> lon ; 1087 // CArray<double,1> lat ; 1088 // CArray<double,2> boundslon ; 1089 // CArray<double,2> boundslat ; 1090 // 1091 // int type_int ; 1092 // buffer>>type_int>>isCurvilinear>>indi>>indj>>lon>>lat ; 1093 // if (hasBounds) buffer>>boundslon>>boundslat ; 1094 // type.setValue((type_attr::t_enum)type_int) ; // probleme des type enum avec les buffers : ToFix 1095 // 1096 // int i,j,ind_srv ; 1097 // for(int ind=0;ind<indi.numElements();ind++) 1098 // { 1099 // i=indi(ind) ; j=indj(ind) ; 1100 // ind_srv=(i-(zoom_ibegin_srv-1))+(j-(zoom_jbegin_srv-1))*zoom_ni_srv ; 1101 // lonvalue_srv(ind_srv)=lon(ind) ; 1102 // latvalue_srv(ind_srv)=lat(ind) ; 1103 // if (hasBounds) 1104 // { 1105 // for(int nv=0;nv<nvertex;nv++) 1106 // { 1107 // bounds_lon_srv(nv,ind_srv)=boundslon(nv,ind) ; 1108 // bounds_lat_srv(nv,ind_srv)=boundslat(nv,ind) ; 1109 // } 1110 // } 1111 // } 1112 // } 956 1113 957 //---------------------------------------------------------------- 1114 958 -
XIOS/trunk/src/node/domain.hpp
r551 r553 113 113 vector< vector<int> > j_indSrv ; // for each server, j global index to send 114 114 115 115 116 CArray<int,2> mapConnectedServer ; // (ni,nj) => mapped to connected server number, -1 if no server is target 117 116 118 117 119 // vector<int> ib_srv, ie_srv, in_srv ; … … 152 154 std::set<StdString> relFiles; 153 155 bool isClientChecked; // Verify whether all attributes of domain on the client side are good 156 std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server 157 std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server 154 158 155 159 DECLARE_REF_FUNC(Domain,domain) -
XIOS/trunk/src/node/grid.cpp
r552 r553 23 23 , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1), isDomConServerComputed_(false) 24 24 , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 25 , serverDistribution_(0) 25 , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_() 26 26 { 27 27 setVirtualDomainGroup(); … … 34 34 , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1), isDomConServerComputed_(false) 35 35 , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 36 , serverDistribution_(0) 36 , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_() 37 37 { 38 38 setVirtualDomainGroup(); … … 59 59 if (0 != clientDistribution_) delete clientDistribution_; 60 60 if (0 != serverDistribution_) delete serverDistribution_; 61 if (0 != serverDistributionDescription_) delete serverDistributionDescription_; 61 62 62 63 } … … 187 188 StdSize retVal; 188 189 std::map<int, StdSize> ret; 189 const std::map<int, std::vector<int> >& distribution = client Distribution_->getLocalIndexSendToServer();190 const std::map<int, std::vector<int> >& distribution = clientServerMap_.getLocalIndexSendToServer(); 190 191 std::map<int, std::vector<int> >::const_iterator it = distribution.begin(), itE = distribution.end(); 191 192 for (; it != itE; ++it) … … 405 406 CContext* context = CContext::getCurrent() ; 406 407 CContextClient* client=context->client ; 408 409 // First of all, compute distribution on client side 407 410 clientDistribution_ = new CDistributionClient(client->clientRank, this); 408 clientDistribution_->computeServerIndexMapping(client->serverSize); 409 nbSenders = clientDistribution_->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm); 410 411 412 // Then compute distribution on server side 413 serverDistributionDescription_ = new CServerDistributionDescription(clientDistribution_->getNGlob()); 414 serverDistributionDescription_->computeServerDistribution(client->serverSize, true); 415 416 // Finally, compute index mapping between client(s) and server(s) 417 clientServerMap_.computeServerIndexMapping(clientDistribution_->getGlobalIndex(),serverDistributionDescription_->getGlobalIndex()); 418 const std::map<int, std::vector<size_t> >& globalIndexOnServer = clientServerMap_.getGlobalIndexOnServer(); 419 std::vector<int> connectedServerRank; 420 for (std::map<int, std::vector<size_t> >::const_iterator it = globalIndexOnServer.begin(); it != globalIndexOnServer.end(); ++it) { 421 connectedServerRank.push_back(it->first); 422 } 423 nbSenders = clientServerMap_.computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank); 424 425 // Get local data index on client 411 426 storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().numElements()); 412 427 storeIndex_client = (clientDistribution_->getLocalDataIndexOnClient()); … … 715 730 list<shared_ptr<CMessage> > list_msg ; 716 731 list< CArray<size_t,1>* > listOutIndex; 717 718 const std::map<int, std::vector<size_t> >& globalIndexOnServer = clientDistribution_->getGlobalIndexOnServer(); 719 const std::map<int, std::vector<int> >& localIndexSendToServer = clientDistribution_->getLocalIndexSendToServer(); 732 const std::map<int, std::vector<size_t> >& globalIndexOnServer = clientServerMap_.getGlobalIndexOnServer(); 733 const std::map<int, std::vector<int> >& localIndexSendToServer = clientServerMap_.getLocalIndexSendToServer(); 720 734 721 735 std::map<int, std::vector<size_t> >::const_iterator iteMap, itbMap, itGlobal; … … 724 738 iteMap = globalIndexOnServer.end(); 725 739 itLocal = localIndexSendToServer.begin(); 726 727 740 728 741 for (int ns = 0; itGlobal != iteMap; ++itGlobal, ++itLocal, ++ns) -
XIOS/trunk/src/node/grid.hpp
r552 r553 13 13 #include "distribution_client.hpp" 14 14 #include "distribution_server.hpp" 15 #include "server_distribution_description.hpp" 16 #include "client_server_mapping.hpp" 15 17 16 18 namespace xios { … … 25 27 class CDistributionClient; 26 28 class CDistributionServer; 29 class CServerDistributionDescription; 30 class CClientServerMapping; 27 31 28 32 ///-------------------------------------------------------------- … … 220 224 CDistributionClient* clientDistribution_; 221 225 CDistributionServer* serverDistribution_; 226 CServerDistributionDescription* serverDistributionDescription_; 227 CClientServerMapping clientServerMap_; 222 228 }; // class CGrid 223 229 -
XIOS/trunk/src/test/test_new_features.f90
- Property svn:executable set to *
r551 r553 13 13 TYPE(xios_duration) :: dtime 14 14 TYPE(xios_context) :: ctx_hdl 15 INTEGER,PARAMETER :: ni_glo= 10016 INTEGER,PARAMETER :: nj_glo= 10015 INTEGER,PARAMETER :: ni_glo=5 16 INTEGER,PARAMETER :: nj_glo=5 17 17 INTEGER,PARAMETER :: llm=5 18 18 DOUBLE PRECISION :: lval(llm)=1 … … 70 70 ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni*nj)) 71 71 ! ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm,llm),lonvalue(ni*nj)) 72 lon(:,:)=lon_glo(ibegin :iend,jbegin:jend)73 lat(:,:)=lat_glo(ibegin :iend,jbegin:jend)72 lon(:,:)=lon_glo(ibegin+1:iend+1,jbegin+1:jend+1) 73 lat(:,:)=lat_glo(ibegin+1:iend+1,jbegin+1:jend+1) 74 74 field_A(1:ni,1:nj,:)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,:) 75 75
Note: See TracChangeset
for help on using the changeset viewer.