Changeset 1338
- Timestamp:
- 11/21/17 10:47:57 (6 years ago)
- Location:
- XIOS/dev/branch_openmp
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/remap/src/mapper.cpp
r1335 r1338 132 132 timings.push_back(cputime() - tic); 133 133 134 tic = cputime(); 135 if (interpOrder == 2) { 136 if (mpiRank == 0 && verbose) cout << "Computing grads ..." << endl; 137 buildMeshTopology(); 138 computeGrads(); 139 } 140 timings.push_back(cputime() - tic); 141 142 /* Prepare computation of weights */ 143 /* compute number of intersections which for the first order case 144 corresponds to the number of edges in the remap matrix */ 145 int nIntersections = 0; 146 for (int j = 0; j < targetElements.size(); j++) 147 { 148 Elt &elt = targetElements[j]; 149 for (list<Polyg*>::iterator it = elt.is.begin(); it != elt.is.end(); it++) 150 nIntersections++; 151 } 152 /* overallocate for NMAX neighbours for each elements */ 153 remapMatrix = new double[nIntersections*NMAX]; 154 srcAddress = new int[nIntersections*NMAX]; 155 srcRank = new int[nIntersections*NMAX]; 156 dstAddress = new int[nIntersections*NMAX]; 134 tic = cputime(); 135 if (interpOrder == 2) 136 { 137 if (mpiRank == 0 && verbose) cout << "Computing grads ..." << endl; 138 buildMeshTopology(); 139 computeGrads(); 140 } 141 timings.push_back(cputime() - tic); 142 143 /* Prepare computation of weights */ 144 /* compute number of intersections which for the first order case 145 corresponds to the number of edges in the remap matrix */ 146 int nIntersections = 0; 147 for (int j = 0; j < targetElements.size(); j++) 148 { 149 Elt &elt = targetElements[j]; 150 for (list<Polyg*>::iterator it = elt.is.begin(); it != elt.is.end(); it++) 151 nIntersections++; 152 } 153 /* overallocate for NMAX neighbours for each elements */ 154 remapMatrix = new double[nIntersections*NMAX]; 155 srcAddress = new int[nIntersections*NMAX]; 156 srcRank = new int[nIntersections*NMAX]; 157 dstAddress = new int[nIntersections*NMAX]; 157 158 sourceWeightId =new long[nIntersections*NMAX]; 158 159 targetWeightId =new long[nIntersections*NMAX]; 159 160 160 161 161 162 163 164 162 if (mpiRank == 0 && verbose) cout << "Remapping..." << endl; 163 tic = cputime(); 164 nWeights = remap(&targetElements[0], targetElements.size(), interpOrder, renormalize, quantity); 165 timings.push_back(cputime() - tic); 165 166 166 167 for (int i = 0; i < targetElements.size(); i++) targetElements[i].delete_intersections(); 167 168 168 169 return timings; 169 170 } 170 171 … … 177 178 int Mapper::remap(Elt *elements, int nbElements, int order, bool renormalize, bool quantity) 178 179 { 179 int mpiSize, mpiRank; 180 MPI_Comm_size(communicator, &mpiSize); 181 MPI_Comm_rank(communicator, &mpiRank); 182 183 /* create list of intersections (super mesh elements) for each rank */ 184 multimap<int, Polyg *> *elementList = new multimap<int, Polyg *>[mpiSize]; 185 for (int j = 0; j < nbElements; j++) 186 { 187 Elt& e = elements[j]; 188 for (list<Polyg *>::iterator it = e.is.begin(); it != e.is.end(); it++) 189 elementList[(*it)->id.rank].insert(pair<int, Polyg *>((*it)->id.ind, *it)); 190 } 191 192 int *nbSendElement = new int[mpiSize]; 193 int **sendElement = new int*[mpiSize]; /* indices of elements required from other rank */ 194 double **recvValue = new double*[mpiSize]; 195 double **recvArea = new double*[mpiSize]; 196 Coord **recvGrad = new Coord*[mpiSize]; 197 GloId **recvNeighIds = new GloId*[mpiSize]; /* ids of the of the source neighbours which also contribute through gradient */ 198 for (int rank = 0; rank < mpiSize; rank++) 199 { 200 /* get size for allocation */ 201 int last = -1; /* compares unequal to any index */ 202 int index = -1; /* increased to starting index 0 in first iteration */ 203 for (multimap<int, Polyg *>::iterator it = elementList[rank].begin(); it != elementList[rank].end(); ++it) 204 { 205 if (last != it->first) 206 index++; 207 (it->second)->id.ind = index; 208 last = it->first; 209 } 210 nbSendElement[rank] = index + 1; 211 212 /* if size is non-zero allocate and collect indices of elements on other ranks that we intersect */ 213 if (nbSendElement[rank] > 0) 214 { 215 sendElement[rank] = new int[nbSendElement[rank]]; 216 recvValue[rank] = new double[nbSendElement[rank]]; 217 recvArea[rank] = new double[nbSendElement[rank]]; 218 if (order == 2) 219 { 220 recvNeighIds[rank] = new GloId[nbSendElement[rank]*(NMAX+1)]; 221 recvGrad[rank] = new Coord[nbSendElement[rank]*(NMAX+1)]; 222 } 223 else 224 recvNeighIds[rank] = new GloId[nbSendElement[rank]]; 225 226 last = -1; 227 index = -1; 228 for (multimap<int, Polyg *>::iterator it = elementList[rank].begin(); it != elementList[rank].end(); ++it) 229 { 230 if (last != it->first) 231 index++; 232 sendElement[rank][index] = it->first; 233 last = it->first; 234 } 235 } 236 } 237 238 /* communicate sizes of source elements to be sent (index lists and later values and gradients) */ 239 int *nbRecvElement = new int[mpiSize]; 240 MPI_Alltoall(nbSendElement, 1, MPI_INT, nbRecvElement, 1, MPI_INT, communicator); 241 242 /* communicate indices of source elements on other ranks whoes value and gradient we need (since intersection) */ 243 int nbSendRequest = 0; 244 int nbRecvRequest = 0; 245 int **recvElement = new int*[mpiSize]; 246 double **sendValue = new double*[mpiSize]; 247 double **sendArea = new double*[mpiSize]; 248 Coord **sendGrad = new Coord*[mpiSize]; 249 GloId **sendNeighIds = new GloId*[mpiSize]; 250 MPI_Request *sendRequest = new MPI_Request[4*mpiSize]; 251 MPI_Request *recvRequest = new MPI_Request[4*mpiSize]; 252 for (int rank = 0; rank < mpiSize; rank++) 253 { 254 if (nbSendElement[rank] > 0) 255 { 256 MPI_Issend(sendElement[rank], nbSendElement[rank], MPI_INT, rank, 0, communicator, &sendRequest[nbSendRequest]); 257 nbSendRequest++; 258 } 259 260 if (nbRecvElement[rank] > 0) 261 { 262 recvElement[rank] = new int[nbRecvElement[rank]]; 263 sendValue[rank] = new double[nbRecvElement[rank]]; 264 sendArea[rank] = new double[nbRecvElement[rank]]; 265 if (order == 2) 266 { 267 sendNeighIds[rank] = new GloId[nbRecvElement[rank]*(NMAX+1)]; 268 sendGrad[rank] = new Coord[nbRecvElement[rank]*(NMAX+1)]; 269 } 270 else 271 { 272 sendNeighIds[rank] = new GloId[nbRecvElement[rank]]; 273 } 274 MPI_Irecv(recvElement[rank], nbRecvElement[rank], MPI_INT, rank, 0, communicator, &recvRequest[nbRecvRequest]); 275 nbRecvRequest++; 276 } 277 } 180 int mpiSize, mpiRank; 181 MPI_Comm_size(communicator, &mpiSize); 182 MPI_Comm_rank(communicator, &mpiRank); 183 184 /* create list of intersections (super mesh elements) for each rank */ 185 multimap<int, Polyg *> *elementList = new multimap<int, Polyg *>[mpiSize]; 186 for (int j = 0; j < nbElements; j++) 187 { 188 Elt& e = elements[j]; 189 for (list<Polyg *>::iterator it = e.is.begin(); it != e.is.end(); it++) 190 { 191 elementList[(*it)->id.rank].insert(pair<int, Polyg *>((*it)->id.ind, *it)); 192 //std::cout<<"elementList["<<(*it)->id.rank<<"].size = "<< elementList[(*it)->id.rank].size()<<std::endl; 193 } 194 } 195 196 int *nbSendElement = new int[mpiSize]; 197 int **sendElement = new int*[mpiSize]; /* indices of elements required from other rank */ 198 double **recvValue = new double*[mpiSize]; 199 double **recvArea = new double*[mpiSize]; 200 Coord **recvGrad = new Coord*[mpiSize]; 201 GloId **recvNeighIds = new GloId*[mpiSize]; /* ids of the of the source neighbours which also contribute through gradient */ 202 for (int rank = 0; rank < mpiSize; rank++) 203 { 204 /* get size for allocation */ 205 int last = -1; /* compares unequal to any index */ 206 int index = -1; /* increased to starting index 0 in first iteration */ 207 for (multimap<int, Polyg *>::iterator it = elementList[rank].begin(); it != elementList[rank].end(); ++it) 208 { 209 if (last != it->first) 210 index++; 211 (it->second)->id.ind = index; 212 last = it->first; 213 } 214 nbSendElement[rank] = index + 1; 215 216 /* if size is non-zero allocate and collect indices of elements on other ranks that we intersect */ 217 if (nbSendElement[rank] > 0) 218 { 219 sendElement[rank] = new int[nbSendElement[rank]]; 220 recvValue[rank] = new double[nbSendElement[rank]]; 221 recvArea[rank] = new double[nbSendElement[rank]]; 222 if (order == 2) 223 { 224 recvNeighIds[rank] = new GloId[nbSendElement[rank]*(NMAX+1)]; 225 recvGrad[rank] = new Coord[nbSendElement[rank]*(NMAX+1)]; 226 } 227 else 228 recvNeighIds[rank] = new GloId[nbSendElement[rank]]; 229 230 last = -1; 231 index = -1; 232 for (multimap<int, Polyg *>::iterator it = elementList[rank].begin(); it != elementList[rank].end(); ++it) 233 { 234 if (last != it->first) 235 index++; 236 sendElement[rank][index] = it->first; 237 last = it->first; 238 } 239 } 240 } 241 242 /* communicate sizes of source elements to be sent (index lists and later values and gradients) */ 243 int *nbRecvElement = new int[mpiSize]; 244 MPI_Alltoall(nbSendElement, 1, MPI_INT, nbRecvElement, 1, MPI_INT, communicator); 245 246 /* communicate indices of source elements on other ranks whoes value and gradient we need (since intersection) */ 247 int nbSendRequest = 0; 248 int nbRecvRequest = 0; 249 int **recvElement = new int*[mpiSize]; 250 double **sendValue = new double*[mpiSize]; 251 double **sendArea = new double*[mpiSize]; 252 Coord **sendGrad = new Coord*[mpiSize]; 253 GloId **sendNeighIds = new GloId*[mpiSize]; 254 MPI_Request *sendRequest = new MPI_Request[4*mpiSize]; 255 MPI_Request *recvRequest = new MPI_Request[4*mpiSize]; 256 for (int rank = 0; rank < mpiSize; rank++) 257 { 258 if (nbSendElement[rank] > 0) 259 { 260 MPI_Issend(sendElement[rank], nbSendElement[rank], MPI_INT, rank, 0, communicator, &sendRequest[nbSendRequest]); 261 nbSendRequest++; 262 } 263 264 if (nbRecvElement[rank] > 0) 265 { 266 recvElement[rank] = new int[nbRecvElement[rank]]; 267 sendValue[rank] = new double[nbRecvElement[rank]]; 268 sendArea[rank] = new double[nbRecvElement[rank]]; 269 if (order == 2) 270 { 271 sendNeighIds[rank] = new GloId[nbRecvElement[rank]*(NMAX+1)]; 272 sendGrad[rank] = new Coord[nbRecvElement[rank]*(NMAX+1)]; 273 } 274 else 275 { 276 sendNeighIds[rank] = new GloId[nbRecvElement[rank]]; 277 } 278 MPI_Irecv(recvElement[rank], nbRecvElement[rank], MPI_INT, rank, 0, communicator, &recvRequest[nbRecvRequest]); 279 nbRecvRequest++; 280 } 281 } 278 282 279 283 MPI_Status *status = new MPI_Status[4*mpiSize]; … … 282 286 MPI_Waitall(nbRecvRequest, recvRequest, status); 283 287 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 288 /* for all indices that have been received from requesting ranks: pack values and gradients, then send */ 289 nbSendRequest = 0; 290 nbRecvRequest = 0; 291 for (int rank = 0; rank < mpiSize; rank++) 292 { 293 if (nbRecvElement[rank] > 0) 294 { 295 int jj = 0; // jj == j if no weight writing 296 for (int j = 0; j < nbRecvElement[rank]; j++) 297 { 298 sendValue[rank][j] = sstree.localElements[recvElement[rank][j]].val; 299 sendArea[rank][j] = sstree.localElements[recvElement[rank][j]].area; 300 if (order == 2) 301 { 302 sendGrad[rank][jj] = sstree.localElements[recvElement[rank][j]].grad; 303 sendNeighIds[rank][jj] = sstree.localElements[recvElement[rank][j]].src_id; 304 jj++; 305 for (int i = 0; i < NMAX; i++) 306 { 307 sendGrad[rank][jj] = sstree.localElements[recvElement[rank][j]].gradNeigh[i]; 304 308 sendNeighIds[rank][jj] = sstree.localElements[recvElement[rank][j]].neighId[i]; 305 jj++; 306 } 307 } 308 else 309 sendNeighIds[rank][j] = sstree.localElements[recvElement[rank][j]].src_id; 310 } 311 MPI_Issend(sendValue[rank], nbRecvElement[rank], MPI_DOUBLE, rank, 0, communicator, &sendRequest[nbSendRequest]); 312 nbSendRequest++; 313 MPI_Issend(sendArea[rank], nbRecvElement[rank], MPI_DOUBLE, rank, 0, communicator, &sendRequest[nbSendRequest]); 314 nbSendRequest++; 315 if (order == 2) 316 { 317 MPI_Issend(sendGrad[rank], 3*nbRecvElement[rank]*(NMAX+1), 318 MPI_DOUBLE, rank, 0, communicator, &sendRequest[nbSendRequest]); 319 nbSendRequest++; 320 MPI_Issend(sendNeighIds[rank], 4*nbRecvElement[rank]*(NMAX+1), MPI_INT, rank, 0, communicator, &sendRequest[nbSendRequest]); 309 jj++; 310 } 311 } 312 else 313 sendNeighIds[rank][j] = sstree.localElements[recvElement[rank][j]].src_id; 314 } 315 MPI_Issend(sendValue[rank], nbRecvElement[rank], MPI_DOUBLE, rank, 0, communicator, &sendRequest[nbSendRequest]); 316 nbSendRequest++; 317 MPI_Issend(sendArea[rank], nbRecvElement[rank], MPI_DOUBLE, rank, 0, communicator, &sendRequest[nbSendRequest]); 318 nbSendRequest++; 319 if (order == 2) 320 { 321 MPI_Issend(sendGrad[rank], 3*nbRecvElement[rank]*(NMAX+1), MPI_DOUBLE, rank, 0, communicator, &sendRequest[nbSendRequest]); 322 nbSendRequest++; 323 MPI_Issend(sendNeighIds[rank], 4*nbRecvElement[rank]*(NMAX+1), MPI_INT, rank, 0, communicator, &sendRequest[nbSendRequest]); 321 324 //ym --> attention taille GloId 322 323 324 325 326 325 nbSendRequest++; 326 } 327 else 328 { 329 MPI_Issend(sendNeighIds[rank], 4*nbRecvElement[rank], MPI_INT, rank, 0, communicator, &sendRequest[nbSendRequest]); 327 330 //ym --> attention taille GloId 328 nbSendRequest++; 329 } 330 } 331 if (nbSendElement[rank] > 0) 332 { 333 MPI_Irecv(recvValue[rank], nbSendElement[rank], MPI_DOUBLE, rank, 0, communicator, &recvRequest[nbRecvRequest]); 334 nbRecvRequest++; 335 MPI_Irecv(recvArea[rank], nbSendElement[rank], MPI_DOUBLE, rank, 0, communicator, &recvRequest[nbRecvRequest]); 336 nbRecvRequest++; 337 if (order == 2) 338 { 339 MPI_Irecv(recvGrad[rank], 3*nbSendElement[rank]*(NMAX+1), 340 MPI_DOUBLE, rank, 0, communicator, &recvRequest[nbRecvRequest]); 341 nbRecvRequest++; 342 MPI_Irecv(recvNeighIds[rank], 4*nbSendElement[rank]*(NMAX+1), MPI_INT, rank, 0, communicator, &recvRequest[nbRecvRequest]); 331 nbSendRequest++; 332 } 333 } 334 if (nbSendElement[rank] > 0) 335 { 336 MPI_Irecv(recvValue[rank], nbSendElement[rank], MPI_DOUBLE, rank, 0, communicator, &recvRequest[nbRecvRequest]); 337 nbRecvRequest++; 338 MPI_Irecv(recvArea[rank], nbSendElement[rank], MPI_DOUBLE, rank, 0, communicator, &recvRequest[nbRecvRequest]); 339 nbRecvRequest++; 340 if (order == 2) 341 { 342 MPI_Irecv(recvGrad[rank], 3*nbSendElement[rank]*(NMAX+1), MPI_DOUBLE, rank, 0, communicator, &recvRequest[nbRecvRequest]); 343 nbRecvRequest++; 344 MPI_Irecv(recvNeighIds[rank], 4*nbSendElement[rank]*(NMAX+1), MPI_INT, rank, 0, communicator, &recvRequest[nbRecvRequest]); 343 345 //ym --> attention taille GloId 344 345 346 347 348 346 nbRecvRequest++; 347 } 348 else 349 { 350 MPI_Irecv(recvNeighIds[rank], 4*nbSendElement[rank], MPI_INT, rank, 0, communicator, &recvRequest[nbRecvRequest]); 349 351 //ym --> attention taille GloId 350 351 352 353 352 nbRecvRequest++; 353 } 354 } 355 } 354 356 355 356 357 MPI_Waitall(nbSendRequest, sendRequest, status); 358 MPI_Waitall(nbRecvRequest, recvRequest, status); 357 359 358 360 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 361 /* now that all values and gradients are available use them to computed interpolated values on target 362 and also to compute weights */ 363 int i = 0; 364 for (int j = 0; j < nbElements; j++) 365 { 366 Elt& e = elements[j]; 367 368 /* since for the 2nd order case source grid elements can contribute to a destination grid element over several "paths" 369 (step1: gradient is computed using neighbours on same grid, step2: intersection uses several elements on other grid) 370 accumulate them so that there is only one final weight between two elements */ 371 map<GloId,double> wgt_map; 372 373 /* for destination element `e` loop over all intersetions/the corresponding source elements */ 374 for (list<Polyg *>::iterator it = e.is.begin(); it != e.is.end(); it++) 375 { 376 /* it is the intersection element, so it->x and it->area are barycentre and area of intersection element (super mesh) 377 but it->id is id of the source element that it intersects */ 378 int n1 = (*it)->id.ind; 379 int rank = (*it)->id.rank; 380 double fk = recvValue[rank][n1]; 381 double srcArea = recvArea[rank][n1]; 382 double w = (*it)->area; 381 383 if (quantity) w/=srcArea ; 382 384 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 385 /* first order: src value times weight (weight = supermesh area), later divide by target area */ 386 int kk = (order == 2) ? n1 * (NMAX + 1) : n1; 387 GloId neighID = recvNeighIds[rank][kk]; 388 wgt_map[neighID] += w; 389 390 if (order == 2) 391 { 392 for (int k = 0; k < NMAX+1; k++) 393 { 394 int kk = n1 * (NMAX + 1) + k; 395 GloId neighID = recvNeighIds[rank][kk]; 396 if (neighID.ind != -1) wgt_map[neighID] += w * scalarprod(recvGrad[rank][kk], (*it)->x); 397 } 398 399 } 400 } 399 401 400 402 double renorm=0; … … 404 406 405 407 for (map<GloId,double>::iterator it = wgt_map.begin(); it != wgt_map.end(); it++) 406 408 { 407 409 if (quantity) this->remapMatrix[i] = (it->second ) / renorm; 408 409 410 411 410 else this->remapMatrix[i] = (it->second / e.area) / renorm; 411 this->srcAddress[i] = it->first.ind; 412 this->srcRank[i] = it->first.rank; 413 this->dstAddress[i] = j; 412 414 this->sourceWeightId[i]= it->first.globalId ; 413 415 this->targetWeightId[i]= targetGlobalId[j] ; 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 delete[] recvNeighIds; 456 416 i++; 417 } 418 } 419 420 /* free all memory allocated in this function */ 421 /* for (int rank = 0; rank < mpiSize; rank++) 422 { 423 if (nbSendElement[rank] > 0) 424 { 425 delete[] sendElement[rank]; 426 delete[] recvValue[rank]; 427 delete[] recvArea[rank]; 428 if (order == 2) 429 { 430 delete[] recvGrad[rank]; 431 } 432 delete[] recvNeighIds[rank]; 433 } 434 if (nbRecvElement[rank] > 0) 435 { 436 delete[] recvElement[rank]; 437 delete[] sendValue[rank]; 438 delete[] sendArea[rank]; 439 if (order == 2) 440 delete[] sendGrad[rank]; 441 delete[] sendNeighIds[rank]; 442 } 443 } 444 delete[] status; 445 delete[] sendRequest; 446 delete[] recvRequest; 447 delete[] elementList; 448 delete[] nbSendElement; 449 delete[] nbRecvElement; 450 delete[] sendElement; 451 delete[] recvElement; 452 delete[] sendValue; 453 delete[] recvValue; 454 delete[] sendGrad; 455 delete[] recvGrad; 456 delete[] sendNeighIds; 457 delete[] recvNeighIds;*/ 458 return i; 457 459 } 458 460 -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_split.cpp
r1295 r1338 99 99 MPI_Gather_local(&key, 1, MPI_INT, key_loc.data(), 0, comm); 100 100 MPI_Bcast_local(key_loc.data(), num_ep, MPI_INT, 0, comm); 101 102 std::sort(key_loc.begin(), key_loc.end()); 101 103 102 104 for(int i=0; i<num_ep; i++) -
XIOS/dev/branch_openmp/inputs/REMAP/iodef.xml
r1334 r1338 58 58 <field field_ref="dst_field_2D_regular_pole" name="field_dst_regular_2" enabled=".TRUE."/> 59 59 <field field_ref="dst_field_2D_clone" name="field_dst_regular_3" detect_missing_value=".false." default_value="100000" enabled=".FALSE."/> 60 <field field_ref="dst_field_2D_extract" name="field_dst_regular_4" enabled=". TRUE."/>60 <field field_ref="dst_field_2D_extract" name="field_dst_regular_4" enabled=".FALSE."/> 61 61 </file> 62 62 <file id="output_3D" name="output_3D" enabled=".TRUE."> … … 68 68 <file id="output_4D" name="output_4D" enabled=".TRUE."> 69 69 <field field_ref="src_field_4D" name="field_4D" /> 70 <field field_ref="dst_field_4D_extract" name="field_4D_extract" enabled=". TRUE."/>70 <field field_ref="dst_field_4D_extract" name="field_4D_extract" enabled=".FALSE."/> 71 71 </file> 72 72 </file_group> -
XIOS/dev/branch_openmp/src/buffer_client.cpp
r1328 r1338 30 30 buffer[1] = new char[bufferSize]; 31 31 retBuffer = new CBufferOut(buffer[current], bufferSize); 32 info(10) << "CClientBuffer: allocated 2 x " << bufferSize << " bytes for server " << serverRank << " with a maximum of " << maxBufferedEvents << " buffered events" << endl;32 //info(10) << "CClientBuffer: allocated 2 x " << bufferSize << " bytes for server " << serverRank << " with a maximum of " << maxBufferedEvents << " buffered events" << endl; 33 33 } 34 34 -
XIOS/dev/branch_openmp/src/client.cpp
r1334 r1338 255 255 } 256 256 257 info(20) << "Client side context is finalized"<<endl ;258 report(0) <<" Performance report : Whole time from XIOS init and finalize: "<< CTimer::get("XIOS init/finalize").getCumulatedTime()<<" s"<<endl ;259 report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ;260 report(0)<< " Performance report : time spent for waiting free buffer : "<< CTimer::get("Blocking time").getCumulatedTime()<<" s"<<endl ;261 report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS init/finalize").getCumulatedTime()*100.<<" %"<<endl ;262 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 ;257 //info(20) << "Client side context is finalized"<<endl ; 258 //report(0) <<" Performance report : Whole time from XIOS init and finalize: "<< CTimer::get("XIOS init/finalize").getCumulatedTime()<<" s"<<endl ; 259 //report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ; 260 //report(0)<< " Performance report : time spent for waiting free buffer : "<< CTimer::get("Blocking time").getCumulatedTime()<<" s"<<endl ; 261 //report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS init/finalize").getCumulatedTime()*100.<<" %"<<endl ; 262 //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 ; 263 263 // report(0)<< " Memory report : Current buffer_size : "<<CXios::bufferSize<<endl ; 264 report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ;265 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 ;266 report(100)<<CTimer::getAllCumulatedTime()<<endl ;264 //report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ; 265 //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 ; 266 //report(100)<<CTimer::getAllCumulatedTime()<<endl ; 267 267 } 268 268 -
XIOS/dev/branch_openmp/src/context_client.cpp
r1328 r1338 400 400 for (itMap = itbMap; itMap != iteMap; ++itMap) 401 401 { 402 report(10) << " Memory report : Context <" << context->getId() << "> : client side : memory used for buffer of each connection to server" << endl403 << " +) To server with rank " << itMap->first << " : " << itMap->second << " bytes " << endl;402 //report(10) << " Memory report : Context <" << context->getId() << "> : client side : memory used for buffer of each connection to server" << endl 403 // << " +) To server with rank " << itMap->first << " : " << itMap->second << " bytes " << endl; 404 404 totalBuf += itMap->second; 405 405 } 406 report(0) << " Memory report : Context <" << context->getId() << "> : client side : total memory used for buffer " << totalBuf << " bytes" << endl;406 //report(0) << " Memory report : Context <" << context->getId() << "> : client side : total memory used for buffer " << totalBuf << " bytes" << endl; 407 407 408 408 releaseBuffers(); -
XIOS/dev/branch_openmp/src/context_server.cpp
r1328 r1338 254 254 { 255 255 finished=true; 256 info(20)<<"Server Side context <"<<context->getId()<<"> finalized"<<endl;256 //info(20)<<"Server Side context <"<<context->getId()<<"> finalized"<<endl; 257 257 std::map<int, StdSize>::const_iterator itbMap = mapBufferSize_.begin(), 258 258 iteMap = mapBufferSize_.end(), itMap; … … 260 260 for (itMap = itbMap; itMap != iteMap; ++itMap) 261 261 { 262 report(10)<< " Memory report : Context <"<<context->getId()<<"> : server side : memory used for buffer of each connection to client" << endl263 << " +) With client of rank " << itMap->first << " : " << itMap->second << " bytes " << endl;262 //report(10)<< " Memory report : Context <"<<context->getId()<<"> : server side : memory used for buffer of each connection to client" << endl 263 // << " +) With client of rank " << itMap->first << " : " << itMap->second << " bytes " << endl; 264 264 totalBuf += itMap->second; 265 265 } 266 266 context->finalize(); 267 report(0)<< " Memory report : Context <"<<context->getId()<<"> : server side : total memory used for buffer "<<totalBuf<<" bytes"<<endl;267 //report(0)<< " Memory report : Context <"<<context->getId()<<"> : server side : total memory used for buffer "<<totalBuf<<" bytes"<<endl; 268 268 } 269 269 else if (event.classId==CContext::GetType()) CContext::dispatchEvent(event); -
XIOS/dev/branch_openmp/src/io/nc4_data_input.cpp
r1328 r1338 53 53 CArray<double,1> fieldData(grid->getWrittenDataSize()); 54 54 if (!field->default_value.isEmpty()) fieldData = field->default_value; 55 55 #ifdef _usingEP 56 SuperClass::type = ONE_FILE; 57 printf("SuperClass::type = %d\n", SuperClass::type); 58 #endif 59 56 60 switch (SuperClass::type) 57 61 { -
XIOS/dev/branch_openmp/src/io/netCdfInterface.cpp
r1334 r1338 128 128 int CNetCdfInterface::close(int ncId) 129 129 { 130 int status = nc_close(ncId); 131 if (NC_NOERR != status) 132 { 133 StdString errormsg(nc_strerror(status)); 134 StdStringStream sstr; 135 sstr << "Error when calling function nc_close(ncId)" << std::endl 136 << errormsg << std::endl 137 << "Unable to close file, given its id: " << ncId << std::endl; 138 StdString e = sstr.str(); 139 throw CNetCdfException(e); 140 } 141 130 int status = NC_NOERR; 131 #pragma omp master 132 { 133 status = nc_close(ncId); 134 if (NC_NOERR != status) 135 { 136 StdString errormsg(nc_strerror(status)); 137 StdStringStream sstr; 138 sstr << "Error when calling function nc_close(ncId)" << std::endl 139 << errormsg << std::endl 140 << "Unable to close file, given its id: " << ncId << std::endl; 141 StdString e = sstr.str(); 142 throw CNetCdfException(e); 143 } 144 } 142 145 return status; 143 146 } -
XIOS/dev/branch_openmp/src/node/context.cpp
r1334 r1338 1205 1205 void CContext::updateCalendar(int step) 1206 1206 { 1207 info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl;1207 //info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 1208 1208 calendar->update(step); 1209 info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl;1209 //info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 1210 1210 #ifdef XIOS_MEMTRACK_LIGHT 1211 1211 info(50) << " Current memory used by XIOS : "<< MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ; -
XIOS/dev/branch_openmp/src/node/field.cpp
r1328 r1338 316 316 while (currentDate >= lastDataRequestedFromServer) 317 317 { 318 info(20) << "currentDate : " << currentDate << endl ;319 info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer << endl ;320 info(20) << "file->output_freq.getValue() : " << file->output_freq.getValue() << endl ;321 info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ;318 //info(20) << "currentDate : " << currentDate << endl ; 319 //info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer << endl ; 320 //info(20) << "file->output_freq.getValue() : " << file->output_freq.getValue() << endl ; 321 //info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ; 322 322 323 323 dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + file->output_freq); … … 518 518 while (isDataLate && timer.getCumulatedTime() < CXios::recvFieldTimeout); 519 519 520 if (isDataLate)521 ERROR("void CField::checkForLateDataFromServer(void)",522 << "Late data at timestep = " << currentDate);520 //if (isDataLate) 521 // ERROR("void CField::checkForLateDataFromServer(void)", 522 // << "Late data at timestep = " << currentDate); 523 523 } 524 524 } -
XIOS/dev/branch_openmp/src/node/file.cpp
r1334 r1338 596 596 597 597 bool isCollective = par_access.isEmpty() || par_access == par_access_attr::collective; 598 599 if (isOpen) data_out->closeFile(); 600 if (time_counter_name.isEmpty()) data_in = boost::shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective)); 601 else data_in = boost::shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective, time_counter_name)); 602 isOpen = true; 598 #ifdef _usingEP 599 //printf("multifile was %d\n", multifile); 600 //multifile = true; 601 if (isOpen) data_out->closeFile(); 602 if (time_counter_name.isEmpty()) data_in = boost::shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective)); 603 else data_in = boost::shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective, time_counter_name)); 604 isOpen = true; 605 #elif _usingMPI 606 if (isOpen) data_out->closeFile(); 607 if (time_counter_name.isEmpty()) data_in = boost::shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective)); 608 else data_in = boost::shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective, time_counter_name)); 609 isOpen = true; 610 #endif 603 611 } 604 612 } … … 655 663 656 664 // Now everything is ok, close it 657 close();665 //close(); 658 666 } 659 667 -
XIOS/dev/branch_openmp/src/test/test_remap_omp.f90
r1334 r1338 95 95 ALLOCATE(lval1(interpolatedLlm)) 96 96 ALLOCATE(lval2(llm2)) 97 lval2 = 0 98 lval=0 99 lval1=0 97 100 98 101 ierr=NF90_INQ_VARID(ncid,"lon",varid) -
XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.cpp
r1334 r1338 405 405 CContext* context = CContext::getCurrent(); 406 406 CContextClient* client=context->client; 407 int mykey; 408 ep_lib::MPI_Comm_rank(client->intraComm, &mykey); 407 409 408 410 ep_lib::MPI_Comm poleComme; 409 ep_lib::MPI_Comm_split(client->intraComm, interMapValuePole.empty() ? 0 : 1, 0, &poleComme); 411 //ep_lib::MPI_Comm_split(client->intraComm, interMapValuePole.empty() ? 0 : 1, 0, &poleComme); 412 ep_lib::MPI_Comm_split(client->intraComm, interMapValuePole.empty() ? 0 : 1, mykey, &poleComme); 410 413 if (!poleComme.is_null()) 411 414 { … … 423 426 std::vector<int> displ(nbClientPole,0); 424 427 ep_lib::MPI_Allgather(&nbWeight,1,MPI_INT,&recvCount[0],1,MPI_INT,poleComme) ; 425 426 428 displ[0]=0; 427 429 for(int n=1;n<nbClientPole;++n) displ[n]=displ[n-1]+recvCount[n-1] ;
Note: See TracChangeset
for help on using the changeset viewer.