Changeset 2666 for XIOS3/branches
- Timestamp:
- 10/25/24 09:19:08 (3 months ago)
- Location:
- XIOS3/branches/xios-3.0-beta/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/branches/xios-3.0-beta/src/mpi_tag.hpp
r833 r2666 44 44 #define MPI_DOMAIN_INTERPOLATION_WEIGHT 9 45 45 46 46 /* Tag for mpi communication to send and receive info of DOMAIN in domain interpolation*/ 47 #define MPI_DOMAIN_INTERPOLATION_SOURCE_RANK 10 47 48 48 49 #endif -
XIOS3/branches/xios-3.0-beta/src/transformation/domain_algorithm/domain_algorithm_interpolate.cpp
r2313 r2666 548 548 transWeight[it->first].push_back(tmp[i].second); 549 549 } 550 } 550 } 551 552 std::map<int, std::vector<double> > transWeightOrdered(transWeight.begin(), transWeight.end()); 553 transWeight.clear(); 554 std::map<int, std::vector<double> >::const_iterator itWeightO = transWeightOrdered.begin(); 555 for(; itWeightO!=transWeightOrdered.end() ; ++itWeightO) { 556 transWeight[itWeightO->first] = itWeightO->second; 557 } 558 559 std::map<int, std::vector<int> > transMapOrdered(transMap.begin(), transMap.end()); 560 transMap.clear(); 561 std::map<int, std::vector<int> >::const_iterator itMapO = transMapOrdered.begin(); 562 for(; itMapO!=transMapOrdered.end() ; ++itMapO) { 563 transMap[itMapO->first] = itMapO->second; 564 } 551 565 } 552 566 CATCH … … 599 613 int* sendBuff = new int[nbClient]; 600 614 int* recvBuff = new int[nbClient]; 615 616 int* sendParticipants = new int[nbClient]; 617 int* recvParticipants = new int[nbClient]; 618 601 619 for (int i = 0; i < nbClient; ++i) 602 620 { 603 621 sendBuff[i] = 0; 604 622 recvBuff[i] = 0; 623 sendParticipants[i]=0 ; 624 recvParticipants[i]=0 ; 605 625 } 606 626 int sendBuffSize = 0; … … 617 637 } 618 638 sendBuff[itMap->first] = sizeIndex; 639 sendParticipants[itMap->first] = 1 ; 619 640 sendBuffSize += sizeIndex; 620 641 } 621 642 622 623 643 MPI_Allreduce(sendBuff, recvBuff, nbClient, MPI_INT, MPI_SUM, context->intraComm_); 644 MPI_Allreduce(sendParticipants, recvParticipants, nbClient, MPI_INT, MPI_SUM, context->intraComm_); 624 645 625 646 int* sendIndexDestBuff = new int [sendBuffSize]; … … 647 668 } 648 669 } 670 671 sendRequest.push_back(MPI_Request()); 672 MPI_Isend(&clientRank, 673 1, 674 MPI_INT, 675 itMap->first, 676 MPI_DOMAIN_INTERPOLATION_SOURCE_RANK, 677 context->intraComm_, 678 &sendRequest.back()); 649 679 650 680 sendRequest.push_back(MPI_Request()); … … 676 706 677 707 int recvBuffSize = recvBuff[clientRank]; 708 int numberOfParticipants = recvParticipants[clientRank] ; 709 678 710 int* recvIndexDestBuff = new int [recvBuffSize]; 679 711 int* recvIndexSrcBuff = new int [recvBuffSize]; … … 681 713 int receivedSize = 0; 682 714 int clientSrcRank; 683 while (receivedSize < recvBuffSize) 715 716 717 // this part is done to impose a specific order for reception to retrive reproducibility 718 set<int> rankOrder ; 719 for (int np=0 ; np < numberOfParticipants; ++np) 720 { 721 MPI_Status recvStatus; 722 int rank ; 723 MPI_Recv(&rank, 724 1, 725 MPI_INT, 726 MPI_ANY_SOURCE, 727 MPI_DOMAIN_INTERPOLATION_SOURCE_RANK, 728 context->intraComm_, 729 &recvStatus); 730 rankOrder.insert(rank) ; 731 } 732 733 for (auto clientSrcRank : rankOrder) 684 734 { 685 735 MPI_Status recvStatus; … … 687 737 recvBuffSize, 688 738 MPI_INT, 689 MPI_ANY_SOURCE,739 clientSrcRank, 690 740 MPI_DOMAIN_INTERPOLATION_DEST_INDEX, 691 741 context->intraComm_, … … 694 744 int countBuff = 0; 695 745 MPI_Get_count(&recvStatus, MPI_INT, &countBuff); 696 clientSrcRank = recvStatus.MPI_SOURCE;746 // clientSrcRank = recvStatus.MPI_SOURCE; 697 747 698 748 MPI_Recv((recvIndexSrcBuff + receivedSize), … … 720 770 } 721 771 772 std::map<int, std::vector<double> > transWeightOrdered(transWeight.begin(), transWeight.end()); 773 transWeight.clear(); 774 std::map<int, std::vector<double> >::const_iterator itWeightO = transWeightOrdered.begin(); 775 for(; itWeightO!=transWeightOrdered.end() ; ++itWeightO) { 776 transWeight[itWeightO->first] = itWeightO->second; 777 } 778 779 std::map<int, std::vector<int> > transMapOrdered(transMap.begin(), transMap.end()); 780 transMap.clear(); 781 std::map<int, std::vector<int> >::const_iterator itMapO = transMapOrdered.begin(); 782 for(; itMapO!=transMapOrdered.end() ; ++itMapO) { 783 transMap[itMapO->first] = itMapO->second; 784 } 785 722 786 std::vector<MPI_Status> requestStatus(sendRequest.size()); 723 787 MPI_Waitall(sendRequest.size(), &sendRequest[0], MPI_STATUS_IGNORE); 724 788 789 delete [] sendParticipants ; 790 delete [] recvParticipants ; 725 791 delete [] sendIndexDestBuff; 726 792 delete [] sendIndexSrcBuff;
Note: See TracChangeset
for help on using the changeset viewer.