Skip to content

Commit aec9b2a

Browse files
authored
Merge pull request #48824 from makortel/portableCollectionDictionary
Improve `PortableHost{Collection,Object}` dictionary declarations
2 parents 9507479 + d001897 commit aec9b2a

File tree

12 files changed

+117
-59
lines changed

12 files changed

+117
-59
lines changed

DataFormats/BeamSpot/src/classes_def.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@
55
</class>
66
<class name="edm::Wrapper<reco::BeamSpot>"/>
77

8+
<class name="BeamSpotHost"/>
9+
<!-- BeamSpotHost::Product must be listed before the aliased-to type -->
10+
<!-- TODO: we should find a better way than replicating the class versions and checksums -->
11+
<class name="BeamSpotHost::Product" ClassVersion="3">
12+
<version ClassVersion="3" checksum="280341519"/>
13+
</class>
14+
815
<class name="BeamSpotPOD" ClassVersion="3">
916
<version ClassVersion="3" checksum="280341519"/>
1017
</class>
1118
<class name="edm::Wrapper<BeamSpotPOD>"/>
1219

13-
<class name="BeamSpotHost"/>
1420
<class name="edm::Wrapper<BeamSpotHost>"/>
1521
</lcgdict>

DataFormats/EcalRecHit/src/classes_def.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@
3939
<class name="edm::Wrapper<edm::DetSetVector<EcalRecHit> >"/>
4040
<class name="edm::Wrapper<std::vector<std::vector<edm::DetSet<EcalRecHit> > > >"/>
4141

42+
<class name="EcalUncalibratedRecHitHostCollection"/>
43+
<!-- EcalUncalibratedRecHitHostCollection::Layout must be listed before the aliased-to type -->
44+
<class name="EcalUncalibratedRecHitHostCollection::Layout"/>
4245
<class name="EcalOotAmpArray"/>
4346
<class name="EcalUncalibratedRecHitSoA"/>
4447
<class name="EcalUncalibratedRecHitSoA::View"/>
45-
<class name="EcalUncalibratedRecHitHostCollection"/>
4648
<class name="edm::Wrapper<EcalUncalibratedRecHitHostCollection>" splitLevel="0"/>
4749

50+
<class name="EcalRecHitHostCollection"/>
51+
<!-- EcalRecHitHostCollection::Layout must be listed before the aliased-to type -->
52+
<class name="EcalRecHitHostCollection::Layout"/>
4853
<class name="EcalRecHitSoA"/>
4954
<class name="EcalRecHitSoA::View"/>
50-
<class name="EcalRecHitHostCollection"/>
5155
<class name="edm::Wrapper<EcalRecHitHostCollection>" splitLevel="0"/>
5256

5357
</lcgdict>

DataFormats/HGCalReco/src/classes_def.xml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,29 @@
7676
<class name="edm::Wrapper<TICLCandidate>" />
7777
<class name="edm::Wrapper<std::vector<TICLCandidate> >" />
7878

79+
<class name="MtdHostCollection"/>
80+
<!-- MtdHostCollection::Layout must be listed before the aliased-to type -->
81+
<class name="MtdHostCollection::Layout"/>
7982
<class name="MtdSoA"/>
8083
<class name="MtdSoA::View"/>
81-
82-
<class name="MtdHostCollection"/>
8384
<class name="edm::Wrapper<MtdHostCollection>" splitLevel="0"/>
8485

86+
<class name="HGCalSoARecHitsHostCollection"/>
87+
<!-- HGCalSoARecHitsHostCollection::Layout must be listed before the aliased-to type -->
88+
<class name="HGCalSoARecHitsHostCollection::Layout"/>
8589
<class name="HGCalSoARecHits"/>
86-
<class name="HGCalSoARecHitsHostCollection" ClassVersion="3" rntupleStreamerMode="true">
87-
<version ClassVersion="3" checksum="1452864040"/>
88-
</class>
8990
<class name="edm::Wrapper<HGCalSoARecHitsHostCollection>" splitLevel="0"/>
9091

91-
<class name="HGCalSoARecHitsExtra"/>
9292
<class name="HGCalSoARecHitsExtraHostCollection" rntupleStreamerMode="true"/>
93+
<!-- HGCalSoARecHitsExtraHostCollection::Layout must be listed before the aliased-to type -->
94+
<class name="HGCalSoARecHitsExtraHostCollection::Layout"/>
95+
<class name="HGCalSoARecHitsExtra"/>
9396
<class name="edm::Wrapper<HGCalSoARecHitsExtraHostCollection>" splitLevel="0"/>
9497

95-
<class name="HGCalSoAClusters"/>
9698
<class name="HGCalSoAClustersHostCollection" rntupleStreamerMode="true"/>
99+
<!-- HGCalSoAClustersHostCollection::Layout must be listed before the aliased-to type -->
100+
<class name="HGCalSoAClustersHostCollection::Layout"/>
101+
<class name="HGCalSoAClusters"/>
97102
<class name="edm::Wrapper<HGCalSoAClustersHostCollection>" splitLevel="0"/>
98103

99104
</lcgdict>

DataFormats/HcalDigi/src/classes_def.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,19 @@
114114
</class>
115115
<class name="edm::Wrapper<HcalUMNioDigi>" splitLevel="0"/>
116116

117-
<class name="hcal::HcalPhase1DigiSoA"/>
118-
<class name="hcal::HcalPhase0DigiSoA"/>
119-
<class name="hcal::HcalPhase1DigiSoA::View"/>
120-
<class name="hcal::HcalPhase0DigiSoA::View"/>
121117

122118
<class name="hcal::Phase1DigiHostCollection"/>
119+
<!-- hcal::Phase1DigiHostCollection::Layout must be listed before the aliased-to type -->
120+
<class name="hcal::Phase1DigiHostCollection::Layout"/>
121+
<class name="hcal::HcalPhase1DigiSoA"/>
122+
<class name="hcal::HcalPhase1DigiSoA::View"/>
123123
<class name="edm::Wrapper<hcal::Phase1DigiHostCollection>" splitLevel="0"/>
124124

125125
<class name="hcal::Phase0DigiHostCollection"/>
126+
<!-- hcal::Phase0DigiHostCollection::Layout must be listed before the aliased-to type -->
127+
<class name="hcal::Phase0DigiHostCollection::Layout"/>
128+
<class name="hcal::HcalPhase0DigiSoA"/>
129+
<class name="hcal::HcalPhase0DigiSoA::View"/>
126130
<class name="edm::Wrapper<hcal::Phase0DigiHostCollection>" splitLevel="0"/>
127131

128132
</lcgdict>

DataFormats/HcalRecHit/src/classes_def.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@
120120
<class name="edm::reftobase::Holder<CaloRecHit,edm::Ref<edm::SortedCollection<HORecHit,edm::StrictWeakOrdering<HORecHit> >,HORecHit,edm::refhelper::FindUsingAdvance<edm::SortedCollection<HORecHit,edm::StrictWeakOrdering<HORecHit> >,HORecHit> > >" />
121121
<class name="edm::reftobase::Holder<CaloRecHit,edm::Ref<edm::SortedCollection<HBHERecHit,edm::StrictWeakOrdering<HBHERecHit> >,HBHERecHit,edm::refhelper::FindUsingAdvance<edm::SortedCollection<HBHERecHit,edm::StrictWeakOrdering<HBHERecHit> >,HBHERecHit> > >" />
122122

123+
<class name="hcal::RecHitHostCollection" />
124+
<!-- hcal::RecHitHostCollection::Layout must be listed before the aliased-to type -->
125+
<class name="hcal::RecHitHostCollection::Layout" />
123126
<class name="hcal::HcalRecHitSoA"/>
124127
<class name="hcal::HcalRecHitSoA::View"/>
125-
<class name="hcal::RecHitHostCollection" />
126128
<class name="edm::Wrapper<hcal::RecHitHostCollection>" splitLevel="0"/>
127129
</lcgdict>
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
<lcgdict>
2+
<class name="reco::CaloRecHitHostCollection"/>
3+
<!-- reco::CaloRecHitHostCollection::Layout must be listed before the aliased-to type -->
4+
<class name="reco::CaloRecHitHostCollection::Layout"/>
25
<class name="reco::CaloRecHitSoA"/>
36
<class name="reco::CaloRecHitSoA::View"/>
4-
<class name="reco::CaloRecHitHostCollection" ClassVersion="3">
5-
<version ClassVersion="3" checksum="1876594952"/>
6-
</class>
77
<class name="edm::Wrapper<reco::CaloRecHitHostCollection>" splitLevel="0"/>
88

9+
<class name="reco::PFRecHitHostCollection"/>
10+
<!-- reco::PFRecHitHostCollection::Layout must be listed before the aliased-to type -->
11+
<class name="reco::PFRecHitHostCollection::Layout"/>
912
<class name="reco::PFRecHitSoA"/>
1013
<class name="reco::PFRecHitSoA::View"/>
11-
<class name="reco::PFRecHitHostCollection" ClassVersion="3">
12-
<version ClassVersion="3" checksum="1936051484"/>
13-
</class>
1414
<class name="edm::Wrapper<reco::PFRecHitHostCollection>" splitLevel="0"/>
1515

16+
<class name="reco::PFClusterHostCollection"/>
17+
<!-- reco::PFClusterHostCollection::Layout must be listed before the aliased-to type -->
18+
<class name="reco::PFClusterHostCollection::Layout"/>
1619
<class name="reco::PFClusterSoA"/>
1720
<class name="reco::PFClusterSoA::View"/>
18-
<class name="reco::PFClusterHostCollection" ClassVersion="3">
19-
<version ClassVersion="3" checksum="1232566394"/>
20-
</class>
2121
<class name="edm::Wrapper<reco::PFClusterHostCollection>" splitLevel="0"/>
2222

23+
<class name="reco::PFRecHitFractionHostCollection"/>
24+
<!-- reco::PFRecHitFractionHostCollection::Layout must be listed before the aliased-to type -->
25+
<class name="reco::PFRecHitFractionHostCollection::Layout"/>
2326
<class name="reco::PFRecHitFractionSoA"/>
2427
<class name="reco::PFRecHitFractionSoA::View"/>
25-
<class name="reco::PFRecHitFractionHostCollection" ClassVersion="3">
26-
<version ClassVersion="3" checksum="2181211668"/>
27-
</class>
2828
<class name="edm::Wrapper<reco::PFRecHitFractionHostCollection>" splitLevel="0"/>
2929
</lcgdict>

DataFormats/Portable/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ would create the file `classes.cc` with the content:
3434

3535
SET_PORTABLEHOSTOBJECT_READ_RULES(portabletest::TestHostObject);
3636
```
37+
**Note:** The dictionary for `portabletest::TestHostObject::Product` (using the same type alias as in the registration macro above) must be placed in the `classes_def.xml` file before the type that `Product` aliases.
38+
3739
3840
`PortableHostObject<T>` objects can also be read back in "bare ROOT" mode, without any dictionaries.
3941
They have no implicit or explicit references to alpaka (neither as part of the class signature nor as part of its name).
@@ -93,6 +95,8 @@ one would create the file `classes.cc` with the content:
9395

9496
SET_PORTABLEHOSTCOLLECTION_READ_RULES(portabletest::TestHostCollection);
9597
```
98+
**Note:** The dictionary for `portabletest::TestHostCollection::Layout` (using the same type alias as in the registration macro above) must be placed in the `classes_def.xml` file before the type that `Layout` aliases.
99+
96100
97101
`PortableHostCollection<T>` collections can also be read back in "bare ROOT" mode, without any dictionaries.
98102
They have no implicit or explicit references to alpaka (neither as part of the class signature nor as part of its name).
@@ -159,6 +163,7 @@ Both scripts expect the collections to be aliased as in:
159163
```
160164
using TestDeviceMultiCollection3 = PortableCollection3<TestSoA, TestSoA2, TestSoA3>;
161165
```
166+
and assume the `TestDeviceMultiCollection3` is used in the `SET_PORTABLEHOSTMULTICOLLECTION_READ_RULES()` macro.
162167
163168
For the host xml, SoA layouts have to be listed and duplicates should be removed manually is multiple
164169
collections share a same layout. The scripts are called as follows:

DataFormats/Portable/scripts/portableHostCollectionHints

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ print("<lcgdict>")
1616
for l in layouts:
1717
print(" <class name=\"%s\"/>"% l)
1818
print()
19+
print(" <!-- Collection declaration for dictionary -->")
20+
print(" <class name=\"%s\"/>"% collectionName)
21+
print(" <!-- %s::Implementation alias must be listed before the aliased-to type -->"% collectionName)
22+
print(" <class name=\"%s::Implementation\"/>"% collectionName)
23+
print()
1924
if len(layouts) > 1:
2025
print(" <!-- Recursive templates (with no data) ensuring we have one CollectionLeaf<index, type> for each layout in the collection -->")
2126
for i in range(0, len(layouts)):
@@ -27,7 +32,5 @@ if len(layouts) > 1:
2732
for i in range(0, len(layouts)):
2833
print(" <class name=\"portablecollection::CollectionLeaf<%d, %s>\"/>" % (i, layouts[i]))
2934
print("")
30-
print(" <!-- Collection declaration for dictionary -->")
31-
print(" <class name=\"%s\"/>"% collectionName)
3235
print(" <class name=\"edm::Wrapper<%s>\" splitLevel=\"0\"/>"% collectionName)
3336
print("</lcgdict>")
Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,34 @@
11
<lcgdict>
22
<class name="portabletest::TestHostCollection"/>
3+
<!-- portabletest::TestHostCollection::Layout alias must be listed before the aliased-to type -->
4+
<class name="portabletest::TestHostCollection::Layout"/>
35
<class name="edm::Wrapper<portabletest::TestHostCollection>" splitLevel="0"/>
46

5-
<class name="portabletest::TestStruct"/>
67
<class name="portabletest::TestHostObject"/>
8+
<!-- portabletest::TestHostObject::Product alias must be listed before the aliased-to type -->
9+
<!-- TODO: we should find a better way than replicating the class versions and checksums -->
10+
<class name="portabletest::TestHostObject::Product" ClassVersion="3">
11+
<version ClassVersion="3" checksum="1507282054"/>
12+
</class>
13+
<class name="portabletest::TestStruct" ClassVersion="3">
14+
<version ClassVersion="3" checksum="1507282054"/>
15+
</class>
716
<class name="edm::Wrapper<portabletest::TestHostObject>"/>
817

918
<class name="portabletest::TestSoALayout<128,false>"/>
1019
<class name="portabletest::TestSoALayout2<128,false>"/>
1120
<class name="portabletest::TestSoALayout3<128,false>"/>
1221

22+
<!-- Collection declaration for dictionary -->
23+
<class name="portabletest::TestHostMultiCollection2"/>
24+
<!-- portabletest::TestHostObject::Implementation alias must be listed before the aliased-to type -->
25+
<class name="portabletest::TestHostMultiCollection2::Implementation"/>
26+
27+
<!-- Collection declaration for dictionary -->
28+
<class name="portabletest::TestHostMultiCollection3"/>
29+
<!-- portabletest::TestHostObject::Implementation alias must be listed before the aliased-to type -->
30+
<class name="portabletest::TestHostMultiCollection3::Implementation"/>
31+
1332
<!-- Recursive templates (with no data) ensuring we have one CollectionLeaf<index, type> for each layout in the collection -->
1433
<class name="portablecollection::CollectionImpl<0, portabletest::TestSoALayout<128, false>, portabletest::TestSoALayout2<128, false>>"/>
1534
<class name="portablecollection::CollectionImpl<1, portabletest::TestSoALayout2<128, false>>"/>
@@ -18,9 +37,6 @@
1837
<class name="portablecollection::CollectionLeaf<0, portabletest::TestSoALayout<128, false>>"/>
1938
<class name="portablecollection::CollectionLeaf<1, portabletest::TestSoALayout2<128, false>>"/>
2039

21-
<!-- Collection declaration for dictionary -->
22-
<class name="portabletest::TestHostMultiCollection2"/>
23-
2440
<class name="edm::Wrapper<portabletest::TestHostMultiCollection2>" splitLevel="0"/>
2541

2642
<!-- Recursive templates (with no data) ensuring we have one CollectionLeaf<index, type> for each layout in the collection -->
@@ -35,48 +51,57 @@
3551
-->
3652
<class name="portablecollection::CollectionLeaf<2, portabletest::TestSoALayout3<128, false>>"/>
3753

38-
<!-- Collection declaration for dictionary -->
39-
<class name="portabletest::TestHostMultiCollection3"/>
40-
4154
<class name="edm::Wrapper<portabletest::TestHostMultiCollection3>" splitLevel="0"/>
4255

4356
<class name="portabletest::TestProductWithPtr<alpaka_common::DevHost>"/>
4457
<class name="edm::Wrapper<portabletest::TestProductWithPtr<alpaka_common::DevHost>>" persistent="false"/>
4558

4659
<!-- Torch SoAs and Collections -->
60+
<class name="portabletest::ParticleHostCollection"/>
61+
<!-- portabletest::ParticleHostCollection::Layout must be listed before the aliased-to type -->
62+
<class name="portabletest::ParticleHostCollection::Layout"/>
4763
<class name="portabletest::ParticleSoA"/>
4864
<class name="portabletest::ParticleSoA::View"/>
4965
<class name="portabletest::ParticleSoA::ConstView"/>
50-
<class name="portabletest::ParticleHostCollection"/>
5166
<class name="edm::Wrapper<portabletest::ParticleHostCollection>" splitLevel="0"/>
5267

68+
<class name="portabletest::SimpleNetHostCollection"/>
69+
<!-- portabletest::SimpleNetHostCollection::Layout must be listed before the aliased-to type -->
70+
<class name="portabletest::SimpleNetHostCollection::Layout"/>
5371
<class name="portabletest::SimpleNetSoA"/>
5472
<class name="portabletest::SimpleNetSoA::View"/>
5573
<class name="portabletest::SimpleNetSoA::ConstView"/>
56-
<class name="portabletest::SimpleNetHostCollection"/>
5774
<class name="edm::Wrapper<portabletest::SimpleNetHostCollection>" splitLevel="0"/>
5875

76+
<class name="portabletest::MultiHeadNetHostCollection"/>
77+
<!-- portabletest::MultiHeadNetHostCollection::Layout must be listed before the aliased-to type -->
78+
<class name="portabletest::MultiHeadNetHostCollection::Layout"/>
5979
<class name="portabletest::MultiHeadNetSoA"/>
6080
<class name="portabletest::MultiHeadNetSoA::View"/>
6181
<class name="portabletest::MultiHeadNetSoA::ConstView"/>
62-
<class name="portabletest::MultiHeadNetHostCollection"/>
6382
<class name="edm::Wrapper<portabletest::MultiHeadNetHostCollection>" splitLevel="0"/>
6483

84+
<class name="portabletest::ImageHostCollection"/>
85+
<!-- portabletest::ImageHostCollection::Layout must be listed before the aliased-to type -->
86+
<class name="portabletest::ImageHostCollection::Layout"/>
6587
<class name="portabletest::ImageSoA"/>
6688
<class name="portabletest::ImageSoA::View"/>
6789
<class name="portabletest::ImageSoA::ConstView"/>
68-
<class name="portabletest::ImageHostCollection"/>
6990
<class name="edm::Wrapper<portabletest::ImageHostCollection>" splitLevel="0"/>
7091

92+
<class name="portabletest::LogitsHostCollection"/>
93+
<!-- portabletest::LogitsHostCollection::Layout must be listed before the aliased-to type -->
94+
<class name="portabletest::LogitsHostCollection::Layout"/>
7195
<class name="portabletest::LogitsSoA"/>
7296
<class name="portabletest::LogitsSoA::View"/>
7397
<class name="portabletest::LogitsSoA::ConstView"/>
74-
<class name="portabletest::LogitsHostCollection"/>
7598
<class name="edm::Wrapper<portabletest::LogitsHostCollection>" splitLevel="0"/>
7699

100+
<class name="portabletest::MaskHostCollection"/>
101+
<!-- portabletest::MaskHostCollection::Layout must be listed before the aliased-to type -->
102+
<class name="portabletest::MaskHostCollection::Layout"/>
77103
<class name="portabletest::MaskSoA"/>
78104
<class name="portabletest::MaskSoA::View"/>
79105
<class name="portabletest::MaskSoA::ConstView"/>
80-
<class name="portabletest::MaskHostCollection"/>
81106
<class name="edm::Wrapper<portabletest::MaskHostCollection>" splitLevel="0"/>
82107
</lcgdict>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<lcgdict>
2+
<class name="PortableHostCollection<SiPixelClustersSoA>"/>
3+
<!-- PortableHostCollection<SiPixelClustersSoA>::Layout must be listed before the aliased-to type -->
4+
<class name="PortableHostCollection<SiPixelClustersSoA>::Layout"/>
25
<class name="SiPixelClustersSoA"/>
36
<class name="SiPixelClustersSoA::View"/>
4-
<class name="PortableHostCollection<SiPixelClustersSoA>"/>
57

6-
<class name="SiPixelClustersHost" ClassVersion="3">
7-
<version ClassVersion="3" checksum="3089948089"/>
8-
</class>
8+
<class name="SiPixelClustersHost"/>
99
<class name="edm::Wrapper<SiPixelClustersHost>" splitLevel="0"/>
1010
</lcgdict>

0 commit comments

Comments
 (0)