Skip to content

Commit 1066b18

Browse files
AdrianoDeefwyzard
authored andcommitted
Add alpaka PortableObjects for the beamspot
1 parent f950141 commit 1066b18

File tree

11 files changed

+76
-11
lines changed

11 files changed

+76
-11
lines changed

DataFormats/BeamSpot/BuildFile.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
<use name="clhep"/>
2+
<use name="rootcore"/>
3+
<use name="rootsmatrix"/>
14
<use name="DataFormats/Common"/>
25
<use name="DataFormats/CLHEP"/>
36
<use name="DataFormats/GeometrySurface"/>
47
<use name="DataFormats/Math"/>
5-
<use name="rootcore"/>
6-
<use name="rootsmatrix"/>
7-
<use name="clhep"/>
8+
<use name="DataFormats/Portable"/>
9+
<use name="HeterogeneousCore/AlpakaInterface"/>
10+
<flags ALPAKA_BACKENDS="!serial"/>
811
<export>
912
<lib name="1"/>
1013
</export>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef DataFormats_BeamSpot_interface_BeamSpotHost_h
2+
#define DataFormats_BeamSpot_interface_BeamSpotHost_h
3+
4+
#include "DataFormats/BeamSpot/interface/BeamSpotPOD.h"
5+
#include "DataFormats/Portable/interface/PortableHostObject.h"
6+
7+
// simplified representation of the beamspot data, in host memory
8+
using BeamSpotHost = PortableHostObject<BeamSpotPOD>;
9+
10+
#endif // DataFormats_BeamSpot_interface_BeamSpotHost_h

DataFormats/BeamSpot/interface/BeamSpotPOD.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
#ifndef DataFormats_BeamSpot_interface_BeamSpotPOD_h
22
#define DataFormats_BeamSpot_interface_BeamSpotPOD_h
33

4-
// This struct is a transient-only, simplified representation of the beamspot
5-
// data used as the underlying type for data transfers and operations in
4+
// This struct is a simplified representation of the beamspot data
5+
// used as the underlying type for data transfers and operations in
66
// heterogeneous code (e.g. in CUDA code).
77

88
// The covariance matrix is not used in that code, so is left out here.
99

1010
// align to the CUDA L1 cache line size
1111
struct alignas(128) BeamSpotPOD {
12-
float x, y, z; // position
12+
float x; // position
13+
float y;
14+
float z;
1315
float sigmaZ;
14-
float beamWidthX, beamWidthY;
15-
float dxdz, dydz;
16-
float emittanceX, emittanceY;
16+
float beamWidthX;
17+
float beamWidthY;
18+
float dxdz;
19+
float dydz;
20+
float emittanceX;
21+
float emittanceY;
1722
float betaStar;
1823
};
1924

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#ifndef DataFormats_BeamSpot_interface_alpaka_BeamSpotDevice_h
2+
#define DataFormats_BeamSpot_interface_alpaka_BeamSpotDevice_h
3+
4+
#include "DataFormats/BeamSpot/interface/BeamSpotHost.h"
5+
#include "DataFormats/BeamSpot/interface/BeamSpotPOD.h"
6+
#include "DataFormats/Portable/interface/alpaka/PortableObject.h"
7+
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"
8+
9+
namespace ALPAKA_ACCELERATOR_NAMESPACE {
10+
11+
// simplified representation of the beamspot data, in device global memory
12+
using BeamSpotDevice = PortableObject<BeamSpotPOD>;
13+
14+
} // namespace ALPAKA_ACCELERATOR_NAMESPACE
15+
16+
// check that the portable device collection for the host device is the same as the portable host collection
17+
ASSERT_DEVICE_MATCHES_HOST_COLLECTION(BeamSpotDevice, BeamSpotHost);
18+
19+
#endif // DataFormats_BeamSpot_interface_alpaka_BeamSpotDevice_h
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include "DataFormats/BeamSpot/interface/BeamSpotPOD.h"
2+
#include "DataFormats/BeamSpot/interface/alpaka/BeamSpotDevice.h"
3+
#include "DataFormats/Common/interface/DeviceProduct.h"
4+
#include "DataFormats/Common/interface/Wrapper.h"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<lcgdict>
2+
<class name="alpaka_cuda_async::BeamSpotDevice" persistent="false"/>
3+
<class name="edm::DeviceProduct<alpaka_cuda_async::BeamSpotDevice>" persistent="false"/>
4+
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_cuda_async::BeamSpotDevice>>" persistent="false"/>
5+
</lcgdict>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include "DataFormats/BeamSpot/interface/BeamSpotPOD.h"
2+
#include "DataFormats/BeamSpot/interface/alpaka/BeamSpotDevice.h"
3+
#include "DataFormats/Common/interface/DeviceProduct.h"
4+
#include "DataFormats/Common/interface/Wrapper.h"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<lcgdict>
2+
<class name="alpaka_rocm_async::BeamSpotDevice" persistent="false"/>
3+
<class name="edm::DeviceProduct<alpaka_rocm_async::BeamSpotDevice>" persistent="false"/>
4+
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_rocm_async::BeamSpotDevice>>" persistent="false"/>
5+
</lcgdict>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include "DataFormats/BeamSpot/interface/BeamSpotHost.h"
2+
#include "DataFormats/Portable/interface/PortableHostObjectReadRules.h"
3+
4+
SET_PORTABLEHOSTOBJECT_READ_RULES(BeamSpotHost);

DataFormats/BeamSpot/src/classes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
2+
#include "DataFormats/BeamSpot/interface/BeamSpotHost.h"
23
#include "DataFormats/BeamSpot/interface/BeamSpotPOD.h"
34
#include "DataFormats/Common/interface/Wrapper.h"

0 commit comments

Comments
 (0)