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

Reduce dependency on eigen #31735

Open
Dr15Jones opened this issue Oct 9, 2020 · 15 comments
Open

Reduce dependency on eigen #31735

Dr15Jones opened this issue Oct 9, 2020 · 15 comments

Comments

@Dr15Jones
Copy link
Contributor

FWLite only depends on eigen because of the tenous use of that package by DataFormats/HGCalReco and DataFormats/Math.

DataFormats/HGCalReco/interface/Trackster.h uses eigen only in a member function that takes eigen classes and converts them into std::array's. This dependency could be removed either by converting that function to be templated (since it is all inlined anyway) or by using a stand alone function to do the conversion. The function in question, Trackster::fillPCAVariables is only ever called from RecoHGCal/TICL/plugins/TrackstersPCA.cc so the conversion could be done there.

DataFormats/Math/interface/choleskyInversion.h is the only use of eigen in DataFormats/Math and the header is not used anywhere in CMSSW except in the unit test for the function. This file could either be removed entirely from CMSSW or moved to a non DataFormats package.

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 9, 2020

A new Issue was created by @Dr15Jones Chris Jones.

@Dr15Jones, @dpiparo, @silviodonato, @smuzaffar, @makortel, @qliphy can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@Dr15Jones
Copy link
Contributor Author

assign reconstruction, upgrade

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 9, 2020

New categories assigned: upgrade,reconstruction

@slava77,@perrotta,@jpata,@kpedro88 you have been requested to review this Pull request/Issue and eventually sign? Thanks

@kpedro88
Copy link
Contributor

kpedro88 commented Oct 9, 2020

@rovere can you see if it's feasible to relocate the eigen dependence for Trackster?

@VinInn @fwyzard can you look at choleskyInversion?

@makortel
Copy link
Contributor

makortel commented Oct 9, 2020

#31722 adds a dependence DataFormats/Math/interface/choleskyInversion.h, but the use in there does not preclude moving it to a non-DataFormat package.

@fwyzard
Copy link
Contributor

fwyzard commented Oct 9, 2020 via email

@VinInn
Copy link
Contributor

VinInn commented Oct 10, 2020

Historically Math is in DataFormat. Was not my decision as was not my decision to swallow SMatrix in Root.
Most probably we will migrate to eigen more and more, so just accept the fact that eigen is first class in cms

@Dr15Jones
Copy link
Contributor Author

@davidlange6 FYI

@rovere
Copy link
Contributor

rovere commented Oct 18, 2020

Could someone explain why we need to reduce the dependency from Eigen?

@slava77
Copy link
Contributor

slava77 commented Oct 18, 2020

Could someone explain why we need to reduce the dependency from Eigen?

IIUC, it's for DataFormats.
To invert your question, what are the reasons a subsystem dealing with persisted data should have dependency on Eigen?

@rovere
Copy link
Contributor

rovere commented Oct 18, 2020

No data-type eigen-specific is used to persist anything, IIRC.
Eigen is introduced via member functions, as @Dr15Jones already mentioned in his first post.
So, again, can someone explain why the dependency on Eigen is something we should reduce?

@VinInn
Copy link
Contributor

VinInn commented Oct 18, 2020

Same applies to Math Geometry* etc.
Or even more in general to anything that can be casted to an array of float or double or to std::byte* ...
I think we will move to eigen as matrix class.

@Dr15Jones
Copy link
Contributor Author

So, again, can someone explain why the dependency on Eigen is something we should reduce?

The request is not specific to Eigen but is true in general (you can see other recent pull requests I've done to reduce DataFormats dependencies on externals). Beyond the good practice in large scale software design to minimize dependencies in order to improve build times and eas maintenance, classes in DataFormats have some additional reasons to minimize external dependencies

  1. We are trying to make use of ROOT's new C++ modules mechanism for ROOT dictionaries. This is supposed to give us faster and less memory intensive dictionary usage. However, each external seen in a .h file requires the specification of its own module declaration which is quite involved and has to be constantly maintained as we update versions of the external.
  2. We are working with HPC specialists on improving IO. To do that, they need to be able to build our code and do not want our entire software stack. To that end, we've create a way to use CMake to make only those CMSSW packages needed to use the ROOT dictionaries for data products stored in our production files. Every additional external required for those packages makes it just that much harder to setup that build.
  3. We have an FWLite distribution which can be used via the package manager 'conda'. Each additional external dependency we have for FWLite makes it that much more difficult to maintain.

@slava77
Copy link
Contributor

slava77 commented Nov 16, 2020

@Dr15Jones
do I understand your comment #31735 (comment) correctly that once a dependency on X is added in one place of DataFormats, it roughly does not matter how many more places will depend on this X in DataFormats?
Or is there a package by package burden of maintenance?

@Dr15Jones
Copy link
Contributor Author

do I understand your comment #31735 (comment) correctly that once a dependency on X is added in one place of DataFormats, it roughly does not matter how many more places will depend on this X in DataFormats?

I think to first order that is correct. On a package basis, I think it just increases the time and memory needed to compile the code.

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

8 participants