Changeset 177 for XMLIO_V2/dev/dev_rv/src/xmlio/manager
- Timestamp:
- 04/18/11 11:30:27 (13 years ago)
- Location:
- XMLIO_V2/dev/dev_rv/src/xmlio/manager
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/xmlio/manager/mpi_manager.cpp
r157 r177 54 54 55 55 MPIComm CMPIManager::GetCommWorld(void) 56 { return (mpi_comm_world); } 56 { 57 return (mpi_comm_world); 58 } 57 59 58 60 bool CMPIManager::IsMaster(MPIComm comm) 59 { return (CMPIManager::GetCommRank(comm) == 0); } 61 { 62 return (CMPIManager::GetCommRank(comm) == 0); 63 } 60 64 61 65 bool CMPIManager::IsRank(MPIComm comm, int rank) 62 { return (CMPIManager::GetCommRank(comm) == rank); } 66 { 67 return (CMPIManager::GetCommRank(comm) == rank); 68 } 63 69 64 70 MPIComm CMPIManager::CreateComm(MPIGroup group, MPIComm pcomm) -
XMLIO_V2/dev/dev_rv/src/xmlio/manager/xios_manager.cpp
r152 r177 33 33 CXIOSManager::XIOSType CXIOSManager::Type = CLIENT; 34 34 35 StdString CXIOSManager::ClientName ;36 comm::MPIComm CXIOSManager::Comm_Client_Server ;37 comm::MPIComm CXIOSManager::Comm_Server ;35 StdString CXIOSManager::ClientName("unknown name"); 36 comm::MPIComm CXIOSManager::Comm_Client_Server = -1; 37 comm::MPIComm CXIOSManager::Comm_Server = -1; 38 38 39 39 xios_map<StdString, CXIOSManager::XIOSClient> CXIOSManager::Clients; 40 40 41 41 ///-------------------------------------------------------------- 42 43 void CXIOSManager::RunServer 44 (StdString clientName, comm::MPIComm comm_client_server, comm::MPIComm comm_server) 45 { 46 47 } 48 49 //-------------------------------------------------------------- 42 50 43 51 void CXIOSManager::RunClientServer(comm::MPIComm comm_client_server) … … 45 53 using namespace comm; 46 54 typedef std::pair<StdString, XIOSClient> StdPairStrClient; 47 48 MPIComm world_comm = CMPIManager::GetCommWorld();49 MPIGroup world_group = CMPIManager::GetGroupWorld();50 55 51 56 if (CMPIManager::IsMaster(comm_client_server)) … … 71 76 const StdPairStrClient & elem = *iit; 72 77 std::cout << " - " << elem.first 73 << " > nombre de clients : " << elem.second.nbClient 74 << " , nombre de clients par serveur : " << elem.second.nbClientPServer 75 << " , nombre de serveurs : " << elem.second.nbClient/elem.second.nbClientPServer 78 << " > nombre de clients : " 79 << elem.second.nbClient 80 << " , nombre de clients par serveur : " 81 << elem.second.nbClientPServer 82 << " , nombre de serveurs : " 83 << elem.second.nbClient/elem.second.nbClientPServer 76 84 << std::endl; 77 85 } … … 86 94 iit = CXIOSManager::Clients.begin(), 87 95 eend = CXIOSManager::Clients.end(); 96 97 bool isClient = true, isIncl = false; 98 MPIComm comm_client = 0, comm_client_grp = 0; comm_client_server = 0; 88 99 89 100 for (;iit != eend; iit++) 90 101 { 91 102 const StdPairStrClient & elem = *iit; 92 MPIComm comm_client = 0, comm_client_grp = 0; comm_client_server = 0; 93 94 int currentRank = CMPIManager::GetCommRank(); 95 StdString clientName = elem.first; 96 StdSize nbClient = elem.second.nbClient; 97 StdSize nbClientPServer = elem.second.nbClientPServer; 98 StdSize nbServer = elem.second.nbClient/elem.second.nbClientPServer; 99 StdSize totalproc = nbClient + nbServer; 103 104 std::vector<int> clieindex, servindex ; 105 StdSize currentRank = CMPIManager::GetCommRank(); 106 StdString clientName = elem.first; 107 StdSize nbClient = elem.second.nbClient; 108 StdSize nbClientPServer = elem.second.nbClientPServer; 109 StdSize nbServer = (elem.second.nbClient)/(elem.second.nbClientPServer); 100 110 101 111 for (StdSize i = 0; i<nbServer; i++) 102 112 { 103 113 end = start + nbClientPServer; 104 // Pas encore implémenté (interface de gestion de groupe/communicateur buggée) 114 MPIComm comm_ = CMPIManager::CreateComm 115 (CMPIManager::CreateSubGroup(CMPIManager::GetGroupWorld(), start, end)); 116 MPIComm comm__ = CMPIManager::CreateComm 117 (CMPIManager::CreateSubGroup(CMPIManager::GetGroupWorld(), start+1, end)); 118 119 servindex.push_back(start); 120 for (StdSize j = start+1; j <= end; j++) 121 clieindex.push_back(j); 122 123 if ((currentRank >= start) && (currentRank <= end)) 124 { 125 comm_client_server = comm_; 126 comm_client_grp = comm__; 127 isIncl = true; 128 CXIOSManager::ClientName = clientName; 129 } 130 if (currentRank == start) 131 { 132 isClient = false; 133 CXIOSManager::Comm_Client_Server = comm_; 134 } 135 if (clieindex.size() == nbClient) 136 { 137 MPIComm comm___ = CMPIManager::CreateComm 138 (CMPIManager::CreateSubGroup(CMPIManager::GetGroupWorld(), clieindex)); 139 if (isIncl) 140 { 141 comm_client = comm___; 142 } 143 clieindex.clear(); 144 isIncl = false; 145 } 146 105 147 start = start + nbClientPServer + 1; 106 148 } 149 CXIOSManager::Comm_Server = CMPIManager::CreateComm 150 (CMPIManager::CreateSubGroup(CMPIManager::GetGroupWorld(), servindex)); 151 152 } 153 154 if (isClient) 155 { 156 CXIOSManager::Clients[CXIOSManager::ClientName].entry 157 (comm_client, comm_client_grp, comm_client_server); 158 } 159 else 160 { 161 CXIOSManager::RunServer(CXIOSManager::ClientName, 162 CXIOSManager::Comm_Client_Server, 163 CXIOSManager::Comm_Server); 107 164 } 108 165 } -
XMLIO_V2/dev/dev_rv/src/xmlio/manager/xios_manager.hpp
r152 r177 24 24 void (*entry)(comm::MPIComm, comm::MPIComm, comm::MPIComm) ; 25 25 } XIOSClient; 26 27 public: 26 28 27 29 /// Initialisation et finalisation de la bibliothÚque /// … … 37 39 /// Lancement des serveurs et/ou des clients /// 38 40 static void RunServer(StdString clientName, 39 comm::MPIComm comm_client_server, comm::MPIComm comm_server); // Not implemented yet.41 comm::MPIComm comm_client_server, comm::MPIComm comm_server); 40 42 static void RunClient(comm::MPIComm comm_client = 41 comm::CMPIManager::GetCommWorld()); // Not implemented yet.43 comm::CMPIManager::GetCommWorld()); 42 44 static void RunClientServer(comm::MPIComm comm_client_server = 43 45 comm::CMPIManager::GetCommWorld());
Note: See TracChangeset
for help on using the changeset viewer.