Changeset 1128 for XIOS/dev/branch_yushan/src/client.cpp
- Timestamp:
- 05/11/17 16:12:23 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan/src/client.cpp
r1126 r1128 11 11 #include "timer.hpp" 12 12 #include "buffer_client.hpp" 13 #include "log.hpp" 14 13 15 14 16 namespace xios 15 17 { 18 extern int test_omp_rank; 19 #pragma omp threadprivate(test_omp_rank) 16 20 17 21 MPI_Comm CClient::intraComm ; … … 24 28 StdOFStream CClient::m_errorStream; 25 29 30 StdOFStream CClient::array_infoStream[10]; 31 26 32 void CClient::initialize(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm) 27 33 { … … 103 109 MPI_Comm_size(intraComm,&intraCommSize) ; 104 110 MPI_Comm_rank(intraComm,&intraCommRank) ; 111 105 112 #pragma omp critical(_output) 106 113 { 107 info( 50)<<"intercommCreate::client "<<rank<<" intraCommSize : "<<intraCommSize114 info(10)<<"intercommCreate::client "<<test_omp_rank<< " "<< &test_omp_rank <<" intraCommSize : "<<intraCommSize 108 115 <<" intraCommRank :"<<intraCommRank<<" serverLeader "<< serverLeader 109 116 <<" globalComm : "<< &(CXios::globalComm) << endl ; 110 117 } 118 119 111 120 112 121 MPI_Intercomm_create(intraComm,0,CXios::globalComm,serverLeader,0,&interComm) ; … … 162 171 MPI_Comm_dup(intraComm,&returnComm) ; 163 172 173 174 164 175 } 165 176 … … 167 178 void CClient::registerContext(const string& id,MPI_Comm contextComm) 168 179 { 169 //#pragma omp critical(_output)170 //info(50) << "Client "<<getRank() << " start registerContext using info output" << endl;171 180 172 181 CContext::setCurrent(id) ; … … 175 184 int tmp_rank; 176 185 MPI_Comm_rank(contextComm,&tmp_rank) ; 177 178 // #pragma omp critical (_output)179 //printf("Client %d : client.cpp Client::registerContext %s context add = %p\n", tmp_rank, id, &(*context));180 181 186 182 187 StdString idServer(id); … … 214 219 MPI_Intercomm_create(contextComm,0,CXios::globalComm,serverLeader,10+globalRank,&contextInterComm) ; 215 220 216 //#pragma omp critical(_output)217 //info(10)<<"Register new Context : "<<id<<endl ;218 221 #pragma omp critical(_output) 222 info(10)<<" RANK "<< tmp_rank<<" Register new Context : "<<id<<endl ; 223 219 224 220 225 MPI_Comm inter ; … … 224 229 225 230 context->initClient(contextComm,contextInterComm) ; 226 227 // #pragma omp critical (_output) 228 // printf("Client %d : context->initClient(contextComm,contextInterComm) OK \n", getRank()) ; 229 230 //contextInterComms->push_back(contextInterComm); 231 232 231 233 if(contextInterComms_ptr == NULL) contextInterComms_ptr = new std::list<MPI_Comm>; 232 234 contextInterComms_ptr->push_back(contextInterComm); … … 251 253 if(contextInterComms_ptr == NULL) contextInterComms_ptr = new std::list<MPI_Comm>; 252 254 contextInterComms_ptr->push_back(contextInterComm); 253 //contextInterComms->push_back(contextInterComm); 255 254 256 } 255 257 } … … 286 288 } 287 289 288 289 //info(20) << "Client "<<rank<<" : Client side context is finalized "<< endl ; 290 // report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ; 291 // report(0)<< " Performance report : time spent for waiting free buffer : "<< CTimer::get("Blocking time").getCumulatedTime()<<" s"<<endl ; 292 // report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS").getCumulatedTime()*100.<<" %"<<endl ; 293 // 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 ; 294 // // report(0)<< " Memory report : Current buffer_size : "<<CXios::bufferSize<<endl ; 295 // report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ; 296 // 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 ; 297 298 290 #pragma omp critical (_output) 291 info(20) << "Client "<<rank<<" : Client side context is finalized "<< endl ; 292 293 /* #pragma omp critical (_output) 294 { 295 report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ; 296 report(0)<< " Performance report : time spent for waiting free buffer : "<< CTimer::get("Blocking time").getCumulatedTime()<<" s"<<endl ; 297 report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS").getCumulatedTime()*100.<<" %"<<endl ; 298 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 ; 299 report(0)<< " Memory report : Current buffer_size : "<<CXios::bufferSize<<endl ; 300 report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ; 301 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 ; 302 } 303 */ 299 304 } 300 305 … … 325 330 326 331 fileNameClient << fileName << "_" << std::setfill('0') << std::setw(numDigit) << getRank() << ext; 327 //printf("getrank() = %d, file name = %s\n", getRank(), fileNameClient.str().c_str()); 328 329 fb->open(fileNameClient.str().c_str(), std::ios::out); 330 if (!fb->is_open()) 331 ERROR("void CClient::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)", 332 << std::endl << "Can not open <" << fileNameClient << "> file to write the client log(s)."); 332 333 fb->open(fileNameClient.str().c_str(), std::ios::out); 334 if (!fb->is_open()) 335 ERROR("void CClient::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)", 336 << std::endl << "Can not open <" << fileNameClient << "> file to write the client log(s)."); 333 337 334 338 … … 343 347 void CClient::openInfoStream(const StdString& fileName) 344 348 { 345 std::filebuf* fb = m_infoStream.rdbuf(); 346 openStream(fileName, ".out", fb); 347 348 info.write2File(fb); 349 report.write2File(fb); 349 //std::filebuf* fb = m_infoStream.rdbuf(); 350 351 info_FB[omp_get_thread_num()] = array_infoStream[omp_get_thread_num()].rdbuf(); 352 353 openStream(fileName, ".out", info_FB[omp_get_thread_num()]); 354 355 info.write2File(info_FB[omp_get_thread_num()]); 356 report.write2File(info_FB[omp_get_thread_num()]); 357 350 358 } 351 359
Note: See TracChangeset
for help on using the changeset viewer.