[2236] | 1 | #include "grid_client_server_remote_connector.hpp" |
---|
| 2 | |
---|
| 3 | namespace xios |
---|
| 4 | { |
---|
| 5 | /** |
---|
| 6 | * \brief class constructor. |
---|
| 7 | * \param srcView List of sources views. |
---|
| 8 | * \param dstView List of remotes views. |
---|
| 9 | * \param localComm Local MPI communicator |
---|
| 10 | * \param remoteSize Size of the remote communicator |
---|
| 11 | */ |
---|
[2267] | 12 | CGridClientServerRemoteConnector::CGridClientServerRemoteConnector( vector<shared_ptr<CLocalView> >& srcFullView, vector<shared_ptr<CLocalView>>& srcWorkflowView, |
---|
| 13 | vector<shared_ptr<CDistributedView>>& dstView, MPI_Comm localComm, int remoteSize) |
---|
[2236] | 14 | : CGridRemoteConnector(srcFullView, dstView, localComm, remoteSize) , srcWorkflowView_(srcWorkflowView) |
---|
| 15 | {} |
---|
| 16 | |
---|
| 17 | |
---|
[2304] | 18 | void CGridClientServerRemoteConnector::computeConnector(bool eliminateRedondant) |
---|
[2236] | 19 | { |
---|
[2304] | 20 | if (eliminateRedondant) |
---|
| 21 | { |
---|
| 22 | auto workflowRemoteConnector=make_shared<CGridRemoteConnector>(srcWorkflowView_,dstView_,localComm_,remoteSize_) ; |
---|
| 23 | workflowRemoteConnector->computeConnector() ; |
---|
| 24 | computeViewDistribution() ; |
---|
[2236] | 25 | |
---|
[2304] | 26 | for(int i=0;i<srcView_.size();i++) isSrcViewDistributed_[i] = isSrcViewDistributed_[i] || workflowRemoteConnector->getIsSrcViewDistributed()[i] ; |
---|
| 27 | computeConnectorMethods() ; |
---|
| 28 | computeRedondantRanks() ; |
---|
[2236] | 29 | |
---|
[2304] | 30 | for(auto& rank : rankToRemove_) |
---|
| 31 | if (workflowRemoteConnector->getRankToRemove().count(rank)!=0) |
---|
| 32 | for(auto& element : elements_) element.erase(rank) ; |
---|
| 33 | } |
---|
| 34 | else |
---|
| 35 | { |
---|
| 36 | computeViewDistribution() ; |
---|
| 37 | computeConnectorRedundant() ; |
---|
| 38 | } |
---|
[2236] | 39 | } |
---|
[2397] | 40 | |
---|
| 41 | void CGridClientServerRemoteConnector::computeConnectorOut() |
---|
| 42 | { |
---|
| 43 | set<int> workflowRankToRemove ; |
---|
| 44 | vector<bool> workflowIsSrcViewDistributed ; |
---|
| 45 | { |
---|
| 46 | auto workflowRemoteConnector=make_shared<CGridRemoteConnector>(srcWorkflowView_,dstView_,localComm_,remoteSize_) ; |
---|
| 47 | workflowRemoteConnector->computeViewDistribution() ; |
---|
| 48 | workflowRemoteConnector->computeConnectorMethods(false) ; |
---|
| 49 | workflowRemoteConnector->computeRedondantRanks(false) ; |
---|
| 50 | workflowRankToRemove = workflowRemoteConnector->getRankToRemove() ; |
---|
| 51 | workflowIsSrcViewDistributed = workflowRemoteConnector->getIsSrcViewDistributed() ; |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | computeViewDistribution() ; |
---|
| 55 | |
---|
| 56 | for(int i=0;i<srcView_.size();i++) isSrcViewDistributed_[i] = isSrcViewDistributed_[i] || workflowIsSrcViewDistributed[i] ; |
---|
| 57 | computeConnectorMethods(false) ; |
---|
| 58 | computeRedondantRanks(false) ; |
---|
[2236] | 59 | |
---|
[2397] | 60 | for(auto& rank : rankToRemove_) |
---|
| 61 | if (workflowRankToRemove.count(rank)!=0) |
---|
| 62 | for(auto& element : elements_) element.erase(rank) ; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | void CGridClientServerRemoteConnector::computeConnectorIn() |
---|
| 66 | { |
---|
| 67 | set<int> workflowRankToRemove ; |
---|
| 68 | vector<bool> workflowIsSrcViewDistributed ; |
---|
| 69 | { |
---|
| 70 | auto workflowRemoteConnector=make_shared<CGridRemoteConnector>(srcWorkflowView_,dstView_,localComm_,remoteSize_) ; |
---|
| 71 | workflowRemoteConnector->computeViewDistribution() ; |
---|
| 72 | workflowRemoteConnector->computeConnectorMethods(true) ; |
---|
| 73 | workflowRemoteConnector->computeRedondantRanks(true) ; |
---|
| 74 | workflowRankToRemove = workflowRemoteConnector->getRankToRemove() ; |
---|
| 75 | workflowIsSrcViewDistributed = workflowRemoteConnector->getIsSrcViewDistributed() ; |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | computeViewDistribution() ; |
---|
| 79 | |
---|
| 80 | for(int i=0;i<srcView_.size();i++) isSrcViewDistributed_[i] = isSrcViewDistributed_[i] || workflowIsSrcViewDistributed[i] ; |
---|
| 81 | computeConnectorMethods(true) ; |
---|
| 82 | computeRedondantRanks(true) ; |
---|
| 83 | |
---|
| 84 | for(auto& rank : rankToRemove_) |
---|
| 85 | if (workflowRankToRemove.count(rank)!=0) |
---|
| 86 | for(auto& element : elements_) element.erase(rank) ; |
---|
| 87 | } |
---|
[2236] | 88 | } |
---|