Changeset 511
- Timestamp:
- 11/13/14 15:09:28 (10 years ago)
- Location:
- XIOS/trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/inputs/iodef.xml
r481 r511 10 10 11 11 12 <file_definition type=" multiple_file" par_access="collective" output_freq="6h" output_level="10" enabled=".TRUE.">12 <file_definition type="one_file" par_access="collective" output_freq="6h" output_level="10" enabled=".TRUE."> 13 13 <file id="output" name="output"> 14 14 <field field_ref="field_A" /> … … 41 41 <variable_definition> 42 42 <variable_group id="buffer"> 43 buffer_size = 8000000044 buffer_server_factor_size = 243 <variable id="optimal_buffer_size" type="string">performance</variable> 44 <variable id="buffer_factor_size" type="double">1.0</variable> 45 45 </variable_group> 46 46 47 47 <variable_group id="parameters" > 48 48 <variable id="using_server" type="boolean">false</variable> 49 <variable id="info_level" type="int">50</variable> 49 <variable id="info_level" type="int">10</variable> 50 <variable id="print_file" type="boolean">true</variable> 50 51 </variable_group> 51 52 </variable_definition> -
XIOS/trunk/src/client.cpp
r506 r511 132 132 CTimer::get("XIOS").resume() ; 133 133 CTimer::get("XIOS init").resume() ; 134 135 if (CXios::usingServer) 134 135 if (CXios::usingServer) 136 136 { 137 137 MPI_Status status ; … … 153 153 { 154 154 CContext::setCurrent(id) ; 155 CContext* context=CContext::create(id) ; 155 CContext* context=CContext::create(id); 156 StdString idServer(id); 157 idServer += "_server"; 156 158 157 159 if (!CXios::isServer) … … 169 171 170 172 CMessage msg ; 171 msg<<id<<size<<globalRank ; 173 msg<<idServer<<size<<globalRank ; 174 // msg<<id<<size<<globalRank ; 172 175 173 176 int messageSize=msg.size() ; … … 192 195 MPI_Comm contextInterComm ; 193 196 MPI_Comm_dup(contextComm,&contextInterComm) ; 194 context->initClient(contextComm,contextInterComm) ; 195 context->initServer(contextComm,contextInterComm) ; 197 CContext* contextServer = CContext::create(idServer); 198 199 // Firstly, initialize context on client side 200 context->initClient(contextComm,contextInterComm, contextServer); 201 202 203 // Secondly, initialize context on server side 204 contextServer->initServer(contextComm,contextInterComm); 205 206 // Finally, we should return current context to context client 207 CContext::setCurrent(id); 208 // context->initServer(contextComm,contextInterComm) ; 196 209 } 197 210 } … … 223 236 report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS").getCumulatedTime()*100.<<" %"<<endl ; 224 237 report(0)<< " Performance report : This ratio must be close to zero. Otherwise it may be usefull to increase buffer size or numbers of server"<<endl ; 225 report(0)<< " Memory report : Current buffer_size : "<<CXios::bufferSize<<endl ;226 report(0)<< " Memory report : Minimum buffer size required : "<<maxRequestSize*2<< endl ;238 // report(0)<< " Memory report : Current buffer_size : "<<CXios::bufferSize<<endl ; 239 report(0)<< " Memory report : Minimum buffer size required : "<<maxRequestSize*2<< " bytes" << endl ; 227 240 report(0)<< " Memory report : increasing it by a factor will increase performance, depending of the volume of data wrote in file at each time step of the file"<<endl ; 228 241 } -
XIOS/trunk/src/context_client.cpp
r509 r511 17 17 18 18 19 CContextClient::CContextClient(CContext* parent,MPI_Comm intraComm_, MPI_Comm interComm_) : mapBufferSize_() 19 CContextClient::CContextClient(CContext* parent,MPI_Comm intraComm_, MPI_Comm interComm_, CContext* cxtSer) 20 : mapBufferSize_(), parentServer(cxtSer) 20 21 { 21 22 context=parent ; … … 61 62 } 62 63 63 if (context->hasServer) waitEvent(ranks) ; 64 // if (context->hasServer) 65 if (0 != parentServer) 66 { 67 waitEvent(ranks); 68 CContext::setCurrent(context->getId()); 69 } 70 64 71 timeLine++ ; 65 72 } … … 92 99 void CContextClient::waitEvent(list<int>& ranks) 93 100 { 94 context->server->setPendingEvent() ; 101 // context->server->setPendingEvent() ; 102 // while(checkBuffers(ranks)) 103 // { 104 // context->server->listen() ; 105 // context->server->checkPendingRequest() ; 106 // } 107 // 108 // while(context->server->hasPendingEvent()) 109 // { 110 // context->server->eventLoop() ; 111 // } 112 113 parentServer->server->setPendingEvent() ; 95 114 while(checkBuffers(ranks)) 96 115 { 97 context->server->listen() ;98 context->server->checkPendingRequest() ;99 } 100 101 while( context->server->hasPendingEvent())102 { 103 context->server->eventLoop() ;116 parentServer->server->listen() ; 117 parentServer->server->checkPendingRequest() ; 118 } 119 120 while(parentServer->server->hasPendingEvent()) 121 { 122 parentServer->server->eventLoop() ; 104 123 } 105 124 … … 240 259 } 241 260 CTimer::get("Blocking time").suspend(); 242 report(0)<< " Memory report : Context <"<<context->getId()<<"> : client side : total memory used for buffer "<<buffers.size()*CXios::bufferSize<<" bytes"<<endl ; 261 // report(0)<< " Memory report : Context <"<<context->getId()<<"> : client side : total memory used for buffer "<<buffers.size()*CXios::bufferSize<<" bytes"<<endl ; 262 263 std::map<int, StdSize>::const_iterator itbMap = mapBufferSize_.begin(), 264 iteMap = mapBufferSize_.end(), itMap; 265 StdSize totalBuf = 0; 266 for (itMap = itbMap; itMap != iteMap; ++itMap) 267 { 268 report(10)<< " Memory report : Context <"<<context->getId()<<"> : client side : memory used for buffer of each connection to server" << endl 269 << " +)To server with rank " << itMap->first << " : " << itMap->second << " bytes " << endl; 270 totalBuf += itMap->second; 271 } 272 report(0)<< " Memory report : Context <"<<context->getId()<<"> : client side : total memory used for buffer "<<totalBuf<<" bytes"<<endl ; 243 273 244 274 releaseBuffers() ; -
XIOS/trunk/src/context_client.hpp
r509 r511 16 16 17 17 public: 18 CContextClient(CContext* parent,MPI_Comm intraComm, MPI_Comm interComm ) ;18 CContextClient(CContext* parent,MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer = 0) ; 19 19 // void registerEvent(CEventClient& event) ; 20 20 … … 48 48 private: 49 49 std::map<int, StdSize> mapBufferSize_; 50 CContext* parentServer; 50 51 // bool locked ; 51 52 -
XIOS/trunk/src/context_server.cpp
r509 r511 83 83 StdSize buffSize = 0; 84 84 MPI_Recv(&buffSize, 1, MPI_LONG, rank, 20, interComm, &status); 85 mapBufferSize_.insert(std::make_pair(rank, buffSize)); 85 86 it=(buffers.insert(pair<int,CServerBuffer*>(rank,new CServerBuffer(buffSize)))).first ; 86 87 } … … 207 208 { 208 209 info(20)<<"Server Side context <"<<context->getId()<<"> finalized"<<endl ; 210 std::map<int, StdSize>::const_iterator itbMap = mapBufferSize_.begin(), 211 iteMap = mapBufferSize_.end(), itMap; 212 StdSize totalBuf = 0; 213 for (itMap = itbMap; itMap != iteMap; ++itMap) 214 { 215 report(10)<< " Memory report : Context <"<<context->getId()<<"> : server side : memory used for buffer of each connection to client" << endl 216 << " +) With client of rank " << itMap->first << " : " << itMap->second << " bytes " << endl; 217 totalBuf += itMap->second; 218 } 209 219 context->finalize() ; 210 220 finished=true ; 211 report(0)<< " Memory report : Context <"<<context->getId()<<"> : server side : total memory used for buffer "<< buffers.size()*CXios::bufferSize<<" bytes"<<endl ;221 report(0)<< " Memory report : Context <"<<context->getId()<<"> : server side : total memory used for buffer "<<totalBuf<<" bytes"<<endl ; 212 222 } 213 223 else if (event.classId==CContext::GetType()) CContext::dispatchEvent(event) ; -
XIOS/trunk/src/context_server.hpp
r501 r511 9 9 { 10 10 class CContext ; 11 11 12 12 class CContextServer 13 13 { 14 14 public: 15 15 16 16 CContextServer(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; 17 17 bool eventLoop(void) ; … … 23 23 void setPendingEvent(void) ; 24 24 bool hasPendingEvent(void) ; 25 25 26 26 MPI_Comm intraComm ; 27 27 int intraCommSize ; 28 28 int intraCommRank ; 29 29 30 30 MPI_Comm interComm ; 31 31 int commSize ; 32 32 33 33 map<int,CServerBuffer*> buffers ; 34 34 map<int,MPI_Request> pendingRequest ; 35 35 map<int,char*> bufferRequest ; 36 36 37 37 map<size_t,CEventServer*> events ; 38 38 size_t currentTimeLine ; 39 39 CContext* context ; 40 40 41 41 bool finished ; 42 42 bool pendingEvent ; 43 43 bool scheduled ; /*!< event of current timeline is alreading scheduled ? */ 44 44 size_t hashId ; 45 ~CContextServer() ; 45 ~CContextServer() ; 46 47 private: 48 std::map<int, StdSize> mapBufferSize_; 46 49 } ; 47 50 -
XIOS/trunk/src/cxios.cpp
r509 r511 29 29 bool CXios::printInfo2File; 30 30 bool CXios::isServerSide; 31 31 bool CXios::isOptPerformance = true; 32 32 33 33 void CXios::initialize() … … 35 35 set_new_handler(noMemory); 36 36 parseFile(rootFile); 37 parseXiosConfig(); 38 } 39 40 void CXios::parseXiosConfig() 41 { 37 42 usingOasis=getin<bool>("using_oasis",false) ; 38 43 usingServer=getin<bool>("using_server",false) ; 39 44 info.setLevel(getin<int>("info_level",0)) ; 45 report.setLevel(getin<int>("info_level",0)); 40 46 printInfo2File=getin<bool>("print_file",false); 41 47 bufferSize=getin<size_t>("buffer_size",defaultBufferSize) ; 42 bufferServerFactorSize=getin<double>("buffer_server_factor_size",defaultBufferServerFactorSize) ; 48 StdString bufMemory("memory"); 49 StdString bufPerformance("performance"); 50 StdString bufOpt = getin<StdString>("optimal_buffer_size", bufPerformance); 51 std::transform(bufOpt.begin(), bufOpt.end(), bufOpt.begin(), ::tolower); 52 if (0 == bufOpt.compare(bufMemory)) isOptPerformance = false; 53 else if (0 != bufOpt.compare(bufPerformance)) 54 { 55 ERROR("CXios::parseXiosConfig()", << "optimal_buffer_size must be memory or performance "<< endl ); 56 } 57 58 // bufferServerFactorSize=getin<double>("buffer_server_factor_size",defaultBufferServerFactorSize) ; 59 bufferServerFactorSize=getin<double>("buffer_factor_size",defaultBufferServerFactorSize) ; 43 60 globalComm=MPI_COMM_WORLD ; 44 61 } 45 46 62 47 63 void CXios::initClientSide(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm) … … 79 95 parseList.insert("xios"); 80 96 xml::CXMLParser::ParseFile(rootFile, parseList); 81 // parseFile(rootFile); 82 usingOasis=getin<bool>("using_oasis",false) ; 83 info.setLevel(getin<int>("info_level",0)) ; 84 printInfo2File=getin<bool>("print_file",false); 85 bufferSize=getin<size_t>("buffer_size",defaultBufferSize) ; 86 bufferServerFactorSize=getin<double>("buffer_server_factor_size",defaultBufferServerFactorSize) ; 87 globalComm=MPI_COMM_WORLD ; 88 97 parseXiosConfig(); 89 98 } 90 99 -
XIOS/trunk/src/cxios.hpp
r509 r511 42 42 static double bufferServerFactorSize ; 43 43 static double defaultBufferServerFactorSize ; 44 static bool isOptPerformance; 44 45 45 46 public: … … 54 55 55 56 static void initServer(); 57 58 private: 59 static void parseXiosConfig(); 56 60 57 61 } ; -
XIOS/trunk/src/node/context.cpp
r510 r511 23 23 CContext::CContext(void) 24 24 : CObjectTemplate<CContext>(), CContextAttributes() 25 , calendar(),hasClient(false),hasServer(false), isPostProcessed(false), dataSize_() 25 , calendar(),hasClient(false),hasServer(false), isPostProcessed(false), dataSize_(), idServer_() 26 26 { /* Ne rien faire de plus */ } 27 27 28 28 CContext::CContext(const StdString & id) 29 29 : CObjectTemplate<CContext>(id), CContextAttributes() 30 , calendar(),hasClient(false),hasServer(false), isPostProcessed(false), dataSize_() 30 , calendar(),hasClient(false),hasServer(false), isPostProcessed(false), dataSize_(), idServer_() 31 31 { /* Ne rien faire de plus */ } 32 32 … … 280 280 281 281 //! Initialize client side 282 void CContext::initClient(MPI_Comm intraComm, MPI_Comm interComm )282 void CContext::initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer) 283 283 { 284 284 hasClient=true ; 285 client = new CContextClient(this,intraComm, interComm ) ;285 client = new CContextClient(this,intraComm, interComm, cxtServer) ; 286 286 } 287 287 … … 575 575 { 576 576 CMessage msg ; 577 msg<<this->getId () ;577 msg<<this->getIdServer() ; 578 578 event.push(client->getServerLeader(),1,msg) ; 579 579 client->sendEvent(event) ; … … 601 601 { 602 602 CMessage msg ; 603 msg<<this->getId ()<<step ;603 msg<<this->getIdServer()<<step ; 604 604 event.push(client->getServerLeader(),1,msg) ; 605 605 client->sendEvent(event) ; … … 634 634 { 635 635 CMessage msg ; 636 msg<<this->getId () ;636 msg<<this->getIdServer() ; 637 637 event.push(client->getServerLeader(),1,msg) ; 638 638 client->sendEvent(event) ; … … 665 665 { 666 666 CMessage msg ; 667 msg<<this->getId ();667 msg<<this->getIdServer(); 668 668 event.push(client->getServerLeader(),1,msg) ; 669 669 client->sendEvent(event) ; … … 686 686 { 687 687 postProcessing(); 688 } 689 690 const StdString& CContext::getIdServer() 691 { 692 if (hasClient) 693 { 694 idServer_ = this->getId(); 695 idServer_ += "_server"; 696 return idServer_; 697 } 698 if (hasServer) return (this->getId()); 688 699 } 689 700 … … 736 747 else 737 748 { 749 std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end(); 738 750 if (domainIds.find(prDomAxisId.first) == domainIds.end()) 739 751 { 740 std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end();741 752 for (; it != itE; ++it) 742 753 { … … 744 755 else dataSize_.insert(make_pair(it->first, it->second)); 745 756 } 757 } else 758 { 759 for (; it != itE; ++it) 760 { 761 if (0 < dataSize_.count(it->first)) 762 if (CXios::isOptPerformance) dataSize_[it->first] += it->second; 763 else 764 { 765 if (dataSize_[it->first] < it->second) dataSize_[it->first] = it->second; 766 } 767 else dataSize_.insert(make_pair(it->first, it->second)); 768 } 746 769 } 747 748 770 } 749 750 771 } 751 772 } -
XIOS/trunk/src/node/context.hpp
r509 r511 88 88 // Initialize server or client 89 89 void initServer(MPI_Comm intraComm, MPI_Comm interComm) ; 90 void initClient(MPI_Comm intraComm, MPI_Comm interComm ) ;90 void initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer=0) ; 91 91 bool isInitialized(void) ; 92 92 … … 129 129 void sendPostProcessing(); 130 130 131 const StdString& getIdServer(); 132 131 133 // Client side: Receive and process messages 132 134 static void recvUpdateCalendar(CEventServer& event) ; … … 206 208 bool isPostProcessed; 207 209 std::map<int, StdSize> dataSize_; 210 StdString idServer_; 208 211 209 212 -
XIOS/trunk/src/node/grid.cpp
r510 r511 177 177 if (this->withAxis) retVal *= this->axis->size.getValue(); 178 178 retVal *= sizeof(double); 179 retVal *= 1.2 ; // Secure factor179 retVal *= 1.2 * CXios::bufferServerFactorSize; // Secure factor 180 180 ret.insert(make_pair(it->first, retVal)); 181 181 } -
XIOS/trunk/src/object.cpp
r501 r511 20 20 { /* Ne rien faire de plus */ } 21 21 22 const StdString & CObject::getId(void) const 23 { 22 const StdString & CObject::getId(void) const 23 { 24 24 return (this->id); 25 25 } 26 26 27 bool CObject::hasId(void) const 28 { 27 const StdString& CObject::getIdServer() 28 { 29 return (this->id); 30 } 31 32 bool CObject::hasId(void) const 33 { 29 34 return (this->IdDefined); 30 35 } 31 36 32 void CObject::resetId(void) 33 { 37 void CObject::resetId(void) 38 { 34 39 this->IdDefined = false ; 35 40 } 36 41 37 42 void CObject::setId(const StdString & id) 38 { 43 { 39 44 this->id = id ; 40 45 this->IdDefined = true ; … … 49 54 50 55 bool CObject::operator!=(const CObject & other) const 51 { 56 { 52 57 return (!(*this == other)); 53 58 } 54 59 */ 55 60 StdOStream & operator << (StdOStream & os, const CObject & object) 56 { 61 { 57 62 os << object.toString(); 58 63 return (os); -
XIOS/trunk/src/object.hpp
r501 r511 18 18 /// Accesseurs /// 19 19 const StdString & getId(void) const; 20 21 virtual const StdString& getIdServer(); 20 22 21 23 /// Mutateurs /// -
XIOS/trunk/src/object_template_impl.hpp
r509 r511 193 193 { 194 194 CMessage msg ; 195 msg<<this->getId() ; 195 // msg<<this->getId() ; 196 msg<<this->getIdServer(); 196 197 msg<<attr.getName() ; 197 198 msg<<attr ;
Note: See TracChangeset
for help on using the changeset viewer.