Commits
Benjamin Bean authored and Ville Suoranta committed 1f1818cc262 Merge
18 18 | //# |
19 19 | //# Correspondence concerning AIPS++ should be addressed as follows: |
20 20 | //# Internet email: aips2-request@nrao.edu. |
21 21 | //# Postal address: AIPS++ Project Office |
22 22 | //# National Radio Astronomy Observatory |
23 23 | //# 520 Edgemont Road |
24 24 | //# Charlottesville, VA 22903-2475 USA |
25 25 | //# |
26 26 | |
27 27 | |
28 + | |
28 29 | |
29 30 | |
30 31 | |
31 32 | /* Records Interface */ |
32 33 | |
33 34 | |
34 35 | |
35 36 | |
36 37 | |
37 38 | |
381 382 | } |
382 383 | |
383 384 | void |
384 385 | DistSIIterBot_state::mergeMinorCycleSummary(const Array<Double>& summary) { |
385 386 | std::lock_guard<std::recursive_mutex> guard(recordMutex); |
386 387 | |
387 388 | IPosition accSummaryShape = itsSummaryMinor.shape(); |
388 389 | IPosition summaryShape = summary.shape(); |
389 390 | |
390 391 | if (accSummaryShape.nelements() != 2 |
391 - | || accSummaryShape[0] != itsNSummaryFields |
392 + | || accSummaryShape[0] != SIMinorCycleController::nSummaryFields |
392 393 | || summaryShape.nelements() != 2 |
393 - | || summaryShape[0] != itsNSummaryFields) |
394 + | || summaryShape[0] != SIMinorCycleController::nSummaryFields) |
394 395 | throw AipsError( |
395 396 | "Internal error in shape of global minor-cycle summary record"); |
396 397 | |
397 398 | itsSummaryMinor.resize( |
398 - | IPosition(2, itsNSummaryFields, accSummaryShape[1] + summaryShape[1]), |
399 + | IPosition(2, SIMinorCycleController::nSummaryFields, accSummaryShape[1] + summaryShape[1]), |
399 400 | true); |
400 401 | |
401 402 | ArrayIterator<Double> summaryIter(summary, IPosition(1, 1), false); |
402 403 | ArrayIterator<Double> accSummaryIter(itsSummaryMinor, IPosition(1, 1), |
403 404 | false); |
404 405 | accSummaryIter.set(IPosition(1, accSummaryShape[1])); |
405 406 | |
406 - | IPosition i0 = IPosition(1, 0); |
407 + | IPosition i0 = IPosition(1, 0); // iterations done |
408 + | IPosition i7 = IPosition(1, 7); // cycle start iterations done |
409 + | IPosition i8 = IPosition(1, 8); // starting iterations done |
407 410 | while (!summaryIter.pastEnd()) { |
408 411 | accSummaryIter.array() = summaryIter.array(); |
409 412 | accSummaryIter.array()(i0) += itsIterDone; |
413 + | accSummaryIter.array()(i7) += itsIterDone; |
414 + | accSummaryIter.array()(i8) += itsIterDone; |
410 415 | accSummaryIter.next(); |
411 416 | summaryIter.next(); |
412 417 | } |
413 418 | } |
414 419 | |
415 420 | Record |
416 421 | DistSIIterBot_state::getSummaryRecord() { |
417 422 | LogIO os(LogOrigin("DistSIIterBot_state", __FUNCTION__, WHERE)); |
418 423 | std::lock_guard<std::recursive_mutex> guard(recordMutex); |
419 424 | |
449 454 | std::memcpy(acc.data(), summaryStore, summarySize * sizeof(double)); |
450 455 | itsSummaryMinor.freeVStorage(summaryStore, delSummaryStore); |
451 456 | |
452 457 | // Gather summaries |
453 458 | MPI_Gatherv( |
454 459 | ((rank == 0) ? MPI_IN_PLACE : acc.data()), summarySize, MPI_DOUBLE, |
455 460 | acc.data(), allSizes.data(), displs.data(), MPI_DOUBLE, |
456 461 | 0, comm); |
457 462 | |
458 463 | // Create Array of expected shape from acc |
459 - | IPosition totalSummaryShape(2, itsNSummaryFields, |
460 - | totalSize / itsNSummaryFields); |
464 + | IPosition totalSummaryShape(2, SIMinorCycleController::nSummaryFields, |
465 + | totalSize / SIMinorCycleController::nSummaryFields); |
461 466 | Array<Double> totalSummary(totalSummaryShape, acc.data(), SHARE); |
462 467 | |
463 468 | // Create return Record |
464 469 | Record returnRecord = getDetailsRecord(); |
465 470 | returnRecord.define("interactiveiterdone", |
466 471 | returnRecord.asInt("interactiveiterdone") |
467 472 | + returnRecord.asInt("cycleiterdone")); |
468 473 | returnRecord.define("summaryminor", totalSummary); |
469 474 | returnRecord.define("summarymajor", itsSummaryMajor); |
470 475 | return returnRecord; |