Skip to content

Commit e02375b

Browse files
committed
GPU: Switch some of the older classes to using C++11 style initialization
1 parent 2355810 commit e02375b

File tree

8 files changed

+68
-106
lines changed

8 files changed

+68
-106
lines changed

GPU/GPUTracking/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ set(SRCS
4444
SectorTracker/GPUTPCNeighboursFinder.cxx
4545
SectorTracker/GPUTPCGrid.cxx
4646
SectorTracker/GPUTPCTrackletSelector.cxx
47-
SectorTracker/GPUTPCRow.cxx
4847
SectorTracker/GPUTPCExtrapolationTracking.cxx
4948
SectorTracker/GPUTPCCreateTrackingData.cxx
5049
Merger/GPUTPCGMMerger.cxx

GPU/GPUTracking/Merger/GPUTPCGMMerger.cxx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ struct MergeLooperParam {
8585
#include "GPUMemorySizeScalers.h"
8686

8787
GPUTPCGMMerger::GPUTPCGMMerger()
88-
: mTrackLinks(nullptr), mNTotalSectorTracks(0), mNMaxTracks(0), mNMaxSingleSectorTracks(0), mNMaxOutputTrackClusters(0), mNMaxClusters(0), mMemoryResMemory(-1), mNClusters(0), mOutputTracks(nullptr), mSectorTrackInfos(nullptr), mSectorTrackInfoIndex(nullptr), mClusters(nullptr), mClustersXYZ(nullptr), mClusterAttachment(nullptr), mOutputTracksTPCO2(nullptr), mOutputClusRefsTPCO2(nullptr), mOutputTracksTPCO2MC(nullptr), mTrackOrderAttach(nullptr), mTrackOrderProcess(nullptr), mBorderMemory(nullptr), mBorderRangeMemory(nullptr), mMemory(nullptr), mRetryRefitIds(nullptr), mLoopData(nullptr)
8988
{
90-
//* constructor
91-
9289
for (int32_t iSector = 0; iSector < NSECTORS; iSector++) {
9390
mNextSectorInd[iSector] = iSector + 1;
9491
mPrevSectorInd[iSector] = iSector - 1;

GPU/GPUTracking/Merger/GPUTPCGMMerger.h

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -241,53 +241,53 @@ class GPUTPCGMMerger : public GPUProcessor
241241
int32_t mNextSectorInd[NSECTORS];
242242
int32_t mPrevSectorInd[NSECTORS];
243243

244-
int32_t* mTrackLinks;
244+
int32_t* mTrackLinks = nullptr;
245245
int32_t* mTrackCCRoots; // root of the connected component of this track
246246

247-
uint32_t mNTotalSectorTracks; // maximum number of incoming sector tracks
248-
uint32_t mNMaxTracks; // maximum number of output tracks
249-
uint32_t mNMaxSingleSectorTracks; // max N tracks in one sector
250-
uint32_t mNMaxOutputTrackClusters; // max number of clusters in output tracks (double-counting shared clusters)
251-
uint32_t mNMaxClusters; // max total unique clusters (in event)
252-
uint32_t mNMaxLooperMatches; // Maximum number of candidate pairs for looper matching
247+
uint32_t mNTotalSectorTracks = 0; // maximum number of incoming sector tracks
248+
uint32_t mNMaxTracks = 0; // maximum number of output tracks
249+
uint32_t mNMaxSingleSectorTracks = 0; // max N tracks in one sector
250+
uint32_t mNMaxOutputTrackClusters = 0; // max number of clusters in output tracks (double-counting shared clusters)
251+
uint32_t mNMaxClusters = 0; // max total unique clusters (in event)
252+
uint32_t mNMaxLooperMatches = 0; // Maximum number of candidate pairs for looper matching
253253

254-
uint16_t mMemoryResMemory;
255-
uint16_t mMemoryResOutput;
256-
uint16_t mMemoryResOutputState;
257-
uint16_t mMemoryResOutputO2;
258-
uint16_t mMemoryResOutputO2Clus;
259-
uint16_t mMemoryResOutputO2MC;
260-
uint16_t mMemoryResOutputO2Scratch;
254+
uint16_t mMemoryResMemory = (uint16_t)-1;
255+
uint16_t mMemoryResOutput = (uint16_t)-1;;
256+
uint16_t mMemoryResOutputState = (uint16_t)-1;;
257+
uint16_t mMemoryResOutputO2 = (uint16_t)-1;;
258+
uint16_t mMemoryResOutputO2Clus = (uint16_t)-1;;
259+
uint16_t mMemoryResOutputO2MC = (uint16_t)-1;;
260+
uint16_t mMemoryResOutputO2Scratch = (uint16_t)-1;;
261261

262-
int32_t mNClusters; // Total number of incoming clusters (from sector tracks)
263-
GPUTPCGMMergedTrack* mOutputTracks; //* array of output merged tracks
264-
GPUdEdxInfo* mOutputTracksdEdx; //* dEdx information
265-
GPUTPCGMSectorTrack* mSectorTrackInfos; //* additional information for sector tracks
266-
int32_t* mSectorTrackInfoIndex;
267-
GPUTPCGMMergedTrackHit* mClusters;
268-
GPUTPCGMMergedTrackHitXYZ* mClustersXYZ;
269-
GPUAtomic(uint32_t) * mClusterAttachment;
270-
o2::tpc::TrackTPC* mOutputTracksTPCO2;
271-
uint32_t* mOutputClusRefsTPCO2;
272-
o2::MCCompLabel* mOutputTracksTPCO2MC;
273-
internal::MergeLooperParam* mLooperCandidates;
262+
int32_t mNClusters = 0; // Total number of incoming clusters (from sector tracks)
263+
GPUTPCGMMergedTrack* mOutputTracks = nullptr; //* array of output merged tracks
264+
GPUdEdxInfo* mOutputTracksdEdx = nullptr; //* dEdx information
265+
GPUTPCGMSectorTrack* mSectorTrackInfos = nullptr; //* additional information for sector tracks
266+
int32_t* mSectorTrackInfoIndex = nullptr;
267+
GPUTPCGMMergedTrackHit* mClusters = nullptr;
268+
GPUTPCGMMergedTrackHitXYZ* mClustersXYZ = nullptr;
269+
GPUAtomic(uint32_t) * mClusterAttachment = nullptr;
270+
o2::tpc::TrackTPC* mOutputTracksTPCO2 = nullptr;
271+
uint32_t* mOutputClusRefsTPCO2 = nullptr;
272+
o2::MCCompLabel* mOutputTracksTPCO2MC = nullptr;
273+
internal::MergeLooperParam* mLooperCandidates = nullptr;
274274

275-
uint32_t* mTrackOrderAttach;
276-
uint32_t* mTrackOrderProcess;
277-
uint8_t* mClusterStateExt;
278-
uint2* mClusRefTmp;
279-
int32_t* mTrackIDs;
280-
int32_t* mTmpSortMemory;
281-
uint32_t* mTrackSort;
282-
tmpSort* mTrackSortO2;
283-
GPUAtomic(uint32_t) * mSharedCount; // Must be uint32_t unfortunately for atomic support
284-
GPUTPCGMBorderTrack* mBorderMemory; // memory for border tracks
275+
uint32_t* mTrackOrderAttach = nullptr;
276+
uint32_t* mTrackOrderProcess = nullptr;
277+
uint8_t* mClusterStateExt = nullptr;
278+
uint2* mClusRefTmp = nullptr;
279+
int32_t* mTrackIDs = nullptr;
280+
int32_t* mTmpSortMemory = nullptr;
281+
uint32_t* mTrackSort = nullptr;
282+
tmpSort* mTrackSortO2 = nullptr;
283+
GPUAtomic(uint32_t) * mSharedCount = nullptr; // Must be uint32_t unfortunately for atomic support
284+
GPUTPCGMBorderTrack* mBorderMemory = nullptr; // memory for border tracks
285285
GPUTPCGMBorderTrack* mBorder[2 * NSECTORS];
286-
gputpcgmmergertypes::GPUTPCGMBorderRange* mBorderRangeMemory; // memory for border tracks
287-
gputpcgmmergertypes::GPUTPCGMBorderRange* mBorderRange[NSECTORS]; // memory for border tracks
288-
memory* mMemory;
289-
uint32_t* mRetryRefitIds;
290-
GPUTPCGMLoopData* mLoopData;
286+
gputpcgmmergertypes::GPUTPCGMBorderRange* mBorderRangeMemory = nullptr; // memory for border tracks
287+
gputpcgmmergertypes::GPUTPCGMBorderRange* mBorderRange[NSECTORS]; // memory for border tracks
288+
memory* mMemory = nullptr;
289+
uint32_t* mRetryRefitIds = nullptr;
290+
GPUTPCGMLoopData* mLoopData = nullptr;
291291
};
292292
} // namespace o2::gpu
293293

GPU/GPUTracking/SectorTracker/GPUTPCRow.cxx

Lines changed: 0 additions & 24 deletions
This file was deleted.

GPU/GPUTracking/SectorTracker/GPUTPCRow.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ class GPUTPCRow
3232
friend class GPUTPCTrackingData;
3333

3434
public:
35-
#if !defined(GPUCA_GPUCODE)
36-
GPUTPCRow();
37-
#endif //! GPUCA_GPUCODE
38-
3935
GPUhd() int32_t NHits() const
4036
{
4137
return mNHits;
@@ -72,8 +68,7 @@ class GPUTPCRow
7268
float mHstepYi; // inverse step size
7369
float mHstepZi; // inverse step size
7470

75-
int32_t mHitNumberOffset; // index of the first hit in the hit array, used as
76-
// offset in GPUTPCTrackingData::LinkUp/DownData/HitDataY/...
71+
int32_t mHitNumberOffset; // index of the first hit in the hit array, used as offset in GPUTPCTrackingData::LinkUp/DownData/HitDataY/...
7772
uint32_t mFirstHitInBinOffset; // offset in Tracker::mRowData to find the FirstHitInBin
7873
};
7974
} // namespace o2::gpu

GPU/GPUTracking/SectorTracker/GPUTPCTracker.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ using namespace o2::tpc;
3939

4040
#if !defined(GPUCA_GPUCODE)
4141

42-
GPUTPCTracker::GPUTPCTracker()
43-
: GPUProcessor(), mLinkTmpMemory(nullptr), mISector(-1), mData(), mNMaxStartHits(0), mNMaxRowStartHits(0), mNMaxTracklets(0), mNMaxRowHits(0), mNMaxTracks(0), mNMaxTrackHits(0), mMemoryResLinks(-1), mMemoryResScratchHost(-1), mMemoryResCommon(-1), mMemoryResTracklets(-1), mMemoryResOutput(-1), mMemoryResSectorScratch(-1), mRowStartHitCountOffset(nullptr), mTrackletTmpStartHits(nullptr), mGPUTrackletTemp(nullptr), mGPUParametersConst(), mCommonMem(nullptr), mTrackletStartHits(nullptr), mTracklets(nullptr), mTrackletRowHits(nullptr), mTracks(nullptr), mTrackHits(nullptr), mOutput(nullptr), mOutputMemory(nullptr)
44-
{
45-
}
46-
4742
GPUTPCTracker::~GPUTPCTracker()
4843
{
4944
if (mOutputMemory) {

GPU/GPUTracking/SectorTracker/GPUTPCTracker.h

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class GPUTPCTracker : public GPUProcessor
4040
{
4141
public:
4242
#ifndef GPUCA_GPUCODE_DEVICE
43-
GPUTPCTracker();
43+
GPUTPCTracker() = default;
4444
~GPUTPCTracker();
4545
GPUTPCTracker(const GPUTPCTracker&) = delete;
4646
GPUTPCTracker& operator=(const GPUTPCTracker&) = delete;
@@ -233,40 +233,40 @@ class GPUTPCTracker : public GPUProcessor
233233
friend class GPUTPCNeighboursFinder;
234234
friend class GPUTPCStartHitsSorter;
235235
friend class GPUTPCStartHitsFinder;
236-
char* mLinkTmpMemory; // tmp memory for hits after neighbours finder
236+
char* mLinkTmpMemory = nullptr; // tmp memory for hits after neighbours finder
237237

238-
int32_t mISector; // Number of sector
238+
int32_t mISector = -1; // Number of sector
239239

240240
GPUTPCTrackingData mData; // The TrackingData object. It is used to encapsulate the storage in memory from the access
241241

242-
uint32_t mNMaxStartHits;
243-
uint32_t mNMaxRowStartHits;
244-
uint32_t mNMaxTracklets;
245-
uint32_t mNMaxRowHits;
246-
uint32_t mNMaxTracks;
247-
uint32_t mNMaxTrackHits;
248-
int16_t mMemoryResLinks;
249-
int16_t mMemoryResScratch;
250-
int16_t mMemoryResScratchHost;
251-
int16_t mMemoryResCommon;
252-
int16_t mMemoryResTracklets;
253-
int16_t mMemoryResOutput;
254-
int16_t mMemoryResSectorScratch;
242+
uint32_t mNMaxStartHits = 0;
243+
uint32_t mNMaxRowStartHits = 0;
244+
uint32_t mNMaxTracklets = 0;
245+
uint32_t mNMaxRowHits = 0;
246+
uint32_t mNMaxTracks = 0;
247+
uint32_t mNMaxTrackHits = 0;
248+
uint16_t mMemoryResLinks = (uint16_t)-1;
249+
uint16_t mMemoryResScratch = (uint16_t)-1;
250+
uint16_t mMemoryResScratchHost = (uint16_t)-1;
251+
uint16_t mMemoryResCommon = (uint16_t)-1;
252+
uint16_t mMemoryResTracklets = (uint16_t)-1;
253+
uint16_t mMemoryResOutput = (uint16_t)-1;
254+
uint16_t mMemoryResSectorScratch = (uint16_t)-1;
255255

256256
// GPU Temp Arrays
257-
GPUglobalref() int32_t* mRowStartHitCountOffset; // Offset, length and new offset of start hits in row
258-
GPUglobalref() GPUTPCHitId* mTrackletTmpStartHits; // Unsorted start hits
259-
GPUglobalref() char* mGPUTrackletTemp; // Temp Memory for GPU Tracklet Constructor
257+
GPUglobalref() int32_t* mRowStartHitCountOffset = nullptr; // Offset, length and new offset of start hits in row
258+
GPUglobalref() GPUTPCHitId* mTrackletTmpStartHits = nullptr; // Unsorted start hits
259+
GPUglobalref() char* mGPUTrackletTemp = nullptr; // Temp Memory for GPU Tracklet Constructor
260260

261261
StructGPUParametersConst mGPUParametersConst; // Parameters for GPU if this is a GPU tracker
262262

263263
// event
264-
GPUglobalref() commonMemoryStruct* mCommonMem; // common event memory
265-
GPUglobalref() GPUTPCHitId* mTrackletStartHits; // start hits for the tracklets
266-
GPUglobalref() GPUTPCTracklet* mTracklets; // tracklets
267-
GPUglobalref() calink* mTrackletRowHits; // Hits for each Tracklet in each row
268-
GPUglobalref() GPUTPCTrack* mTracks; // reconstructed tracks
269-
GPUglobalref() GPUTPCHitId* mTrackHits; // array of track hit numbers
264+
GPUglobalref() commonMemoryStruct* mCommonMem = nullptr; // common event memory
265+
GPUglobalref() GPUTPCHitId* mTrackletStartHits = nullptr; // start hits for the tracklets
266+
GPUglobalref() GPUTPCTracklet* mTracklets = nullptr; // tracklets
267+
GPUglobalref() calink* mTrackletRowHits = nullptr; // Hits for each Tracklet in each row
268+
GPUglobalref() GPUTPCTrack* mTracks = nullptr; // reconstructed tracks
269+
GPUglobalref() GPUTPCHitId* mTrackHits = nullptr; // array of track hit numbers
270270

271271
// output
272272
GPUglobalref() GPUTPCSectorOutput* mOutput; // address of pointer pointing to SectorOutput Object

GPU/GPUTracking/kernels.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# author David Rohr
1414

1515
o2_gpu_kernel_file_list(ERRORS GPUErrors.cxx)
16-
o2_gpu_kernel_file_list(TPCTRACKER ERRORS GPUTPCTrackParam.cxx GPUTPCTrack.cxx GPUTPCGrid.cxx GPUTPCRow.cxx GPUTPCTracker.cxx)
16+
o2_gpu_kernel_file_list(TPCTRACKER ERRORS GPUTPCTrackParam.cxx GPUTPCTrack.cxx GPUTPCGrid.cxx GPUTPCTracker.cxx)
1717
o2_gpu_kernel_file_list(TPCTRACKLETCONS GPUTPCTrackletConstructor.cxx)
1818
o2_gpu_kernel_file_list(TPCSECTORDATA TPCTRACKER GPUTPCTrackingData.cxx)
1919
o2_gpu_kernel_file_list(TPCOCCUPANCY GPUTPCClusterOccupancyMap.cxx)

0 commit comments

Comments
 (0)