- Timestamp:
- 01/23/19 10:31:44 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/transformation/grid_transformation.cpp
r1545 r1642 38 38 */ 39 39 void CGridTransformation::selectScalarAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 40 TRY 40 41 { 41 42 std::vector<CScalar*> scaListDestP = gridDestination_->getScalars(); … … 59 60 algoTransformation_.push_back(algo); 60 61 } 62 CATCH 61 63 62 64 /*! … … 67 69 */ 68 70 void CGridTransformation::selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 71 TRY 69 72 { 70 73 std::vector<CAxis*> axisListDestP = gridDestination_->getAxis(); … … 88 91 algoTransformation_.push_back(algo); 89 92 } 93 CATCH 90 94 91 95 /*! … … 96 100 */ 97 101 void CGridTransformation::selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 102 TRY 98 103 { 99 104 std::vector<CDomain*> domainListDestP = gridDestination_->getDomains(); … … 117 122 algoTransformation_.push_back(algo); 118 123 } 124 CATCH 119 125 120 126 /*! … … 123 129 */ 124 130 std::map<int,std::pair<int,int> > CGridTransformation::getElementPosition(CGrid* grid) 131 TRY 125 132 { 126 133 std::vector<CScalar*> scalarListP = grid->getScalars(); … … 155 162 return elementPosition; 156 163 } 164 CATCH 157 165 158 166 /*! … … 163 171 */ 164 172 void CGridTransformation::setUpGridDestination(int elementPositionInGrid, ETranformationType transType) 173 TRY 165 174 { 166 175 if (isSpecialTransformation(transType)) return; … … 240 249 tempGridDests_.push_back(tmpGridDestination_); 241 250 } 251 CATCH 242 252 243 253 /*! … … 249 259 */ 250 260 void CGridTransformation::setUpGridSource(int elementPositionInGrid) 261 TRY 251 262 { 252 263 if (!tempGridSrcs_.empty() && (getNbAlgo()-1) == tempGridSrcs_.size()) … … 326 337 tempGridSrcs_.push_back(gridSource_); 327 338 } 339 CATCH 328 340 329 341 /*! … … 336 348 */ 337 349 void CGridTransformation::computeAll(const std::vector<CArray<double,1>* >& dataAuxInputs, Time timeStamp) 350 TRY 338 351 { 339 352 if (nbNormalAlgos_ < 1) return; … … 346 359 std::list<RecvIndexGridDestinationMap>().swap(localIndexToReceiveOnGridDest_); 347 360 std::list<size_t>().swap(nbLocalIndexOnGridDest_); 348 std::list<std::vector<bool> >().swap(localMaskOnGridDest_);349 361 } 350 362 else … … 399 411 vector<int> localDst ; 400 412 vector<double> weight ; 401 localMaskOnGridDest_.push_back(vector<bool>());413 int nbLocalIndexOnGridDest; 402 414 CTimer::get("computeTransformationMappingNonDistributed").resume(); 403 415 algo->computeTransformationMappingNonDistributed(elementPosition, gridSource_, tmpGridDestination_, 404 localSrc, localDst, weight, localMaskOnGridDest_.back()) ;416 localSrc, localDst, weight, nbLocalIndexOnGridDest) ; 405 417 CTimer::get("computeTransformationMappingNonDistributed").suspend(); 406 418 407 419 CTimer::get("computeTransformationMappingConvert").resume(); 408 nbLocalIndexOnGridDest_.push_back( localMaskOnGridDest_.back().size()) ;420 nbLocalIndexOnGridDest_.push_back(nbLocalIndexOnGridDest) ; 409 421 int clientRank=client->clientRank ; 410 422 { … … 453 465 } 454 466 } 467 CATCH 455 468 456 469 /*! … … 459 472 */ 460 473 void CGridTransformation::computeTransformationMapping(const SourceDestinationIndexMap& globaIndexWeightFromSrcToDst) 474 TRY 461 475 { 462 476 CContext* context = CContext::getCurrent(); … … 472 486 size_t nbLocalIndex = globalLocalIndexGridDestSendToServer.size(); 473 487 nbLocalIndexOnGridDest_.push_back(nbLocalIndex); 474 localMaskOnGridDest_.push_back(std::vector<bool>());475 std::vector<bool>& tmpMask = localMaskOnGridDest_.back();476 tmpMask.resize(nbLocalIndex,false);488 // localMaskOnGridDest_.push_back(std::vector<bool>()); 489 // std::vector<bool>& tmpMask = localMaskOnGridDest_.back(); 490 // tmpMask.resize(nbLocalIndex,false); 477 491 478 492 // Find out number of index sent from grid source and number of index received on grid destination … … 500 514 sendRankSizeMap[itIndex->first] = sendSize; 501 515 } 502 ep_lib::MPI_Allgather(&connectedClient,1, MPI_INT,recvCount,1,MPI_INT,client->intraComm);516 ep_lib::MPI_Allgather(&connectedClient,1,EP_INT,recvCount,1,EP_INT,client->intraComm); 503 517 504 518 displ[0]=0 ; … … 507 521 int* recvRankBuff=new int[recvSize]; 508 522 int* recvSizeBuff=new int[recvSize]; 509 ep_lib::MPI_Allgatherv(sendRankBuff,connectedClient, MPI_INT,recvRankBuff,recvCount,displ,MPI_INT,client->intraComm);510 ep_lib::MPI_Allgatherv(sendSizeBuff,connectedClient, MPI_INT,recvSizeBuff,recvCount,displ,MPI_INT,client->intraComm);523 ep_lib::MPI_Allgatherv(sendRankBuff,connectedClient,EP_INT,recvRankBuff,recvCount,displ,EP_INT,client->intraComm); 524 ep_lib::MPI_Allgatherv(sendSizeBuff,connectedClient,EP_INT,recvSizeBuff,recvCount,displ,EP_INT,client->intraComm); 511 525 for (int i = 0; i < nbClient; ++i) 512 526 { … … 532 546 recvGlobalIndexSrc[recvRank] = new unsigned long [recvSize]; 533 547 534 ep_lib::MPI_Irecv(recvGlobalIndexSrc[recvRank], recvSize, MPI_UNSIGNED_LONG, recvRank, 46, client->intraComm, &requests[requests_position++]); 535 ep_lib::MPI_Irecv(recvMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 47, client->intraComm, &requests[requests_position++]); 548 ep_lib::MPI_Irecv(recvGlobalIndexSrc[recvRank], recvSize, EP_UNSIGNED_LONG, recvRank, 46, client->intraComm, &requests[requests_position++]); 549 ep_lib::MPI_Irecv(recvMaskDst[recvRank], recvSize, EP_UNSIGNED_CHAR, recvRank, 47, client->intraComm, &requests[requests_position++]); 550 551 //requests.push_back(ep_lib::MPI_Request()); 552 //ep_lib::MPI_Irecv(recvGlobalIndexSrc[recvRank], recvSize, EP_UNSIGNED_LONG, recvRank, 46, client->intraComm, &requests.back()); 553 //requests.push_back(ep_lib::MPI_Request()); 554 //ep_lib::MPI_Irecv(recvMaskDst[recvRank], recvSize, EP_UNSIGNED_CHAR, recvRank, 47, client->intraComm, &requests.back()); 536 555 } 537 556 … … 568 587 569 588 // Send global index source and mask 570 ep_lib::MPI_Isend(sendGlobalIndexSrc[sendRank], sendSize, MPI_UNSIGNED_LONG, sendRank, 46, client->intraComm, &requests[requests_position++]); 571 ep_lib::MPI_Isend(sendMaskDst[sendRank], sendSize, MPI_UNSIGNED_CHAR, sendRank, 47, client->intraComm, &requests[requests_position++]); 589 ep_lib::MPI_Isend(sendGlobalIndexSrc[sendRank], sendSize, EP_UNSIGNED_LONG, sendRank, 46, client->intraComm, &requests[requests_position++]); 590 ep_lib::MPI_Isend(sendMaskDst[sendRank], sendSize, EP_UNSIGNED_CHAR, sendRank, 47, client->intraComm, &requests[requests_position++]); 591 //requests.push_back(ep_lib::MPI_Request()); 592 //ep_lib::MPI_Isend(sendGlobalIndexSrc[sendRank], sendSize, EP_UNSIGNED_LONG, sendRank, 46, client->intraComm, &requests.back()); 593 //requests.push_back(ep_lib::MPI_Request()); 594 //ep_lib::MPI_Isend(sendMaskDst[sendRank], sendSize, EP_UNSIGNED_CHAR, sendRank, 47, client->intraComm, &requests.back()); 572 595 } 573 596 … … 585 608 int recvSize = itSend->second; 586 609 587 ep_lib::MPI_Irecv(sendMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 48, client->intraComm, &requests[requests_position++]); 610 ep_lib::MPI_Irecv(sendMaskDst[recvRank], recvSize, EP_UNSIGNED_CHAR, recvRank, 48, client->intraComm, &requests[requests_position++]); 611 //requests.push_back(ep_lib::MPI_Request()); 612 //ep_lib::MPI_Irecv(sendMaskDst[recvRank], recvSize, EP_UNSIGNED_CHAR, recvRank, 48, client->intraComm, &requests.back()); 588 613 } 589 614 … … 621 646 622 647 // Okie, now inform the destination which source index are masked 623 ep_lib::MPI_Isend(recvMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 48, client->intraComm, &requests[requests_position++]); 648 ep_lib::MPI_Isend(recvMaskDst[recvRank], recvSize, EP_UNSIGNED_CHAR, recvRank, 48, client->intraComm, &requests[requests_position++]); 649 //requests.push_back(ep_lib::MPI_Request()); 650 //ep_lib::MPI_Isend(recvMaskDst[recvRank], recvSize, EP_UNSIGNED_CHAR, recvRank, 48, client->intraComm, &requests.back()); 624 651 } 625 652 status.resize(requests.size()); … … 653 680 recvTmp[recvRank][realRecvSize].first = globalLocalIndexGridDestSendToServer[recvIndexDst(idx)]; 654 681 recvTmp[recvRank][realRecvSize].second = recvWeightDst(idx); 655 tmpMask[globalLocalIndexGridDestSendToServer[recvIndexDst(idx)]] = true;656 682 ++realRecvSize; 657 683 } … … 678 704 679 705 } 706 CATCH 680 707 681 708 /*! … … 684 711 */ 685 712 const std::list<CGridTransformation::SendingIndexGridSourceMap>& CGridTransformation::getLocalIndexToSendFromGridSource() const 713 TRY 686 714 { 687 715 return localIndexToSendFromGridSource_; 688 716 } 717 CATCH 689 718 690 719 /*! … … 693 722 */ 694 723 const std::list<CGridTransformation::RecvIndexGridDestinationMap>& CGridTransformation::getLocalIndexToReceiveOnGridDest() const 724 TRY 695 725 { 696 726 return localIndexToReceiveOnGridDest_; 697 727 } 728 CATCH 698 729 699 730 /*! … … 702 733 */ 703 734 const std::list<size_t>& CGridTransformation::getNbLocalIndexToReceiveOnGridDest() const 735 TRY 704 736 { 705 737 return nbLocalIndexOnGridDest_; 706 738 } 707 708 /*! 709 Local mask of data which will be received on the grid destination 710 \return local mask of data 711 */ 712 const std::list<std::vector<bool> >& CGridTransformation::getLocalMaskIndexOnGridDest() const 713 { 714 return localMaskOnGridDest_; 715 } 716 717 } 739 CATCH 740 741 }
Note: See TracChangeset
for help on using the changeset viewer.