Ignore:
Timestamp:
03/14/17 19:12:25 (7 years ago)
Author:
yushan
Message:

Using threads : modif for xios_initialize

File:
1 edited

Legend:

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

    r1070 r1072  
    3939          if (!is_MPI_Initialized) 
    4040          { 
    41             MPI_Init(NULL, NULL); 
     41            //MPI_Init(NULL, NULL); 
     42            int return_level; 
     43            MPI_Init_thread(NULL, NULL, 3, &return_level); 
     44            assert(return_level == 3); 
    4245          } 
    4346          CTimer::get("XIOS").resume() ; 
     
    4649 
    4750          unsigned long hashClient=hashString(codeId) ; 
    48           unsigned long hashServer=hashString(CXios::xiosCodeId) ; 
     51          unsigned long hashServer; //=hashString(CXios::xiosCodeId) ; 
     52          hashServer=hashString("xios.x") ; 
    4953          unsigned long* hashAll ; 
    5054          int size ; 
     
    96100            MPI_Comm_size(intraComm,&intraCommSize) ; 
    97101            MPI_Comm_rank(intraComm,&intraCommRank) ; 
    98             info(50)<<"intercommCreate::client "<<rank<<" intraCommSize : "<<intraCommSize 
    99                  <<" intraCommRank :"<<intraCommRank<<"  serverLeader "<< serverLeader<<endl ; 
     102            #pragma omp critical(_output) 
     103            { 
     104              info(50)<<"intercommCreate::client "<<rank<<" intraCommSize : "<<intraCommSize 
     105                 <<" intraCommRank :"<<intraCommRank<<"  serverLeader "<< serverLeader<<endl ;   
     106            } 
     107             
    100108            MPI_Intercomm_create(intraComm,0,CXios::globalComm,serverLeader,0,&interComm) ; 
     109 
    101110          } 
    102111          else 
     
    289298 
    290299      fileNameClient << fileName << "_" << std::setfill('0') << std::setw(numDigit) << getRank() << ext; 
    291       fb->open(fileNameClient.str().c_str(), std::ios::out); 
    292       if (!fb->is_open()) 
    293         ERROR("void CClient::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)", 
    294               << std::endl << "Can not open <" << fileNameClient << "> file to write the client log(s)."); 
     300      printf("getrank() = %d, file name = %s\n", getRank(), fileNameClient.str().c_str()); 
     301      #pragma omp critical(_output) 
     302      { 
     303        fb->open(fileNameClient.str().c_str(), std::ios::out); 
     304        if (!fb->is_open()) 
     305          ERROR("void CClient::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)", 
     306              << std::endl << "Can not open <" << fileNameClient << "> file to write the client log(s).");   
     307      } 
     308       
    295309    } 
    296310 
Note: See TracChangeset for help on using the changeset viewer.