- Timestamp:
- 09/11/17 17:02:48 (7 years ago)
- Location:
- XIOS/dev/XIOS_DEV_CMIP6/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.cpp
r1249 r1258 453 453 if (context->hasClient) 454 454 { 455 if ( (orderPositionInGrid == CServerDistributionDescription::defaultDistributedDimension(globalDim.size(), distType))456 || (index.numElements() != n_glo))457 computeConnectedClients(globalDim, orderPositionInGrid, distType);455 if (orderPositionInGrid == CServerDistributionDescription::defaultDistributedDimension(globalDim.size(), distType)) 456 computeConnectedClients(globalDim, orderPositionInGrid, distType); 457 else if (index.numElements() != n_glo) computeConnectedClients(globalDim, orderPositionInGrid, CServerDistributionDescription::ROOT_DISTRIBUTION); 458 458 } 459 459 … … 589 589 590 590 // Describe the distribution of server side 591 CServerDistributionDescription serverDescription(nGlobAxis, nbServer); 591 592 CServerDistributionDescription serverDescription(nGlobAxis, nbServer, distType); 593 592 594 std::vector<int> serverZeroIndex; 593 595 serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd), 0); … … 606 608 607 609 indSrv_[client].swap(globalIndexAxisOnServer); 610 611 if (distType==CServerDistributionDescription::ROOT_DISTRIBUTION) 612 { 613 for(int i=1; i<nbServer; ++i) indSrv_[client].insert(pair<int, vector<size_t> >(i,indSrv_[client][0]) ) ; 614 serverZeroIndexLeader.clear() ; 615 } 616 608 617 CClientServerMapping::GlobalIndexMap::const_iterator it = indSrv_[client].begin(), 609 618 ite = indSrv_[client].end(); 610 611 for (it = indSrv_[client].begin(); it != ite; ++it) { 612 connectedServerRank_[client].push_back(it->first); 613 } 619 620 for (it = indSrv_[client].begin(); it != ite; ++it) connectedServerRank_[client].push_back(it->first); 614 621 615 622 for (std::list<int>::const_iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) -
XIOS/dev/XIOS_DEV_CMIP6/src/server_distribution_description.cpp
r1235 r1258 117 117 { 118 118 int nBand = 0; 119 switch (serverType_) { 119 switch (serverType_) 120 { 120 121 case BAND_DISTRIBUTION: 121 122 nBand = computeBandDistribution(nServer_, positionDimensionDistributed); 122 123 break; 124 case ROOT_DISTRIBUTION: 125 nBand = computeRootDistribution(nServer_); 123 126 default: 124 127 break; … … 397 400 } 398 401 402 403 /*! 404 Compute global index of servers with root distribution : only root server will received data 405 \param [in] nServer number of server 406 */ 407 int CServerDistributionDescription::computeRootDistribution(int nServer, int positionDimensionDistributed) 408 { 409 int dim = nGlobal_.size(); 410 positionDimensionDistributed_ = positionDimensionDistributed; 411 if (1 == dim) positionDimensionDistributed_ = 0; 412 if (positionDimensionDistributed_ > dim) 413 ERROR("CServerDistributionDescription::computeBandDistribution(int nServer, int positionDimensionDistributed)", 414 << "Position of distributed dimension is invalid" << std::endl 415 << "Position of distributed dimension is " << positionDimensionDistributed_ 416 << "Dimension " << dim) 417 418 indexBegin_.resize(nServer); 419 dimensionSizes_.resize(nServer); 420 421 for (int i = 0; i< nServer; ++i) 422 { 423 indexBegin_[i].resize(dim); 424 dimensionSizes_[i].resize(dim); 425 } 426 427 int nGlobTemp = 0; 428 429 int positionDistributed = (1<dim) ? positionDimensionDistributed_ : 0; 430 nGlobTemp = nGlobal_[positionDistributed]; 431 int nbBand = 1 ; 432 433 434 for (int i = 0; i < nServer; ++i) 435 { 436 for (int j = 0; j < dim; ++j) 437 { 438 if (positionDistributed != j) // bad coding, need to be rewrite 439 { 440 if (1 == dim) 441 { 442 if (i==0) 443 { 444 indexBegin_[i][j] = 0; 445 dimensionSizes_[i][j] = nGlobTemp; 446 } 447 else 448 { 449 indexBegin_[i][j] = nGlobTemp-1; 450 dimensionSizes_[i][j] = 0; 451 } 452 } 453 else 454 { 455 indexBegin_[i][j] = 0; 456 dimensionSizes_[i][j] = nGlobal_[j]; 457 } 458 } 459 else 460 { 461 if (i==0) 462 { 463 indexBegin_[i][j] = 0; 464 dimensionSizes_[i][j] = nGlobTemp; 465 } 466 else 467 { 468 indexBegin_[i][j] = nGlobTemp-1; 469 dimensionSizes_[i][j] = 0; 470 } 471 } 472 } 473 } 474 475 return nbBand; 476 } 477 478 479 480 399 481 /*! 400 482 Get size of each dimension on distributed server -
XIOS/dev/XIOS_DEV_CMIP6/src/server_distribution_description.hpp
r1235 r1258 26 26 enum ServerDistributionType 27 27 { 28 BAND_DISTRIBUTION, PLAN_DISTRIBUTION 28 BAND_DISTRIBUTION, PLAN_DISTRIBUTION, ROOT_DISTRIBUTION 29 29 }; 30 30 … … 56 56 protected: 57 57 int computeBandDistribution(int nServer, int positionDimensionDistributed = 1); 58 int computeRootDistribution(int nServer, int positionDimensionDistributed = 1); 58 59 void computePlanDistribution(int nServer); 59 60 void computeRangeProcIndex(int clientRank,
Note: See TracChangeset
for help on using the changeset viewer.