Commits

The diff should be clean now. Some changes in fudge_factor, etc. were still there. Revert "Some minor tweaks to required memory calculation for mosaic"

This reverts commit 75114f88555199bf7bfbe07d75df79a16c16b3a7.

code/synthesis/ImagerObjects/SynthesisImager.cc

Modified
1494 1494
1495 1495 // Do calculation here.
1496 1496 // This runs once per image field (for multi-field imaging)
1497 1497 // This runs once per cube partition, and will see only its own partition's shape
1498 1498 chanchunks=1;
1499 1499
1500 1500 CompositeNumber cn(uInt(imshape[0] * 2));
1501 1501 // heuristic factors multiplied to imshape based on gridder
1502 1502 size_t fudge_factor = 15;
1503 1503 if (ftm->name()=="MosaicFTNew") {
1504 - fudge_factor = 17;
1504 + fudge_factor = 15;
1505 1505 }
1506 1506 else if (ftm->name()=="GridFT") {
1507 1507 fudge_factor = 9;
1508 1508 }
1509 1509
1510 - Double required_mem = fudge_factor * sizeof(Float);
1510 + size_t required_mem = fudge_factor * sizeof(Float);
1511 1511 for (size_t i = 0; i < imshape.nelements(); i++) {
1512 1512 // gridding pads image and increases to composite number
1513 1513 if (i < 2) {
1514 1514 required_mem *= cn.nextLargerEven(Int(padding*Float(imshape[i])-0.5));
1515 1515 }
1516 1516 else {
1517 1517 required_mem *= imshape[i];
1518 1518 }
1519 1519 }
1520 1520
1521 1521 // get number of tclean processes running on the same machine
1522 1522 size_t nlocal_procs = 1;
1523 1523 if (getenv("OMPI_COMM_WORLD_LOCAL_SIZE")) {
1524 1524 std::stringstream ss(getenv("OMPI_COMM_WORLD_LOCAL_SIZE"));
1525 1525 ss >> nlocal_procs;
1526 1526 }
1527 1527 // assumes all processes need the same amount of memory
1528 1528 required_mem *= nlocal_procs;
1529 +
1529 1530 Double usr_memfrac, usr_mem;
1530 1531 AipsrcValue<Double>::find(usr_memfrac, "system.resources.memfrac", 80.);
1531 1532 AipsrcValue<Double>::find(usr_mem, "system.resources.memory", -1024.);
1532 1533 Double memory_avail;
1533 1534 if (usr_mem > 0.) {
1534 1535 memory_avail = usr_mem * 1024. * 1024.;
1535 1536 }
1536 1537 else {
1537 - memory_avail = Double(HostInfo::memoryFree()) * (usr_memfrac / 100.) * 1024.;
1538 + memory_avail = HostInfo::memoryTotal(false) * (usr_memfrac / 100.) * 1024.;
1538 1539 }
1539 1540
1541 +
1540 1542 // compute required chanchunks to fit into the available memory
1541 1543 chanchunks = (int)std::ceil((Double)required_mem / memory_avail);
1542 1544 if (imshape.nelements() == 4 && imshape[3] < chanchunks) {
1543 1545 chanchunks = imshape[3];
1544 1546 // TODO make chanchunks a divisor of nchannels?
1545 1547 }
1546 1548 chanchunks = chanchunks < 1 ? 1 : chanchunks;
1547 1549
1548 1550 log_l << "Required memory " << required_mem / nlocal_procs / 1024. / 1024. / 1024.
1549 1551 << "\nAvailable memory " << memory_avail / 1024. / 1024 / 1024.

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut