Changeset 1037 for XIOS/dev/branch_yushan/src/cxios.cpp
- Timestamp:
- 01/25/17 16:25:17 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan/src/cxios.cpp
r1029 r1037 30 30 bool CXios::isOptPerformance = true; 31 31 CRegistry* CXios::globalRegistry = 0; 32 double CXios::recvFieldTimeout = 10.0;33 32 34 33 //! Parse configuration file and create some objects from it 35 34 void CXios::initialize() 36 35 { 36 37 37 38 set_new_handler(noMemory); 38 39 parseFile(rootFile); … … 64 65 bufferSizeFactor = getin<double>("buffer_size_factor", defaultBufferSizeFactor); 65 66 minBufferSize = getin<int>("min_buffer_size", 1024 * sizeof(double)); 66 recvFieldTimeout = getin<double>("recv_field_timeout", 10.0); 67 if (recvFieldTimeout < 0.0) 68 ERROR("CXios::parseXiosConfig()", "recv_field_timeout cannot be negative."); 69 70 globalComm=MPI_COMM_WORLD ; 67 68 int num_ep; 69 if(isClient) 70 { 71 num_ep = 1; 72 } 73 74 if(isServer) 75 { 76 num_ep = 1; 77 } 78 79 MPI_Info info; 80 MPI_Comm *ep_comm; 81 MPI_Comm_create_endpoints(MPI_COMM_WORLD, num_ep, info, ep_comm); 82 83 globalComm = ep_comm[0]; 84 85 int tmp_size; 86 MPI_Comm_size(globalComm, &tmp_size); 87 printf("globalcomm size = %d\n", tmp_size); 88 89 71 90 } 72 91 … … 79 98 void CXios::initClientSide(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm) 80 99 { 100 isClient = true; 101 81 102 initialize() ; 82 103 83 isClient = true; 84 104 85 105 CClient::initialize(codeId,localComm,returnComm) ; 86 106 if (CClient::getRank()==0) globalRegistry = new CRegistry(returnComm) ; … … 89 109 // and the clients are also servers 90 110 isServer = !usingServer; 91 111 112 92 113 if (printLogs2Files) 93 114 { … … 100 121 CClient::openErrorStream(); 101 122 } 123 124 102 125 } 103 126 … … 123 146 void CXios::initServer() 124 147 { 148 int initialized; 149 MPI_Initialized(&initialized); 150 if (initialized) CServer::is_MPI_Initialized=true ; 151 else CServer::is_MPI_Initialized=false ; 152 153 154 if(!CServer::is_MPI_Initialized) 155 { 156 MPI_Init(NULL, NULL); 157 } 158 125 159 set_new_handler(noMemory); 126 160 std::set<StdString> parseList; … … 133 167 void CXios::initServerSide(void) 134 168 { 135 initServer();169 136 170 isClient = false; 137 171 isServer = true; 138 172 173 initServer(); 174 175 139 176 // Initialize all aspects MPI 140 177 CServer::initialize(); 141 178 if (CServer::getRank()==0) globalRegistry = new CRegistry(CServer::intraComm) ; 142 179 180 143 181 if (printLogs2Files) 144 182 { … … 151 189 CServer::openErrorStream(); 152 190 } 153 191 154 192 // Enter the loop to listen message from Client 155 193 CServer::eventLoop(); 194 195 printf("server eventloop OK\n"); 156 196 157 197 // Finalize … … 162 202 delete globalRegistry ; 163 203 } 204 205 printf("server globalRegistry OK\n"); 206 164 207 CServer::finalize(); 208 209 printf("server finalize OK\n"); 210 165 211 CServer::closeInfoStream(); 166 212 }
Note: See TracChangeset
for help on using the changeset viewer.