Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Phase2 RelVal] O(100 MB) memory held per event from HGCalGeometry::getGeometry() in PFRecHits #46511

Open
makortel opened this issue Oct 24, 2024 · 8 comments

Comments

@makortel
Copy link
Contributor

makortel commented Oct 24, 2024

From #45854 (comment)

The container of PFRecHit produced by PFRecHitProducer::produce() ends up holding O(100 MB) memory per event (I suppose the exact value depends on the event itself) allocated in HGCalGeometry::getGeometry() as shown in IgProf profile.

Given the related issue #46433, I think the rationale for creating these geometry elements on the fly should at least documented, if not re-evaluated.

@makortel
Copy link
Contributor Author

assign geometry, upgrade

@cmsbuild
Copy link
Contributor

New categories assigned: geometry,upgrade

@bsunanda,@civanch,@Dr15Jones,@kpedro88,@makortel,@mdhildreth,@Moanwar,@srimanob,@subirsarkar you have been requested to review this Pull request/Issue and eventually sign? Thanks

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 24, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

A new Issue was created by @makortel.

@Dr15Jones, @antoniovilela, @makortel, @mandrenguyen, @rappoccio, @sextonkennedy, @smuzaffar can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@makortel
Copy link
Contributor Author

@cms-sw/hgcal-dpg-l2

@makortel
Copy link
Contributor Author

Are the FlatTrd and FlatHexagon copied on the fly in order to save memory?

std::shared_ptr<const CaloCellGeometry> HGCalGeometry::cellGeomPtr(uint32_t index, const GlobalPoint& pos) const {
if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
(index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) || (m_validGeomIds[index].rawId() == 0))
return nullptr;
if (pos == GlobalPoint())
return cellGeomPtr(index);
if (m_det == DetId::HGCalHSc) {
auto cell = std::make_shared<FlatTrd>(m_cellVec2[index]);
cell->setPosition(pos);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
#endif
if (nullptr == cell->param())
return nullptr;
return cell;
} else {
auto cell = std::make_shared<FlatHexagon>(m_cellVec[index]);
cell->setPosition(pos);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
#endif
if (nullptr == cell->param())
return nullptr;
return cell;
}
}

If this is the case, how much memory would be needed to store these all the time?

Or is the rationale something different?

@makortel makortel changed the title [Phase2 RelVal] O(100 MB) memory held per event from HGCalGeometry::getGeometry() [Phase2 RelVal] O(100 MB) memory held per event from HGCalGeometry::getGeometry() in PFRecHits Oct 24, 2024
@makortel
Copy link
Contributor Author

Adding @cms-sw/reconstruction-l2 @cms-sw/pf-l2 because of the connection to PFRecHit

@makortel
Copy link
Contributor Author

type performance-improvements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants