Ignore:
Timestamp:
05/11/17 16:12:23 (7 years ago)
Author:
yushan
Message:

log OK with threads

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan/src/cxios.cpp

    r1126 r1128  
    1414namespace xios 
    1515{ 
     16 
     17  extern int test_omp_rank; 
     18  #pragma omp threadprivate(test_omp_rank) 
     19 
    1620  const string CXios::rootFile="./iodef.xml" ; 
    1721  const string CXios::xiosCodeId="xios.x" ; 
    1822  const string CXios::clientFile="./xios_client"; 
    1923  const string CXios::serverFile="./xios_server"; 
    20   //#pragma omp threadprivate(CXios::rootFile, CXios::xiosCodeId, CXios::clientFile, CXios::serverFile) 
     24 
    2125 
    2226  bool CXios::isClient ; 
    2327  bool CXios::isServer ; 
    24   //#pragma omp threadprivate(CXios::isServer, CXios::isClient) 
     28 
    2529 
    2630  MPI_Comm CXios::globalComm ; 
    27   //#pragma omp threadprivate(CXios::globalComm) 
     31 
    2832   
    2933  bool CXios::usingOasis ; 
    3034  bool CXios::usingServer = false; 
    31  // #pragma omp threadprivate(CXios::usingOasis, CXios::usingServer) 
     35 
    3236 
    3337  double CXios::bufferSizeFactor = 1.0; 
    3438  const double CXios::defaultBufferSizeFactor = 1.0; 
    3539  StdSize CXios::minBufferSize = 1024 * sizeof(double); 
    36   //#pragma omp threadprivate(CXios::bufferSizeFactor, CXios::defaultBufferSizeFactor, CXios::minBufferSize) 
     40 
    3741 
    3842  bool CXios::printLogs2Files; 
    3943  bool CXios::isOptPerformance = true; 
    4044  CRegistry* CXios::globalRegistry = 0; 
    41   //#pragma omp threadprivate(CXios::printLogs2Files, CXios::isOptPerformance) 
     45 
    4246 
    4347 
     
    4650  {     
    4751    set_new_handler(noMemory); 
     52     
    4853     
    4954    #pragma omp critical 
     
    8085    bufferSizeFactor = getin<double>("buffer_size_factor", defaultBufferSizeFactor); 
    8186    minBufferSize = getin<int>("min_buffer_size", 1024 * sizeof(double)); 
     87 
    8288  
    8389    int num_ep; 
     
    8591    {  
    8692      num_ep = omp_get_num_threads(); 
    87       //printf("Client %d: num_ep = %d\n", omp_get_thread_num(), num_ep); 
    8893    } 
    8994     
     
    9196    {  
    9297      num_ep = omp_get_num_threads(); 
    93       //printf("Server %d: num_ep = %d\n", omp_get_thread_num(), num_ep);  
    9498    } 
    9599     
     
    109113    int tmp_rank; 
    110114    MPI_Comm_rank(CXios::globalComm, &tmp_rank); 
    111     if(isClient) printf("client thread %d/%d, globalComm = %p, passage = %p\n",  
    112                          omp_get_thread_num(), tmp_rank,  
    113                          &(CXios::globalComm), passage); 
    114     //if(isServer) printf("server thread %d/%d, globalComm = %p\n", omp_get_thread_num(), tmp_rank, &globalComm); 
     115 
     116     
     117    test_omp_rank = tmp_rank; 
    115118     
    116119  } 
     
    136139    isServer = !usingServer; 
    137140     
    138     //printf("CXios::initClientSide OK, printLogs2Files = %d\n", printLogs2Files); 
    139      
    140141    if (printLogs2Files) 
    141142    { 
     143      #pragma omp critical 
    142144      CClient::openInfoStream(clientFile); 
    143       //CClient::openErrorStream(clientFile); 
     145      CClient::openErrorStream(clientFile); 
    144146    } 
    145147    else 
     
    157159     if (CClient::getRank()==0) 
    158160     { 
    159        //info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ; 
     161       #pragma omp critical (_output) 
     162       info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ; 
    160163       globalRegistry->toFile("xios_registry.bin") ; 
    161164       delete globalRegistry ; 
    162165     } 
    163166     CClient::closeInfoStream(); 
     167 
    164168   
    165169 
     
    189193 
    190194    xml::CXMLParser::ParseFile(rootFile, parseList); 
    191  
     195     
    192196    parseXiosConfig(); 
    193197  } 
Note: See TracChangeset for help on using the changeset viewer.