Changeset 196
- Timestamp:
- 05/18/11 17:47:46 (14 years ago)
- Location:
- XMLIO_V2/dev/dev_rv
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/Makefile.wk
r190 r196 31 31 32 32 ifeq ($(HOSTNAME), platine1076) 33 CSUITE = intel33 CSUITE = gnu 34 34 PFORME = platine-wk 35 35 endif -
XMLIO_V2/dev/dev_rv/src/xmlio/buffer.cpp
r157 r196 21 21 { 22 22 this->idata = data; 23 } 24 25 CBuffer::CBuffer(const CBuffer & buffer) 26 : size(buffer.size), delIdata(true) 27 { 28 this->idata = new char[size](); 29 std::copy (buffer.idata, buffer.idata+size, this->idata); 30 } 31 32 CBuffer::CBuffer(const CBuffer * const buffer) 33 : size(buffer->size), delIdata(true) 34 { 35 this->idata = new char[size](); 36 std::copy (buffer->idata, buffer->idata+size, this->idata); 23 37 } 24 38 … … 198 212 ofs.close(); 199 213 } 200 214 215 //--------------------------------------------------------------- 216 201 217 void CBuffer::printToBinaryStream (StdOStream & ostr) 202 { ostr.write (this->getData(), this->getSize()); } 203 204 205 StdSize CBuffer::getNextDataPosition(StdSize position) const 218 { 219 ostr.write (this->getData(), this->getSize()); 220 } 221 222 //--------------------------------------------------------------- 223 224 StdSize CBuffer::getNextDataPosition(StdSize position) 206 225 { 207 226 CBufferData bufdata; 227 this->updateBufferData(position); 208 228 this->getBufferData(bufdata, position); 209 229 return (bufdata.size + bufdata.position); … … 214 234 template <> 215 235 StdSize CBuffer::getRequestedSize(StdString data) const 216 { return (DATA_HEADER_SIZE + data.size() * sizeof (char)); } 217 236 { 237 return (DATA_HEADER_SIZE + data.size() * sizeof (char)); 238 } 239 240 //--------------------------------------------------------------- 241 242 void CBuffer::updateBufferData(StdSize position) 243 { 244 CBufferData bufdata; 245 this->getBufferData(bufdata, position); 246 bufdata.position = position + DATA_HEADER_SIZE; 247 this->setBufferData(bufdata, position); 248 } 249 218 250 ///-------------------------------------------------------------- 219 251 -
XMLIO_V2/dev/dev_rv/src/xmlio/buffer.hpp
r179 r196 41 41 inline StdSize getRequestedSize(ARRAY(T, 1) data) const; 42 42 43 StdSize getNextDataPosition(StdSize position) const;43 StdSize getNextDataPosition(StdSize position); 44 44 45 45 //-------------------------------------------------------------- … … 79 79 80 80 virtual void clear(void) = 0; 81 void updateBufferData(StdSize position); 81 82 82 83 /// Sortie fichier binaire /// … … 96 97 CBuffer(char * data, StdSize size); 97 98 explicit CBuffer(StdSize size); 98 CBuffer(const CBuffer & buffer); // Not implemented yet.99 CBuffer(const CBuffer * const buffer); // Not implemented yet.99 CBuffer(const CBuffer & buffer); 100 CBuffer(const CBuffer * const buffer); 100 101 101 102 /// Accesseurs protégés /// … … 108 109 109 110 /// Mutateurs protégés /// 110 111 111 template <class T> 112 112 inline void setData(const T & data, StdSize position); -
XMLIO_V2/dev/dev_rv/src/xmlio/buffer_list.cpp
r178 r196 7 7 /// ////////////////////// Définitions ////////////////////// /// 8 8 CBufferList::CBufferList(MPIComm com_client_server) 9 : SuperClass( )9 : SuperClass(CMPIManager::GetCommSize(com_client_server) - 1) 10 10 , com_client_server(com_client_server) 11 11 , nbbuffer(CMPIManager::GetCommSize(com_client_server) - 1) 12 { 13 for (StdSize i = 0; i < this->nbbuffer; i++) 14 SuperClass::push_back(BufferType(BUFFER_SERVER_SIZE)); 15 } 12 { /* Ne rien faire de plus */ } 16 13 17 14 CBufferList::~CBufferList(void) … … 28 25 } 29 26 30 voidCBufferList::recvRequests(void)27 bool CBufferList::recvRequests(void) 31 28 { 32 29 while (!this->hasRequests()) … … 38 35 StdSize size = CMPIManager::GetReceivedDataSize(com_client_server, i); 39 36 if (SuperClass::operator[](i-1).isAvailable(size)) 37 { 38 std::cout << "b:" << i << std::endl; 40 39 CMPIManager::ReceiveCircularBuffer 41 40 (com_client_server, i, SuperClass::operator[](i-1)); 41 } 42 else 43 { 44 DEBUG ("Impossible d'écrire dans le tampon " << i 45 << " (Taille requise : " << size << " octets," 46 << " Taille du buffer circulaire : " 47 << SuperClass::operator[](i-1).getSize() << " octets)"); 48 } 42 49 } 43 50 } 44 51 } 52 std::cout << "lol" << std::endl; 53 return (true); 45 54 } 46 55 47 std::vector<CLinearBuffer> CBufferList::getRequests(void)56 void CBufferList::getRequests(std::vector<CLinearBuffer> & lbuffer) 48 57 { 49 std::vector<CLinearBuffer> retvalue;50 58 for (StdSize i = 0; i < this->nbbuffer; i++) 51 retvalue.push_back(SuperClass::operator[](i).getNextRequest()); 52 return (retvalue); 59 lbuffer.push_back(SuperClass::operator[](i).getNextRequest()); 53 60 } 54 61 -
XMLIO_V2/dev/dev_rv/src/xmlio/buffer_list.hpp
r157 r196 33 33 34 34 /// Traitement /// 35 voidrecvRequests(void);35 bool recvRequests(void); 36 36 37 37 /// Accesseurs /// 38 38 StdSize getNumberOfBuffers(void) const; 39 std::vector<CLinearBuffer> getRequests(void);39 void getRequests(std::vector<CLinearBuffer> & lbuffer); 40 40 41 41 /// Destructeur /// -
XMLIO_V2/dev/dev_rv/src/xmlio/buffer_pair.cpp
r178 r196 20 20 bool CBufferPair::mustBeSent(void) 21 21 { 22 if (((currentBuffer == 0) && (first.getUsedSize()!= 0) &&23 24 ((currentBuffer ==1) && (second.getUsedSize() != 0) &&25 ((first_request== -1) || CMPIManager::Test (first_request))))22 if (((currentBuffer == 0) && (first.getUsedSize() != 0) && 23 ((second_request == -1) || CMPIManager::Test (second_request))) || 24 ((currentBuffer == 1) && (second.getUsedSize() != 0) && 25 ((first_request == -1) || CMPIManager::Test (first_request)))) 26 26 return (true); 27 27 return (false); -
XMLIO_V2/dev/dev_rv/src/xmlio/buffer_pair.hpp
r191 r196 66 66 A1 * arg1, A2 * arg2, A3 * arg3, A4 * arg4) 67 67 { 68 if (this->mustBeSent()) this->sendCurrentBuffer(); 68 if (this->mustBeSent()) 69 this->sendCurrentBuffer(); 70 69 71 70 72 CLinearBuffer & cbuffer = this->getCurrentBuffer(); -
XMLIO_V2/dev/dev_rv/src/xmlio/circular_buffer.cpp
r152 r196 9 9 /// ////////////////////// Définitions ////////////////////// /// 10 10 CCircularBuffer::CCircularBuffer(StdSize size) 11 : SuperClass(size), p_write(0), p_read(0), p_unused(0), nbrequest(0) 11 : SuperClass(size) 12 , p_write(0), p_read(0), p_unused(0) 13 , nbrequest(0) 14 { /* Ne rien faire de plus */ } 15 16 CCircularBuffer::CCircularBuffer(const CCircularBuffer & cbuffer) 17 : SuperClass(cbuffer) 18 , p_write(cbuffer.p_write), p_read(cbuffer.p_read), p_unused(cbuffer.p_unused) 19 , nbrequest(cbuffer.nbrequest) 20 { /* Ne rien faire de plus */ } 21 22 CCircularBuffer::CCircularBuffer(const CCircularBuffer * const cbuffer) 23 : SuperClass(cbuffer) 24 , p_write(cbuffer->p_write), p_read(cbuffer->p_read), p_unused(cbuffer->p_unused) 25 , nbrequest(cbuffer->nbrequest) 12 26 { /* Ne rien faire de plus */ } 13 27 … … 45 59 return (currsize); 46 60 } 47 61 62 //------------------------------------------------------------- 63 48 64 CLinearBuffer CCircularBuffer::getNextRequest(void) 49 65 { … … 74 90 return (SuperClass::getData(this->prepareNextDataPosition(data_size))); 75 91 } 76 92 93 //------------------------------------------------------------- 77 94 78 95 StdSize CCircularBuffer::prepareNextDataPosition(StdSize data_size) … … 102 119 this->clear(); 103 120 } 104 121 122 //------------------------------------------------------------- 123 105 124 void CCircularBuffer::movePWrite(StdSize data_size) 106 125 { … … 128 147 129 148 bool CCircularBuffer::hasRequest(void) const 130 { return (this->nbrequest != 0); } 131 149 { 150 return (this->nbrequest != 0); 151 } 152 153 //------------------------------------------------------------- 154 132 155 bool CCircularBuffer::isAvailable(StdSize data_size) const 133 156 { … … 146 169 ofs.close(); 147 170 } 148 171 172 //------------------------------------------------------------- 173 149 174 void CCircularBuffer::printToTextStream (StdOStream & ostr) 150 175 { … … 184 209 void CCircularBuffer::updateNbRequests(StdSize data_begin, StdSize data_end) 185 210 { 186 StdSize position = data_begin ;211 StdSize position = data_begin, i = 0; 187 212 while (position != data_end) 188 213 { 214 i++; 189 215 this->nbrequest++; 190 216 position = SuperClass::getNextDataPosition(position); // manager id -
XMLIO_V2/dev/dev_rv/src/xmlio/circular_buffer.hpp
r152 r196 21 21 22 22 /// Construteurs /// 23 explicit CCircularBuffer(StdSize size );24 CCircularBuffer(const CCircularBuffer & cbuffer); // Not implemented yet.25 CCircularBuffer(const CCircularBuffer * const cbuffer); // Not implemented yet.23 explicit CCircularBuffer(StdSize size = BUFFER_SERVER_SIZE); 24 CCircularBuffer(const CCircularBuffer & cbuffer); 25 CCircularBuffer(const CCircularBuffer * const cbuffer); 26 26 27 27 /// Mutateurs /// -
XMLIO_V2/dev/dev_rv/src/xmlio/client.cpp
r194 r196 42 42 CLinearBuffer::NULL_ARG); 43 43 // Pas d'argument à ajouter. 44 this->bpair.sendCurrentBuffer(); 44 45 } 45 46 -
XMLIO_V2/dev/dev_rv/src/xmlio/linear_buffer.cpp
r178 r196 9 9 /// ////////////////////// Définitions ////////////////////// /// 10 10 CLinearBuffer::CLinearBuffer(char * data, StdSize size) 11 : SuperClass(data, size), p_write(size)11 : SuperClass(data, size), bdata(), p_write(size) 12 12 { this->computeBufferData(); } 13 13 14 14 CLinearBuffer::CLinearBuffer(StdSize size) 15 : SuperClass(size), p_write(0) 16 { /* Ne rien faire de plus */ } 17 15 : SuperClass(size), bdata(), p_write(0) 16 { /* Ne rien faire de plus */ } 17 18 CLinearBuffer::CLinearBuffer(const CLinearBuffer & lbuffer) 19 : SuperClass(lbuffer), bdata(lbuffer.bdata), p_write(lbuffer.p_write) 20 { /* Ne rien faire de plus */ } 21 22 CLinearBuffer::CLinearBuffer(const CLinearBuffer * const lbuffer) 23 : SuperClass(lbuffer), bdata(lbuffer->bdata), p_write(lbuffer->p_write) 24 { /* Ne rien faire de plus */ } 25 18 26 CLinearBuffer::~CLinearBuffer(void) 19 27 { /* Ne rien faire de plus */ } … … 121 129 122 130 StdSize CLinearBuffer::getNumberOfStoredData(void) const 123 { return (this->bdata.size()); } 124 131 { 132 return (this->bdata.size()); 133 } 134 135 //--------------------------------------------------------------- 136 125 137 std::vector<StdSize> CLinearBuffer::getPositionsOfStoredData(void) const 126 138 { … … 137 149 return (retvalue); 138 150 } 139 151 152 //--------------------------------------------------------------- 153 140 154 std::vector<StdSize> CLinearBuffer::getSizesOfStoredData(void) const 141 155 { … … 151 165 return (retvalue); 152 166 } 153 167 168 //--------------------------------------------------------------- 169 154 170 std::vector<std::pair<CBuffer::CBufferDataType, bool> > 155 171 CLinearBuffer::getTypesOfStoredData(void) const … … 179 195 { 180 196 bdata.push_back(this->p_write); 197 SuperClass::updateBufferData(this->p_write); 181 198 SuperClass::getBufferData(bufdata, this->p_write); 182 199 this->p_write = (bufdata.size + bufdata.position); -
XMLIO_V2/dev/dev_rv/src/xmlio/linear_buffer.hpp
r152 r196 28 28 /// Construteurs /// 29 29 30 explicit CLinearBuffer(StdSize size );30 explicit CLinearBuffer(StdSize size = BUFFER_CLIENT_SIZE); 31 31 CLinearBuffer(char * data, StdSize size); 32 CLinearBuffer(const CLinearBuffer & lbuffer); // Not implemented yet.33 CLinearBuffer(const CLinearBuffer * const lbuffer); // Not implemented yet.32 CLinearBuffer(const CLinearBuffer & lbuffer); 33 CLinearBuffer(const CLinearBuffer * const lbuffer); 34 34 35 35 /// Accesseurs /// -
XMLIO_V2/dev/dev_rv/src/xmlio/main_server.cpp
r190 r196 5 5 #include "group_template_impl.hpp" 6 6 7 #include "client.hpp" 8 #include "server.hpp" 9 7 10 #include "fake.hpp" 8 11 … … 10 13 int main(int argc, char ** argv, char ** UNUSED(env)) 11 14 { 12 /*try15 try 13 16 { 14 //comm::CMPIManager::Initialise(&argc, &argv); // < seulement en mode connecté 17 comm::CMPIManager::Initialise(&argc, &argv); // < seulement en mode connecté 18 19 if (comm::CMPIManager::IsMaster(comm::CMPIManager::GetCommWorld())) 20 { 21 comm::CServer server(comm::CMPIManager::GetCommWorld()); 22 server.run(); 23 std::cout << "fin serveur" << std::endl; 24 25 } 26 else 27 { 28 comm::CClient client(comm::CMPIManager::GetCommWorld()); 29 client.initialize(); 30 client.finalize(); 31 } 32 33 comm::CMPIManager::Finalize(); // < seulement en mode connecté 34 15 35 16 CXIOSManager::Initialise(CXIOSManager::CLIENT_SERVER, &argc, &argv);36 /*CXIOSManager::Initialise(CXIOSManager::CLIENT_SERVER, &argc, &argv); 17 37 18 38 CXIOSManager::AddClient("nemo" , 4, 2, &nemo_fake_entry); … … 20 40 //CXIOSManager::AddClient("lmdz" , 4, 2, &lmdz_fake_entry); 21 41 CXIOSManager::RunClientServer(comm::CMPIManager::GetCommWorld()); 22 CXIOSManager::Finalize(); 42 CXIOSManager::Finalize();*/ 23 43 24 //comm::CMPIManager::Finalize(); // < seulement en mode connecté44 25 45 26 46 } … … 30 50 CMPIManager::Finalize(); 31 51 return (EXIT_FAILURE); 32 } */52 } 33 53 return (EXIT_SUCCESS); 34 54 } -
XMLIO_V2/dev/dev_rv/src/xmlio/manager/mpi_manager.cpp
r185 r196 239 239 StdSize data_begin = buff.prepareNextDataPosition(data_size); 240 240 CMPIManager::Receive(comm, src_rank, buff.getData(data_begin)); 241 242 241 buff.updateNbRequests(data_begin, data_begin + data_size); 243 242 } -
XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp
r187 r196 201 201 << " vérifiez les valeurs nj, nj_glo, jbegin, jend") ; 202 202 } 203 204 203 205 204 //---------------------------------------------------------------- -
XMLIO_V2/dev/dev_rv/src/xmlio/server.cpp
r190 r196 4 4 namespace comm { 5 5 6 /// ////////////////////// Définitions ////////////////////// /// 7 8 CServer::CServer(MPIComm comm_client_server) 9 : blist(comm_client_server) 10 { /* Ne rien faire de plus */ } 11 12 CServer::~CServer(void) 13 { /* Ne rien faire de plus */ } 14 15 ///-------------------------------------------------------------- 16 17 const CBufferList & CServer::getBufferList(void) const 18 { 19 return (this->blist); 20 } 21 22 //--------------------------------------------------------------- 23 24 void CServer::run(void) 25 { 26 while (this->blist.recvRequests()) 27 { 28 long int managerId = 0, methodId = 0, nbargs = 0; 29 long int managerId_= 0, methodId_ = 0, nbargs_ = 0; 30 std::vector<CLinearBuffer> lbuffer; 31 this->blist.getRequests(lbuffer); 32 for (StdSize i = 0; i < lbuffer.size(); i++) 33 { 34 lbuffer[i].getRequestInfos(0, managerId, methodId, nbargs); 35 if (((managerId_ != managerId) || (methodId_ != methodId) || (nbargs_ != nbargs)) && (i != 0 )) 36 { 37 /*std::cout << managerId_ << "<->" << managerId << std::endl 38 << methodId_ << "<->" << methodId << std::endl 39 << nbargs_ << "<->" << nbargs << std::endl;*/ 40 ERROR("CServer::run(void)", << "[" << i << "] Les requêtes ne sont pas synchronisées !"); 41 } 42 managerId_ = managerId; 43 methodId_ = methodId; 44 nbargs_ = nbargs; 45 } 46 47 if (managerId == 0) 48 { 49 switch(methodId) 50 { 51 case (0) : 52 this->initialize(); 53 continue; 54 case (1) : 55 this->finalize(); 56 return; 57 default : 58 ERROR("CServer::run(void)", 59 << "[ managerId = " << managerId << ", " 60 << "[ methodId = " << methodId << ", " 61 << "[ nbargs = " << nbargs << "] " 62 << " Methode inconnue !"); 63 } 64 } 65 if (managerId == 1) 66 { 67 switch(methodId) 68 { 69 case (0) : 70 this->setContext(lbuffer); 71 continue; 72 case (1) : 73 this->updateCalendar(lbuffer); 74 continue; 75 default : 76 ERROR("CServer::run(void)", 77 << "[ managerId = " << managerId << ", " 78 << "[ methodId = " << methodId << ", " 79 << "[ nbargs = " << nbargs << "] " 80 << " Methode inconnue !"); 81 } 82 } 83 if (managerId == 2) 84 { 85 switch(methodId) 86 { 87 case (0) : 88 this->writeData(lbuffer, 4); 89 continue; 90 case (1) : 91 this->writeData(lbuffer, 8); 92 continue; 93 default : 94 ERROR("CServer::run(void)", 95 << "[ managerId = " << managerId << ", " 96 << "[ methodId = " << methodId << ", " 97 << "[ nbargs = " << nbargs << "] " 98 << " Methode inconnue !"); 99 } 100 } 101 ERROR("CServer::run(void)", 102 << "[ managerId = " << managerId << ", " 103 << "[ methodId = " << methodId << ", " 104 << "[ nbargs = " << nbargs << "] " 105 << " Methode inconnue !"); 106 } 107 } 6 108 7 109 //-------------------------------------------------------------- 110 111 void CServer::initialize(void) // manager 0, method 0 112 { 113 std::cout << "initialize called " << std::endl; 114 } 115 116 //-------------------------------------------------------------- 117 118 void CServer::finalize(void) // manager 0, method 1 119 { 120 std::cout << "finalize called " << std::endl; 121 } 122 123 124 //-------------------------------------------------------------- 125 126 void CServer::setContext(const std::vector<CLinearBuffer> & buffer) // manager 1, method 0 127 { 128 std::cout << "setContext called " << std::endl; 129 } 130 131 //-------------------------------------------------------------- 132 133 void CServer::updateCalendar(const std::vector<CLinearBuffer> & buffer) // manager 1, method 1 134 { 135 std::cout << "updateCalendar called " << std::endl; 136 } 137 138 //-------------------------------------------------------------- 139 140 void CServer::writeData(const std::vector<CLinearBuffer> & buffer, int prec) // manager 2, method 0 - 1 141 { 142 std::cout << "writeData called " << std::endl; 143 } 144 145 ///-------------------------------------------------------------- 146 147 8 148 } // namespace comm 9 149 } // namespace xmlioserver -
XMLIO_V2/dev/dev_rv/src/xmlio/server.hpp
r190 r196 4 4 /// xmlioserver headers /// 5 5 #include "xmlioserver_spl.hpp" 6 #include "mpi_manager.hpp" 7 #include "buffer_list.hpp" 8 #include "array.hpp" 6 9 7 10 namespace xmlioserver { 8 11 namespace comm { 9 12 10 13 /// ////////////////////// Déclarations ////////////////////// /// 14 15 class CServer 16 { 17 public : 18 19 /// Constructeurs /// 20 CServer(MPIComm comm_client_server); 21 22 /// Destructeur /// 23 ~CServer(void); 24 25 void run(void); 26 27 protected : 28 29 /// Accesseur /// 30 const CBufferList & getBufferList(void) const; 31 32 public : 33 34 /// Appels distants/// 35 void initialize(void); // manager 0, method 0 36 void finalize(void); // manager 0, method 1 37 38 void setContext(const std::vector<CLinearBuffer> & buffer); // manager 1, method 0 39 void updateCalendar(const std::vector<CLinearBuffer> & buffer); // manager 1, method 1 40 41 void writeData(const std::vector<CLinearBuffer> & buffer, int prec); // manager 2, method 0 - 1 42 43 private : 44 45 /// Propriété privée /// 46 CBufferList blist; 47 48 }; // class CServer 11 49 12 50 } // namespace comm
Note: See TracChangeset
for help on using the changeset viewer.