Changeset 1856
- Timestamp:
- 02/05/20 16:02:18 (5 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/mpi_tag.hpp
r833 r1856 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 -
XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp
r1852 r1856 609 609 int* sendBuff = new int[nbClient]; 610 610 int* recvBuff = new int[nbClient]; 611 612 int* sendParticipants = new int[nbClient]; 613 int* recvParticipants = new int[nbClient]; 614 611 615 for (int i = 0; i < nbClient; ++i) 612 616 { 613 617 sendBuff[i] = 0; 614 618 recvBuff[i] = 0; 619 sendParticipants[i]=0 ; 620 recvParticipants[i]=0 ; 615 621 } 616 622 int sendBuffSize = 0; … … 627 633 } 628 634 sendBuff[itMap->first] = sizeIndex; 635 sendParticipants[itMap->first] = 1 ; 629 636 sendBuffSize += sizeIndex; 630 637 } 631 638 632 633 639 MPI_Allreduce(sendBuff, recvBuff, nbClient, MPI_INT, MPI_SUM, client->intraComm); 640 MPI_Allreduce(sendParticipants, recvParticipants, nbClient, MPI_INT, MPI_SUM, client->intraComm); 634 641 635 642 int* sendIndexDestBuff = new int [sendBuffSize]; … … 657 664 } 658 665 } 666 667 sendRequest.push_back(MPI_Request()); 668 MPI_Isend(&clientRank, 669 1, 670 MPI_INT, 671 itMap->first, 672 MPI_DOMAIN_INTERPOLATION_SOURCE_RANK, 673 client->intraComm, 674 &sendRequest.back()); 659 675 660 676 sendRequest.push_back(MPI_Request()); … … 686 702 687 703 int recvBuffSize = recvBuff[clientRank]; 704 int numberOfParticipants = recvParticipants[clientRank] ; 705 688 706 int* recvIndexDestBuff = new int [recvBuffSize]; 689 707 int* recvIndexSrcBuff = new int [recvBuffSize]; … … 691 709 int receivedSize = 0; 692 710 int clientSrcRank; 693 while (receivedSize < recvBuffSize) 711 712 713 // this part is done to impose a specific order for reception to retrive reproducibility 714 set<int> rankOrder ; 715 for (int np=0 ; np < numberOfParticipants; ++np) 716 { 717 MPI_Status recvStatus; 718 int rank ; 719 MPI_Recv(&rank, 720 1, 721 MPI_INT, 722 MPI_ANY_SOURCE, 723 MPI_DOMAIN_INTERPOLATION_SOURCE_RANK, 724 client->intraComm, 725 &recvStatus); 726 rankOrder.insert(rank) ; 727 } 728 729 for (auto clientSrcRank : rankOrder) 694 730 { 695 731 MPI_Status recvStatus; … … 697 733 recvBuffSize, 698 734 MPI_INT, 699 MPI_ANY_SOURCE,735 clientSrcRank, 700 736 MPI_DOMAIN_INTERPOLATION_DEST_INDEX, 701 737 client->intraComm, … … 704 740 int countBuff = 0; 705 741 MPI_Get_count(&recvStatus, MPI_INT, &countBuff); 706 clientSrcRank = recvStatus.MPI_SOURCE;742 // clientSrcRank = recvStatus.MPI_SOURCE; 707 743 708 744 MPI_Recv((recvIndexSrcBuff + receivedSize), … … 729 765 receivedSize += countBuff; 730 766 } 731 732 std::vector<MPI_Status> requestStatus(sendRequest.size()); 767 733 768 MPI_Waitall(sendRequest.size(), &sendRequest[0], MPI_STATUS_IGNORE); 734 769 770 delete [] sendParticipants ; 771 delete [] recvParticipants ; 735 772 delete [] sendIndexDestBuff; 736 773 delete [] sendIndexSrcBuff;
Note: See TracChangeset
for help on using the changeset viewer.