Changeset 512
- Timestamp:
- 11/14/14 17:56:37 (10 years ago)
- Location:
- XIOS/trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/inputs/COMPLETE/context_surface.xml
r509 r512 7 7 <field id="field_A_srf_K" name="field_A_srf_K" field_ref="field_A_srf" long_name="Champ en degK" unit="degK"> field_A_srf + 273.15 </field> 8 8 <field id="field_A_srf_max" name="field_A_srf_max" field_ref="field_A_srf" long_name="maximum field_A_srf" operation="maximum" /> 9 <field id="field_D_srf" name="field_D_srf" long_name="Somme champ A et C" > field_A_srf + field_ A_srf_K</field>9 <field id="field_D_srf" name="field_D_srf" long_name="Somme champ A et C" > field_A_srf + field_C_srf </field> 10 10 11 11 </field_definition> … … 17 17 <variable id="my_attribute2" type="integer" > 10 </variable> 18 18 <variable id="my_attribute3" type="float" >6.8</variable> 19 <variable id="my_attribute 4" type="double" >100.201</variable>19 <variable id="my_attribute5" type="double" >100.201</variable> 20 20 </field> 21 21 <field field_ref="field_A_srf_K" /> … … 31 31 <variable id="my_attribute1" type="string" >surf_att</variable> 32 32 <variable id="my_attribute2" type="integer" >10</variable> 33 <variable id="my_attribute3" type="float" > 7.8</variable>33 <variable id="my_attribute3" type="float" >6.8</variable> 34 34 <variable id="my_attribute4" type="double" >100.201</variable> 35 35 </field> 36 <field field_ref="field_D_srf" />37 36 <field field_ref="field_A_srf_K" /> 38 37 <field field_ref="field_A_srf" name="field_A_srf_min" operation="minimum" /> -
XIOS/trunk/inputs/COMPLETE/iodef.xml
r491 r512 9 9 <variable_definition> 10 10 <variable_group id="buffer"> 11 buffer_size = 8000000012 buffer_server_factor_size = 211 <variable id="optimal_buffer_size" type="string">memory</variable> 12 <variable id="buffer_factor_size" type="double">1.0</variable> 13 13 </variable_group> 14 14 -
XIOS/trunk/inputs/iodef.xml
r511 r512 10 10 11 11 12 <file_definition type=" one_file" par_access="collective" output_freq="6h" output_level="10" enabled=".TRUE.">12 <file_definition type="multiple_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" /> … … 47 47 <variable_group id="parameters" > 48 48 <variable id="using_server" type="boolean">false</variable> 49 <variable id="info_level" type="int"> 10</variable>49 <variable id="info_level" type="int">50</variable> 50 50 <variable id="print_file" type="boolean">true</variable> 51 51 </variable_group> -
XIOS/trunk/src/buffer_client.cpp
r509 r512 46 46 if (size>bufferSize) ERROR("CClientBuffer::hasSpace(int size)", 47 47 <<"request size is too big for buffer, increase buffer client size"<<endl 48 <<"Current buffer_size : "<<CXios::bufferSize<<endl49 48 <<"buffer_size must be > "<<size*2<<endl) 50 49 -
XIOS/trunk/src/buffer_client.hpp
r509 r512 16 16 public: 17 17 18 CClientBuffer(MPI_Comm intercomm,int serverRank, StdSize bfSize = CXios::bufferSize) ;18 CClientBuffer(MPI_Comm intercomm,int serverRank, StdSize bfSize = 0) ; 19 19 ~CClientBuffer() ; 20 20 bool isBufferFree(int size) ; -
XIOS/trunk/src/buffer_server.hpp
r509 r512 15 15 public: 16 16 17 CServerBuffer(StdSize bufSize = CXios::bufferSize) ;17 CServerBuffer(StdSize bufSize) ; 18 18 ~CServerBuffer() ; 19 19 char* buffer ; -
XIOS/trunk/src/context_client.cpp
r511 r512 15 15 namespace xios 16 16 { 17 18 17 /*! 18 \param [in] parent Pointer to context on client side 19 \param [in] intraComm_ communicator of group client 20 \param [in] interComm_ communicator of group server 21 \cxtSer [in] cxtSer Pointer to context of server side. (It is only used on case of attached mode) 22 */ 19 23 CContextClient::CContextClient(CContext* parent,MPI_Comm intraComm_, MPI_Comm interComm_, CContext* cxtSer) 20 24 : mapBufferSize_(), parentServer(cxtSer) … … 35 39 } 36 40 37 41 /*! 42 In case of attached mode, the current context must be reset to context for client 43 \param [in] event Event sent to server 44 */ 38 45 void CContextClient::sendEvent(CEventClient& event) 39 46 { … … 72 79 } 73 80 81 /*! 82 Special function to setup size of buffer not only on client side but also on server side 83 corresponding to the connection 84 */ 74 85 void CContextClient::sendBufferSizeEvent() 75 86 { … … 81 92 <<"No information about server buffer, that should not happen..."); 82 93 83 for (; itMap != iteMap; ++it eMap)94 for (; itMap != iteMap; ++itMap) 84 95 { 85 96 if (buffers.end() == buffers.find(itMap->first)) … … 97 108 } 98 109 110 /*! 111 If client is also server (attached mode), after sending event, it should process right away 112 the incoming event. 113 \param [in] ranks list rank of server connected this client 114 */ 99 115 void CContextClient::waitEvent(list<int>& ranks) 100 116 { … … 122 138 parentServer->server->eventLoop() ; 123 139 } 124 125 140 } 126 141 142 /*! 143 Setup buffer for each connection to server and verify their state to put content into them 144 \param [in] serverList list of rank of connected server 145 \param [in] sizeList size of message corresponding to each connection 146 \return List of buffer input which event can be placed 147 */ 127 148 list<CBufferOut*> CContextClient::getBuffers(list<int>& serverList, list<int>& sizeList) 128 149 { … … 166 187 } 167 188 189 /*! 190 Make a new buffer for a certain connection to server with specific rank 191 \param [in] rank rank of connected server 192 */ 168 193 void CContextClient::newBuffer(int rank) 169 194 { 170 // buffers[rank]=new CClientBuffer(interComm,rank);171 195 buffers[rank]=new CClientBuffer(interComm,rank, mapBufferSize_[rank]) ; 172 196 } 173 197 198 /*! 199 Verify state of buffers. Buffer is under pending state if there is no message on it 200 \return state of buffers, pending(true), ready(false) 201 */ 174 202 bool CContextClient::checkBuffers(void) 175 203 { … … 180 208 } 181 209 210 //! Release all buffers 182 211 void CContextClient::releaseBuffers(void) 183 212 { … … 186 215 } 187 216 217 /*! 218 Verify state of buffers corresponding to a connection 219 \param [in] ranks list rank of server to which client connects to 220 \return state of buffers, pending(true), ready(false) 221 */ 188 222 bool CContextClient::checkBuffers(list<int>& ranks) 189 223 { … … 194 228 } 195 229 230 /*! 231 Set buffer size for each connection 232 \param [in] mapSize mapping rank of connected server to size of allocated buffer 233 */ 196 234 void CContextClient::setBufferSize(const std::map<int, StdSize>& mapSize) 197 235 { … … 200 238 } 201 239 240 /*! 241 Get leading server in the group of connected server 242 \return rank of leading server 243 */ 202 244 int CContextClient::getServerLeader(void) 203 245 { … … 217 259 } 218 260 261 /*! 262 Check if client connects to leading server 263 \return connected(true), not connected (false) 264 */ 219 265 bool CContextClient::isServerLeader(void) 220 266 { … … 236 282 } 237 283 284 /*! 285 Finalize context client and do some reports 286 */ 238 287 void CContextClient::finalize(void) 239 288 { 240 241 289 map<int,CClientBuffer*>::iterator itBuff ; 242 290 bool stop=true ; … … 259 307 } 260 308 CTimer::get("Blocking time").suspend(); 261 // report(0)<< " Memory report : Context <"<<context->getId()<<"> : client side : total memory used for buffer "<<buffers.size()*CXios::bufferSize<<" bytes"<<endl ;262 309 263 310 std::map<int, StdSize>::const_iterator itbMap = mapBufferSize_.begin(), … … 267 314 { 268 315 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;316 << " +) To server with rank " << itMap->first << " : " << itMap->second << " bytes " << endl; 270 317 totalBuf += itMap->second; 271 318 } -
XIOS/trunk/src/context_client.hpp
r511 r512 12 12 class CContext ; 13 13 14 /*! 15 \class CContextClient 16 A context can be both on client and on server side. In order to differenciate the role of 17 context on each side, e.x client sending events, server receiving and processing events, there is a need of 18 concrete "context" classes for both sides. 19 CContextClient processes and sends events from client to server where CContextServer receives these events 20 and processes them. 21 */ 14 22 class CContextClient 15 23 { 24 public: 25 // Contructor 26 CContextClient(CContext* parent,MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer = 0) ; 16 27 17 public:18 CContextClient(CContext* parent,MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer = 0) ;19 // void registerEvent(CEventClient& event) ;28 // Send event to server 29 void sendEvent(CEventClient& event) ; 30 void waitEvent(list<int>& ranks) ; 20 31 21 // list<CBufferOut*> newEvent(CEventClient& event,list<int>& sizes) ; 22 void sendEvent(CEventClient& event) ; 23 32 // Functions relates to set/get buffers 24 33 list<CBufferOut*> getBuffers(list<int>& serverlist, list<int>& sizeList) ; 25 34 void newBuffer(int rank) ; 26 size_t timeLine ;27 int clientRank ;28 int clientSize ;29 int serverSize ;30 // set<int> connectedServer ;31 MPI_Comm interComm ;32 MPI_Comm intraComm ;33 map<int,CClientBuffer*> buffers ;34 35 bool checkBuffers(list<int>& ranks) ; 35 36 bool checkBuffers(void); 36 37 void releaseBuffers(void); 37 void closeContext(void) ; 38 38 39 bool isServerLeader(void) ; 39 40 int getServerLeader(void) ; 41 42 // Close and finalize context client 43 void closeContext(void) ; 40 44 void finalize(void) ; 41 void waitEvent(list<int>& ranks) ;42 45 43 46 void setBufferSize(const std::map<int, StdSize>& mapSize); 44 47 void sendBufferSizeEvent(); 45 48 46 CContext* context ; 49 public: 50 CContext* context ; //!< Context for client 51 52 size_t timeLine ; //!< Timeline of each event 53 54 int clientRank ; //!< Rank of current client 55 56 int clientSize ; //!< Size of client group 57 58 int serverSize ; //!< Size of server group 59 60 MPI_Comm interComm ; //!< Communicator of server group 61 62 MPI_Comm intraComm ; //!< Communicator of client group 63 64 map<int,CClientBuffer*> buffers ; //!< Buffers for connection to servers 47 65 48 66 private: 49 std::map<int, StdSize> mapBufferSize_; 50 CContext* parentServer; 67 //! Mapping of server and buffer size for each connection to server 68 std::map<int, StdSize> mapBufferSize_; 69 70 //! Context for server (Only used in attached mode) 71 CContext* parentServer; 72 73 public: // Some function should be removed in the future 74 // void registerEvent(CEventClient& event) ; 75 // list<CBufferOut*> newEvent(CEventClient& event,list<int>& sizes) ; 51 76 // bool locked ; 77 // set<int> connectedServer ; 52 78 53 79 } ; 54 55 56 57 58 80 } 59 81 60 61 62 #endif 82 #endif // __CONTEXT_CLIENT_HPP__ -
XIOS/trunk/src/cxios.cpp
r511 r512 23 23 bool CXios::usingOasis ; 24 24 bool CXios::usingServer = false; 25 size_t CXios::bufferSize ; 26 double CXios::bufferServerFactorSize=2 ; 27 size_t CXios::defaultBufferSize=1024*1024*100 ; // 100Mo 28 double CXios::defaultBufferServerFactorSize=2 ; 25 double CXios::bufferServerFactorSize=1.0 ; 26 double CXios::defaultBufferServerFactorSize=1.0 ; 29 27 bool CXios::printInfo2File; 30 28 bool CXios::isServerSide; 31 29 bool CXios::isOptPerformance = true; 32 30 31 //! Parse configuration file and create some objects from it 33 32 void CXios::initialize() 34 33 { … … 38 37 } 39 38 39 /*! 40 \brief Parse xios part of configuration file (.iodef.xml) 41 Both client and server need information returned from this function 42 */ 40 43 void CXios::parseXiosConfig() 41 44 { … … 43 46 usingServer=getin<bool>("using_server",false) ; 44 47 info.setLevel(getin<int>("info_level",0)) ; 45 report.setLevel(getin<int>("info_level", 0));48 report.setLevel(getin<int>("info_level",50)); 46 49 printInfo2File=getin<bool>("print_file",false); 47 bufferSize=getin<size_t>("buffer_size",defaultBufferSize) ; 50 48 51 StdString bufMemory("memory"); 49 52 StdString bufPerformance("performance"); … … 56 59 } 57 60 58 // bufferServerFactorSize=getin<double>("buffer_server_factor_size",defaultBufferServerFactorSize) ;59 61 bufferServerFactorSize=getin<double>("buffer_factor_size",defaultBufferServerFactorSize) ; 60 62 globalComm=MPI_COMM_WORLD ; 61 63 } 62 64 65 /*! 66 Initialize client 67 \param [in] codeId identity of context 68 \param [in] localComm local communicator 69 \param [in/out] returnComm communicator corresponding to group of client with same codeId 70 */ 63 71 void CXios::initClientSide(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm) 64 72 { … … 89 97 } 90 98 99 //! Init server by parsing only xios part of config file 91 100 void CXios::initServer() 92 101 { … … 98 107 } 99 108 109 //! Initialize server then put it into listening state 100 110 void CXios::initServerSide(void) 101 111 { 102 // initialize();103 112 initServer(); 104 113 isClient=true; … … 123 132 } 124 133 134 //! Parse configuration file 125 135 void CXios::parseFile(const string& filename) 126 136 { … … 128 138 } 129 139 140 //! Set using server 130 141 void CXios::setUsingServer() 131 142 { … … 133 144 } 134 145 146 //! Unset using server 135 147 void CXios::setNotUsingServer() 136 148 { -
XIOS/trunk/src/cxios.hpp
r511 r512 7 7 namespace xios 8 8 { 9 /*! 10 \class CXios 11 */ 9 12 class CXios 10 13 { 11 public: 12 13 static string rootFile ; 14 static string xiosCodeId ; 15 static string clientFile; 16 static string serverFile; 17 14 public: 18 15 static void initialize(void) ; 19 20 21 16 static void initClientSide(const string & codeId, MPI_Comm& localComm, MPI_Comm& returnComm) ; 22 17 static void initServerSide(void) ; … … 30 25 static T getin(const string& id) ; 31 26 32 static bool isClient ; 33 static bool isServer ; 27 public: 28 static string rootFile ; //!< Configuration filename 29 static string xiosCodeId ; //!< Identity for XIOS 30 static string clientFile; //!< Filename template for client 31 static string serverFile; //!< Filename template for server 34 32 35 static MPI_Comm globalComm ; 33 static bool isClient ; //!< Check if xios is client 34 static bool isServer ; //!< Check if xios is server 36 35 37 static bool printInfo2File; 38 static bool usingOasis ; 39 static bool usingServer ; 40 static size_t bufferSize ; 41 static size_t defaultBufferSize ; 42 static double bufferServerFactorSize ; 43 static double defaultBufferServerFactorSize ; 44 static bool isOptPerformance; 36 static MPI_Comm globalComm ; //!< Global communicator 45 37 46 public: 38 static bool printInfo2File; //!< Printing out information into file 39 static bool usingOasis ; //!< Using Oasis 40 static bool usingServer ; //!< Using server (server mode) 41 static double bufferServerFactorSize ; //!< Factor helps tune buffer size 42 static double defaultBufferServerFactorSize ; //!< Default factor value 43 static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible) 44 45 public: 47 46 //! Setting xios to use server mode 48 47 static void setUsingServer(); … … 54 53 static bool isServerSide; 55 54 55 //! Initialize server (if any) 56 56 static void initServer(); 57 57 58 private: 58 private: 59 //! Parse only Xios part of configuration file 59 60 static void parseXiosConfig(); 60 61 61 } ; 62 63 62 } 64 63 65 64 //#include "cxios_impl.hpp" 66 67 68 69 70 71 72 73 74 75 #endif 65 #endif // __XIOS_HPP__
Note: See TracChangeset
for help on using the changeset viewer.