Skip to content

Commit 365214d

Browse files
committed
GPU: Do not allow any constructors that will use FlatObject in GPU code, were anyway not used but could create dangerous symbols
1 parent 2dd3745 commit 365214d

File tree

7 files changed

+15
-4
lines changed

7 files changed

+15
-4
lines changed

Detectors/Base/include/DetectorsBase/MatLayerCyl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ class MatLayerCyl : public o2::gpu::FlatObject
5454
Within = 0,
5555
Above = 1 };
5656

57+
#ifndef GPUCA_GPUCODE
5758
MatLayerCyl();
5859
MatLayerCyl(const MatLayerCyl& src) CON_DELETE;
5960
~MatLayerCyl() CON_DEFAULT;
61+
#endif
6062

6163
#ifndef GPUCA_ALIGPUCODE // this part is unvisible on GPU version
6264
MatLayerCyl(float rMin, float rMax, float zHalfSpan, float dzMin, float drphiMin);

Detectors/Base/include/DetectorsBase/MatLayerCylSet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ class MatLayerCylSet : public o2::gpu::FlatObject
5151
{
5252

5353
public:
54+
#ifndef GPUCA_GPUCODE
5455
MatLayerCylSet() CON_DEFAULT;
5556
~MatLayerCylSet() CON_DEFAULT;
5657
MatLayerCylSet(const MatLayerCylSet& src) CON_DELETE;
58+
#endif
5759

5860
GPUd() const MatLayerCylSetLayout* get() const { return reinterpret_cast<const MatLayerCylSetLayout*>(mFlatBufferPtr); }
5961
GPUd() MatLayerCylSetLayout* get() { return reinterpret_cast<MatLayerCylSetLayout*>(mFlatBufferPtr); }

Detectors/Base/src/MatLayerCyl.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@
2323
using namespace o2::base;
2424
using flatObject = o2::gpu::FlatObject;
2525

26+
#ifndef GPUCA_GPUCODE
2627
//________________________________________________________________________________
2728
MatLayerCyl::MatLayerCyl() : mNZBins(0), mNPhiBins(0), mNPhiSlices(0), mZHalf(0.f), mRMin2(0.f), mRMax2(0.f), mDZ(0.f), mDZInv(0.f), mDPhi(0.f), mDPhiInv(0.f), mPhiBin2Slice(nullptr), mSliceCos(nullptr), mSliceSin(nullptr), mCells(nullptr)
2829
{
2930
}
31+
#endif
3032

3133
#ifndef GPUCA_ALIGPUCODE // this part is unvisible on GPU version
3234
//________________________________________________________________________________

Detectors/TRD/base/include/TRDBase/GeometryFlat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Geometry;
3434
class GeometryFlat : public o2::gpu::FlatObject, public GeometryBase
3535
{
3636
public:
37-
#ifndef GPUCA_GPUCODE_DEVICE
37+
#ifndef GPUCA_GPUCODE
3838
GeometryFlat() = default;
3939
GeometryFlat(const GeometryFlat& v) : FlatObject(), GeometryBase()
4040
{

GPU/GPUTracking/DataTypes/CalibdEdxContainer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ class CalibdEdxContainer : public o2::gpu::FlatObject
6060
{
6161
public:
6262
/// Default constructor: creates an empty uninitialized object
63+
#ifndef GPUCA_GPUCODE
6364
CalibdEdxContainer() CON_DEFAULT;
65+
#endif
6466

6567
/// Copy constructor: disabled to avoid ambiguity. Use cloneFromObject() instead
6668
CalibdEdxContainer(const CalibdEdxContainer&) CON_DELETE;

GPU/GPUTracking/DataTypes/CalibdEdxTrackTopologyPol.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ class CalibdEdxTrackTopologyPol : public o2::gpu::FlatObject
5353
/// \param fileName name of the input file containing the object
5454
/// \parma name name of the object
5555
CalibdEdxTrackTopologyPol(std::string_view fileName, std::string_view name = "CalibdEdxTrackTopologyPol") { loadFromFile(fileName.data(), name.data()); };
56-
#endif
57-
5856
/// Default constructor: creates an empty uninitialized object
5957
CalibdEdxTrackTopologyPol() CON_DEFAULT;
6058

6159
/// destructor
6260
~CalibdEdxTrackTopologyPol() CON_DEFAULT;
61+
#endif
6362

6463
#ifdef GPUCA_HAVE_O2HEADERS
6564
/// \return returns the track topology correction

GPU/Utils/FlatObject.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,14 @@ class FlatObject
178178
/// _____________ Constructors / destructors __________________________
179179

180180
/// Default constructor / destructor
181-
FlatObject() CON_DEFAULT;
181+
#ifndef GPUCA_GPUCODE
182+
FlatObject() CON_DEFAULT; // No object derrived from FlatObject should be created on the GPU
182183
~FlatObject();
183184
FlatObject(const FlatObject&) CON_DELETE;
184185
FlatObject& operator=(const FlatObject&) CON_DELETE;
186+
#else
187+
FlatObject() CON_DELETE;
188+
#endif
185189

186190
protected:
187191
/// _____________ Memory alignment __________________________

0 commit comments

Comments
 (0)