-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Implement ROOT read rules for PortableHostCollection #43219
Implement ROOT read rules for PortableHostCollection #43219
Conversation
rule->fSource = "portabletest::TestHostCollection::Layout layout_;"; | ||
rule->fTarget = ""; | ||
rule->fFunctionPtr = (void *)TFunc2void(setROOTReadStreamerFor_portabletest_TestHostCollection); | ||
rule->fCode = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is could be set to "portabletest::TestHostCollection::ROOTReadStreamer(newObj, onfile.layout_);"
.
For the moment it is left empty on purpose, in case we decide to modify setROOTReadStreamerFor_portabletest_TestHostCollection()
and portabletest::TestHostCollection::ROOTReadStreamer()
in a way that cannot be reflected in the XML read rule.
@@ -0,0 +1,52 @@ | |||
#define G__DICTIONARY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required by RtypesImp.h
, which is needed for TFunc2void
.
|
||
// read function for portabletest::TestHostCollection | ||
// called for every event | ||
static void setROOTReadStreamerFor_portabletest_TestHostCollection(char *target, TVirtualObject *oldObj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a better name :-)
Would it be a good idea to make it a (static
or regular) member function of PortableHostCollection
?
It could simplify the interface, but the main downside I can think of is that it would add a dependency on the ROOT internals to the CMS type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd avoid making PortableHostCollection
dependent on ROOT.
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43219/37560
Code check has found code style and quality issues which could be resolved by applying following patch(s)
|
@makortel @ericcano @pcanal here is what I've come up with so far, base on the discussion we had this afternoon. The idea would be to move as much as possible of the functionality to a set of macros or templates, so that the user would need to implement as little as possible. Comments and suggestions are welcome. By the way, can you think of any way to do this without requiring a new |
sourceClass="portabletest::TestHostCollection" | ||
targetClass="portabletest::TestHostCollection" | ||
version="[1-]" | ||
source="portabletest::TestSoA layout_;" | ||
target="buffer_,layout_,view_" | ||
target="" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I misunderstood how the target
directive works.
After reading the code generated by ROOT, I don't think we need to specify these, even if we were to stay with the XML approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They definitively are needed. They may not change the content of the generated function but they affect significantly the way TStreamerInfo handles the rules. As Matti said, not specifying will lead to 'huge' memory leak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you show me what is affected by the definition of the target
entry ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a bit complicated and indirect but you can start by looking the consequence of those lines:
io/io/src/TStreamerInfo.cxx
639: && rules && !rules.HasRuleWithTarget( element->GetName(), kTRUE ) )
2508: && !rules.HasRuleWithTarget( element->GetName(), kTRUE ) ) {
2530: } else if (rules.HasRuleWithTarget( element->GetName(), kTRUE ) ) {
2542: } else if (rules && rules.HasRuleWithTarget( element->GetName(), kTRUE ) ) {
io/io/src/TStreamerInfo.cxx
4548: if ( rule->HasTarget( element->GetName() ) ) {
io/io/src/TStreamerInfo.cxx
1850: const TObjArray* targets = rule->GetTarget();
4595: if (rule->GetTarget()==0) {
4607: toAdd.reserve(rule->GetTarget()->GetEntriesFast());
4608: TObjString * objstr = (TObjString*)(rule->GetTarget()->At(0));
4625: for(Int_t other = 1; other < rule->GetTarget()->GetEntriesFast(); ++other) {
4626: objstr = (TObjString*)(rule->GetTarget()->At(other));
In particular line 639, 2508, 4548, 4626 or even 4595
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
So the effect is not in the code generated by the read rules, but deeper in TStreamerInfo
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly.
please test |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43219/37561
|
A new Pull Request was created by @fwyzard (Andrea Bocci) for master. It involves the following packages:
@makortel, @fwyzard can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-b543d1/35676/summary.html Comparison SummarySummary:
|
Comparison differences are related to #39803 |
ca26006
to
39e4240
Compare
4e52d51
to
ceab451
Compare
please test |
+heterogeneous |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43219/37596
|
Pull request #43219 was updated. can you please check and sign again. |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-b543d1/35733/summary.html Comparison SummarySummary:
|
Comparison differences are related to #39803 |
+1 |
PR description:
Implement ROOT read rules for
PortableHostCollection
instantiations.These replace the user-defined read rules in the XML file
with a macro-based C++ implementation in
DataFormats/PortableTestObjects/src/classes.cc
:PR validation:
The
HeterogeneousCore/AlpakaTest/test/testHeterogeneousCoreAlpakaTestWriteRead.sh
unit test pass:portabletest::TestHostCollection
is written to a ROOT file;