Changeset 255
- Timestamp:
- 07/08/11 11:21:50 (13 years ago)
- Location:
- XMLIO_V2/dev/common
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/common/arch/arch-X64_TITANE.fcm
r250 r255 18 18 19 19 %BASE_INC -D NONE 20 %BASE_LD -lstdc++ -lifcore -lintlc20 %BASE_LD -lstdc++ -
XMLIO_V2/dev/common/src/xmlio/fortran/impi_interface.f90
r219 r255 176 176 END SUBROUTINE xios_mpi_barrier 177 177 178 ! Collecte de données et rediffusion 179 SUBROUTINE xios_mpi_allgather(sendbuf, sendcount, recvbuf, recvcount, comm, ierror) BIND (C, NAME ="mpi_allgather") 180 INTEGER (kind = C_INT), DIMENSION(*) :: sendbuf, recvbuf 181 INTEGER (kind = C_INT) :: sendcount, recvcount, comm, ierror 182 CALL MPI_ALLGATHER(sendbuf, sendcount, MPI_INTEGER, recvbuf, recvcount, MPI_INTEGER, comm, ierror) 183 END SUBROUTINE xios_mpi_allgather 184 178 185 END MODULE IMPI_INTERFACE -
XMLIO_V2/dev/common/src/xmlio/fortran/impi_interface.hpp
r219 r255 80 80 void mpi_barrier(int * comm, int * err); 81 81 82 /// Collecte de données et rediffusion /// 83 void mpi_allgather(int sendbuf[], int * sendcount, int recvbuf[], int * recvcount, int * comm, int * ierror); 84 82 85 #ifdef __cplusplus 83 86 } -
XMLIO_V2/dev/common/src/xmlio/main_server.cpp
r219 r255 16 16 try 17 17 { 18 MPIComm comm_client, comm_client_server, comm_server; 18 19 //comm::CMPIManager::Initialise(&argc, &argv); // < seulement en mode connecté 19 20 //comm::CMPIManager::Finalize(); // < seulement en mode connecté 20 21 21 22 CXIOSManager::Initialise (CXIOSManager::CLIENT_SERVER, &argc, &argv); 22 CXIOSManager::AddClient ("nemo" , 4, 2, &nemo_fake_entry);23 //CXIOSManager::AddClient ("nemo" , 4, 2, &nemo_fake_entry); 23 24 //CXIOSManager::AddClient("orchidee", 1, 1, &orchidee_fake_entry); 24 25 //CXIOSManager::AddClient("lmdz" , 4, 2, &lmdz_fake_entry); 25 CXIOSManager::RunClientServer (comm::CMPIManager::GetCommWorld ()); 26 CMPIManager::DispatchClient(true, comm_client, comm_client_server, comm_server); 27 CMPIManager::RunServer("Nemo", comm_client_server, comm_server); 28 //CXIOSManager::RunClientServer (comm::CMPIManager::GetCommWorld ()); 26 29 CXIOSManager::Finalize (); 27 30 } -
XMLIO_V2/dev/common/src/xmlio/manager/mpi_manager.cpp
r219 r255 88 88 } 89 89 90 bool CMPIManager::DispatchClient(bool is_server, 91 MPIComm & comm_client, 92 MPIComm & comm_client_server, 93 MPIComm & comm_server, 94 MPIComm comm_parent) 95 { 96 int value = (is_server) ? 1 : 2; 97 StdSize nbClient = 0, nbServer = 0, nbClientByServer = 0; 98 std::vector<int> info, rank_client, rank_server; 99 CMPIManager::AllGather(value, info, comm_parent); 100 101 for (StdSize s = 0; s < info.size(); s++) 102 { 103 if (info[s] == 1) rank_server.push_back(s); 104 else rank_client.push_back(s); 105 } 106 nbClient = rank_client.size(); 107 nbServer = rank_server.size(); 108 109 110 comm_client = CMPIManager::CreateComm(CMPIManager::CreateSubGroup( 111 CMPIManager::GetGroupWorld(), rank_client), comm_parent); 112 113 if (nbServer != 0) 114 { 115 StdSize currentServer = 0; 116 nbClientByServer = nbClient/nbServer; 117 comm_server = CMPIManager::CreateComm(CMPIManager::CreateSubGroup( 118 CMPIManager::GetGroupWorld(), rank_server), comm_parent); 119 120 //std::cout << nbClient << "," << nbServer << "," << nbClientByServer << std::endl; 121 122 for (StdSize mm = 0; mm < nbClient; mm += nbClientByServer) 123 { 124 std::vector<int> group_rank; 125 group_rank.push_back(rank_server[currentServer++]); 126 for (StdSize nn = 0; nn < nbClientByServer; nn++) 127 group_rank.push_back(rank_client[nn+mm]); 128 MPIComm comm_client_server_ = CMPIManager::CreateComm(CMPIManager::CreateSubGroup( 129 CMPIManager::GetGroupWorld(), group_rank), comm_parent); 130 131 if (std::find(group_rank.begin(), group_rank.end(), CMPIManager::GetCommRank()) != group_rank.end()) 132 { 133 comm_client_server = comm_client_server_; 134 } 135 136 group_rank.clear(); 137 } 138 return (true); 139 } 140 else 141 { 142 comm_server = comm_client; 143 return (false); 144 } 145 } 146 90 147 //--------------------------------------------------------------- 91 148 … … 211 268 } 212 269 270 void CMPIManager::AllGather(int indata, std::vector<int> & outdata, MPIComm comm) 271 { 272 std::vector<int> data; data.push_back(indata); 273 CMPIManager::AllGather(data, outdata, comm); 274 } 275 276 void CMPIManager::AllGather(std::vector<int> & indata, 277 std::vector<int> & outdata, MPIComm comm) 278 { 279 int error = 0; 280 int sendcount = indata.size(), recvcount = indata.size() * CMPIManager::GetCommSize(comm); 281 outdata.resize(recvcount); 282 mpi_allgather(&(indata[0]), &sendcount, &(outdata[0]), &sendcount, &comm, &error); 283 if (error != mpi_success) 284 ERROR("CMPIManager::AllGather (indata, outdata, comm)", << " MPI Error !"); 285 } 286 213 287 //-------------------------------------------------------------- 214 288 -
XMLIO_V2/dev/common/src/xmlio/manager/mpi_manager.hpp
r219 r255 40 40 static void Barrier(MPIComm comm = CMPIManager::GetCommWorld()); 41 41 42 static bool DispatchClient(bool is_server, 43 MPIComm & comm_client, 44 MPIComm & comm_client_server, 45 MPIComm & comm_server, 46 MPIComm comm_parent = CMPIManager::GetCommWorld()); 47 42 48 /// Groupes /// 43 49 static MPIGroup GetGroupWorld(void); … … 53 59 static void Wait (MPIRequest & request); 54 60 static bool Test (MPIRequest & request); 61 62 static void AllGather(int indata, std::vector<int> & outdata, 63 MPIComm comm = CMPIManager::GetCommWorld()); 64 65 static void AllGather(std::vector<int> & indata, 66 std::vector<int> & outdata, 67 MPIComm comm = CMPIManager::GetCommWorld()); 55 68 56 69 static bool HasReceivedData(MPIComm comm, int src_rank);
Note: See TracChangeset
for help on using the changeset viewer.