Changeset 1134 for XIOS/dev/branch_yushan_merged/src/cxios.cpp
- Timestamp:
- 05/16/17 17:54:30 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan_merged/src/cxios.cpp
r1029 r1134 14 14 namespace xios 15 15 { 16 string CXios::rootFile="./iodef.xml" ; 17 string CXios::xiosCodeId="xios.x" ; 18 string CXios::clientFile="./xios_client"; 19 string CXios::serverFile="./xios_server"; 16 17 extern int test_omp_rank; 18 #pragma omp threadprivate(test_omp_rank) 19 20 const string CXios::rootFile="./iodef.xml" ; 21 const string CXios::xiosCodeId="xios.x" ; 22 const string CXios::clientFile="./xios_client"; 23 const string CXios::serverFile="./xios_server"; 24 20 25 21 26 bool CXios::isClient ; 22 27 bool CXios::isServer ; 28 29 23 30 MPI_Comm CXios::globalComm ; 31 32 24 33 bool CXios::usingOasis ; 25 34 bool CXios::usingServer = false; 35 36 26 37 double CXios::bufferSizeFactor = 1.0; 27 38 const double CXios::defaultBufferSizeFactor = 1.0; 28 39 StdSize CXios::minBufferSize = 1024 * sizeof(double); 40 41 29 42 bool CXios::printLogs2Files; 30 43 bool CXios::isOptPerformance = true; … … 36 49 { 37 50 set_new_handler(noMemory); 38 parseFile(rootFile); 51 52 53 #pragma omp critical 54 { 55 parseFile(rootFile); 56 } 57 #pragma omp barrier 39 58 parseXiosConfig(); 40 59 } … … 68 87 ERROR("CXios::parseXiosConfig()", "recv_field_timeout cannot be negative."); 69 88 70 globalComm=MPI_COMM_WORLD ; 89 90 int num_ep; 91 if(isClient) 92 { 93 num_ep = omp_get_num_threads(); 94 } 95 96 if(isServer) 97 { 98 num_ep = omp_get_num_threads(); 99 } 100 101 MPI_Info info; 102 #pragma omp master 103 { 104 MPI_Comm *ep_comm; 105 MPI_Comm_create_endpoints(MPI_COMM_WORLD, num_ep, info, ep_comm); // servers should reach here too. 106 passage = ep_comm; 107 } 108 109 #pragma omp barrier 110 111 112 CXios::globalComm = passage[omp_get_thread_num()]; 113 114 int tmp_rank; 115 MPI_Comm_rank(CXios::globalComm, &tmp_rank); 116 117 118 test_omp_rank = tmp_rank; 119 71 120 } 72 121 … … 79 128 void CXios::initClientSide(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm) 80 129 { 130 isClient = true; 131 81 132 initialize() ; 82 133 83 isClient = true;84 85 134 CClient::initialize(codeId,localComm,returnComm) ; 135 86 136 if (CClient::getRank()==0) globalRegistry = new CRegistry(returnComm) ; 87 137 … … 92 142 if (printLogs2Files) 93 143 { 144 #pragma omp critical 94 145 CClient::openInfoStream(clientFile); 95 146 CClient::openErrorStream(clientFile); … … 107 158 if (CClient::getRank()==0) 108 159 { 160 #pragma omp critical (_output) 109 161 info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ; 110 162 globalRegistry->toFile("xios_registry.bin") ; … … 123 175 void CXios::initServer() 124 176 { 177 int initialized; 178 MPI_Initialized(&initialized); 179 if (initialized) CServer::is_MPI_Initialized=true ; 180 else CServer::is_MPI_Initialized=false ; 181 182 183 if(!CServer::is_MPI_Initialized) 184 { 185 MPI_Init(NULL, NULL); 186 } 187 125 188 set_new_handler(noMemory); 126 189 std::set<StdString> parseList; … … 133 196 void CXios::initServerSide(void) 134 197 { 135 initServer();198 136 199 isClient = false; 137 200 isServer = true; 138 201 202 initServer(); 203 204 139 205 // Initialize all aspects MPI 140 206 CServer::initialize(); … … 162 228 delete globalRegistry ; 163 229 } 230 164 231 CServer::finalize(); 232 165 233 CServer::closeInfoStream(); 166 234 }
Note: See TracChangeset
for help on using the changeset viewer.