[PIPE2D-454] Make findAndTraceApertures go faster Created: 13/Sep/19 Updated: 18/Sep/19 Resolved: 18/Sep/19 |
|
| Status: | Done |
| Project: | DRP 2-D Pipeline |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Story | Priority: | Normal |
| Reporter: | price | Assignee: | price |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Reviewers: | hassan |
| Description |
|
The findAndTraceApertures function consumes a lot of time in constructFiberFlat.py and constructFiberTrace.py. I ran a profile on it, and found the following under the call graph:
32.7 ......... 309.79 / 320.70 pfs::drp::stella::FiberTraceSet<float, int, float> pfs::drp::stella::math::findAndTraceApertures<float, int, float>(lsst::afw::image::MaskedImage<float, int, float> const&, pfs::drp::stella::DetectorMap const&, pfs::drp::stella::FiberTraceFindingControl const&, pfs::drp::stella::FiberTraceFunctionControl const&, pfs::drp::stella::FiberTraceProfileFittingControl const&) [123]
[124] 32.7 309.79 62.12 / 247.66 pfs::drp::stella::math::FindCenterPositionsOneTraceResult pfs::drp::stella::math::findCenterPositionsOneTrace<float, float>(lsst::afw::image::Image<float>&, lsst::afw::image::Image<float> const&, pfs::drp::stella::FiberTraceFindingControl const&, lsst::geom::Point<int, 2> const&)
16.1 ......... 153.05 / 153.05 std::_Rb_tree_increment(std::_Rb_tree_node_base const*) [154]
6.3 ......... 59.61 / 59.62 ndarray::ArrayBase<ndarray::Array<float, 2, 1> >::end() const [208]
1.2 ......... 11.60 / 34.37 boost::intrusive_ptr<ndarray::detail::Core<1> const>::~intrusive_ptr() [215]
I think there's some low-hanging fruit for making this go faster. |
| Comments |
| Comment by price [ 13/Sep/19 ] |
|
I removed what appears to be vestigial code that was chewing up a lot of the runtime, and reduced the runtime for constructFiberFlat.py from 948 sec to 648 sec (almost 32% gain). This removes findAndTraceApertures from the list of tall poles (tall poles for constructFiberFlat.py are now related to I/O and image combination). Here's the call graph for findCenterPositionsOneTrace (same function as above):
1.7 ......... 11.03 / 21.71 pfs::drp::stella::FiberTraceSet<float, int, float> pfs::drp::stella::math::findAndTraceApertures<float, int, float>(lsst::afw::image::MaskedImage<float, int, float> const&, pfs::drp::stella::DetectorMap const&, pfs::drp::stella::FiberTraceFindingControl const&, pfs::drp::stella::FiberTraceFunctionControl const&, pfs::drp::stella::FiberTraceProfileFittingControl const&) [220]
[246] 1.7 11.03 1.88 / 9.15 pfs::drp::stella::math::FindCenterPositionsOneTraceResult pfs::drp::stella::math::findCenterPositionsOneTrace<float, float>(lsst::afw::image::Image<float>&, lsst::afw::image::Image<float> const&, pfs::drp::stella::FiberTraceFindingControl const&, lsst::geom::Point<int, 2> const&)
0.8 ......... 5.33 / 5.33 bool MPFitGaussLim<float>(ndarray::Array<float, 1, 1> const&, ndarray::Array<float, 1, 1> const&, ndarray::Array<float, 1, 1> const&, ndarray::Array<float, 1, 1> const&, ndarray::Array<int, 2, 1> const&, ndarray::Array<float, 2, 1> const&, int, bool, ndarray::Array<float, 1, 1>&, ndarray::Array<float, 1, 1>&, bool) [291]
0.3 ......... 1.65 / 3.78 __GI___exp [336]
0.1 ......... 0.63 / 1.02 boost::intrusive_ptr<ndarray::detail::Core<1> const>::~intrusive_ptr() [584]
[...]
|
| Comment by price [ 13/Sep/19 ] |
|
This appears to shave at least four and perhaps as many as seven or eight minutes off the Travis integration test. |
| Comment by price [ 18/Sep/19 ] |
|
Merged to master. |