Skip to content

Commit fb36505

Browse files
committed
GPU: Get rid of some unneeded headers for Standalone / AliRoot
1 parent ede1803 commit fb36505

10 files changed

Lines changed: 148 additions & 87 deletions

GPU/GPUTracking/Base/GPUConstantMem.h

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@
1818
#include "GPUParam.h"
1919
#include "GPUDataTypes.h"
2020

21+
// Dummies for stuff not supported in legacy code (ROOT 5 / OPENCL1.2)
2122
#if defined(GPUCA_NOCOMPAT_ALLCINT) && (!defined(GPUCA_GPULIBRARY) || !defined(GPUCA_ALIROOT_LIB))
22-
#include "GPUTPCConvert.h"
23-
#include "GPUTPCCompression.h"
2423
#include "GPUTPCGMMerger.h"
25-
#include "GPUITSFitter.h"
2624
#include "GPUTRDTracker.h"
27-
#include "GPUTPCClusterFinder.h"
2825
#else
2926
namespace GPUCA_NAMESPACE
3027
{
@@ -33,26 +30,24 @@ namespace gpu
3330
class GPUTPCGMMerger
3431
{
3532
};
36-
class GPUITSFitter
37-
{
38-
};
3933
class GPUTRDTracker
4034
{
4135
void SetMaxData(const GPUTrackingInOutPointers& io) {}
4236
};
43-
class GPUTPCConvert
44-
{
45-
};
46-
class GPUTPCCompression
47-
{
48-
};
49-
class GPUTPCClusterFinder
50-
{
51-
};
5237
} // namespace gpu
5338
} // namespace GPUCA_NAMESPACE
5439
#endif
5540

41+
// Dummies for stuff not suppored in legacy code, or for what requires O2 headers while not available
42+
#if defined(GPUCA_NOCOMPAT_ALLCINT) && (!defined(GPUCA_GPULIBRARY) || !defined(GPUCA_ALIROOT_LIB)) && defined(HAVE_O2HEADERS)
43+
#include "GPUTPCConvert.h"
44+
#include "GPUTPCCompression.h"
45+
#include "GPUITSFitter.h"
46+
#include "GPUTPCClusterFinder.h"
47+
#else
48+
#include "GPUO2FakeClasses.h"
49+
#endif
50+
5651
namespace GPUCA_NAMESPACE
5752
{
5853
namespace gpu

GPU/GPUTracking/Base/GPUGeneralKernels.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "GPUDef.h"
1818
#include "GPUDataTypes.h"
1919

20+
#ifdef GPUCA_GPUCODE
2021
#ifdef __CUDACC__
2122
#include <cub/cub.cuh>
2223
#define GPUCA_CUB cub
@@ -25,6 +26,7 @@
2526
#include <hipcub/hipcub.hpp>
2627
#define GPUCA_CUB hipcub
2728
#endif
29+
#endif
2830

2931
namespace GPUCA_NAMESPACE
3032
{
@@ -43,7 +45,7 @@ class GPUKernelTemplate
4345
template <class T, int I>
4446
struct GPUTPCSharedMemoryScan64 {
4547
// Provides the shared memory resources for CUB collectives
46-
#if defined(__CUDACC__) || defined(__HIPCC__)
48+
#if (defined(__CUDACC__) || defined(__HIPCC__)) && defined(GPUCA_GPUCODE)
4749
typedef GPUCA_CUB::BlockScan<T, I> BlockScan;
4850
union {
4951
typename BlockScan::TempStorage cubTmpMem;

GPU/GPUTracking/Base/GPUO2DataTypes.h

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -19,46 +19,7 @@
1919
#include "DetectorsBase/MatLayerCylSet.h"
2020
#include "TRDBase/TRDGeometryFlat.h"
2121
#else
22-
namespace o2
23-
{
24-
namespace tpc
25-
{
26-
struct ClusterNative {
27-
GPUd() static float getTime() { return 0.f; }
28-
GPUd() static float getPad() { return 0.f; }
29-
GPUd() static int getFlags() { return 0; }
30-
GPUd() static void setTimeFlags(float t, int f) {}
31-
GPUd() static void setPad(float p) {}
32-
GPUd() static void setSigmaTime(float s) {}
33-
GPUd() static void setSigmaPad(float s) {}
34-
35-
unsigned char qTot, qMax;
36-
};
37-
struct ClusterNativeAccess {
38-
const ClusterNative* clustersLinear;
39-
const ClusterNative* clusters[GPUCA_NSLICES][GPUCA_ROW_COUNT];
40-
unsigned int nClusters[GPUCA_NSLICES][GPUCA_ROW_COUNT];
41-
unsigned int nClustersSector[GPUCA_NSLICES];
42-
unsigned int clusterOffset[GPUCA_NSLICES][GPUCA_ROW_COUNT];
43-
unsigned int nClustersTotal;
44-
void setOffsetPtrs() {}
45-
};
46-
} // namespace tpc
47-
namespace base
48-
{
49-
struct MatBudget {
50-
};
51-
class MatLayerCylSet
52-
{
53-
};
54-
} // namespace base
55-
namespace trd
56-
{
57-
class TRDGeometryFlat
58-
{
59-
};
60-
} // namespace trd
61-
} // namespace o2
22+
#include "GPUO2FakeClasses.h"
6223
#endif
6324

6425
#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \file GPUO2FakeClasses.h
12+
/// \author David Rohr
13+
14+
#ifndef O2_GPU_GPUO2FAKECLASSES_H
15+
#define O2_GPU_GPUO2FAKECLASSES_H
16+
17+
#include "GPUCommonDef.h"
18+
#include "GPUDataTypes.h"
19+
20+
// These are some dummies of O2 classes needed by AliGPU, to be used when O2 header unavailable
21+
22+
namespace gpucf
23+
{
24+
struct PackedDigit_s {
25+
};
26+
} // namespace gpucf
27+
28+
namespace o2
29+
{
30+
namespace tpc
31+
{
32+
struct ClusterNative {
33+
GPUd() static float getTime() { return 0.f; }
34+
GPUd() static float getPad() { return 0.f; }
35+
GPUd() static int getFlags() { return 0; }
36+
GPUd() static void setTimeFlags(float t, int f) {}
37+
GPUd() static void setPad(float p) {}
38+
GPUd() static void setSigmaTime(float s) {}
39+
GPUd() static void setSigmaPad(float s) {}
40+
41+
unsigned char qTot, qMax;
42+
};
43+
struct ClusterNativeAccess {
44+
const ClusterNative* clustersLinear;
45+
const ClusterNative* clusters[GPUCA_NSLICES][GPUCA_ROW_COUNT];
46+
unsigned int nClusters[GPUCA_NSLICES][GPUCA_ROW_COUNT];
47+
unsigned int nClustersSector[GPUCA_NSLICES];
48+
unsigned int clusterOffset[GPUCA_NSLICES][GPUCA_ROW_COUNT];
49+
unsigned int nClustersTotal;
50+
void setOffsetPtrs() {}
51+
};
52+
} // namespace tpc
53+
namespace base
54+
{
55+
struct MatBudget {
56+
};
57+
class MatLayerCylSet
58+
{
59+
};
60+
} // namespace base
61+
namespace trd
62+
{
63+
class TRDGeometryFlat
64+
{
65+
};
66+
} // namespace trd
67+
} // namespace o2
68+
69+
namespace GPUCA_NAMESPACE
70+
{
71+
namespace gpu
72+
{
73+
class GPUFakeEmpty
74+
{
75+
};
76+
class GPUITSFitter
77+
{
78+
};
79+
class GPUTPCConvert
80+
{
81+
};
82+
class GPUTPCCompression
83+
{
84+
public:
85+
GPUFakeEmpty mOutput;
86+
};
87+
class GPUTPCClusterFinder
88+
{
89+
};
90+
#ifndef __OPENCL__
91+
struct GPUParam;
92+
class GPUTPCClusterStatistics
93+
{
94+
public:
95+
void Finish() {}
96+
void RunStatistics(const o2::tpc::ClusterNativeAccess* clustersNative, const GPUFakeEmpty* clustersCompressed, const GPUParam& param) {}
97+
};
98+
#endif
99+
} // namespace gpu
100+
} // namespace GPUCA_NAMESPACE
101+
102+
#endif

GPU/GPUTracking/Base/GPUReconstruction.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ GPUReconstruction::GPUReconstruction(const GPUSettingsProcessing& cfg) : mHostCo
5757
mMemoryScalers.reset(new GPUMemorySizeScalers);
5858
for (unsigned int i = 0; i < NSLICES; i++) {
5959
processors()->tpcTrackers[i].SetSlice(i); // TODO: Move to a better place
60+
#ifdef HAVE_O2HEADERS
6061
processors()->tpcClusterer[i].mISlice = i;
62+
#endif
6163
}
6264
}
6365

GPU/GPUTracking/Base/GPUReconstructionCPU.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
#include "GPUTPCTrackletSelector.h"
3131
#include "GPUTPCGMMergerGPU.h"
3232
#include "GPUTRDTrackerGPU.h"
33+
#ifdef HAVE_O2HEADERS
3334
#include "GPUITSFitterKernels.h"
3435
#include "GPUTPCConvertKernel.h"
3536
#include "GPUTPCCompressionKernels.h"
3637
#include "GPUTPCClusterFinderKernels.h"
38+
#endif
3739

3840
namespace GPUCA_NAMESPACE
3941
{

GPU/GPUTracking/CMakeLists.txt

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,6 @@ if(ALIGPU_BUILD_TYPE STREQUAL "O2" OR CONFIG_ROOT_AND_O2_EXTENSIONS)
144144
gpucf/GPUTPCClusterFinder.cxx)
145145
set(HDRS_INSTALL ${HDRS_INSTALL} Interface/GPUO2InterfaceConfiguration.h
146146
ITS/GPUITSTrack.h dEdx/GPUdEdxInfo.h)
147-
else()
148-
# TODO: Get rid of these bogus includes!
149-
set(HDRS_INSTALL
150-
${HDRS_INSTALL}
151-
ITS/GPUITSFitter.h
152-
ITS/GPUITSFitterKernels.h
153-
ITS/GPUITSTrack.h
154-
TPCConvert/GPUTPCConvert.h
155-
TPCConvert/GPUTPCConvertKernel.h
156-
DataCompression/GPUTPCCompression.h
157-
DataCompression/GPUTPCCompressionTrackModel.h
158-
DataCompression/GPUTPCCompressionKernels.h
159-
DataCompression/TPCClusterDecompressor.h
160-
DataCompression/GPUTPCClusterStatistics.h
161-
gpucf/GPUTPCClusterFinderKernels.h
162-
gpucf/GPUTPCClusterFinder.h)
163147
endif()
164148

165149
# Sources only for AliRoot
@@ -180,7 +164,8 @@ if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT")
180164
${CMAKE_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCDefinitions.cxx
181165
${CMAKE_SOURCE_DIR}/HLT/TRD/AliHLTTRDDefinitions.cxx)
182166

183-
set(HDRS_INSTALL ${HDRS_INSTALL} SliceTracker/GPUTPCDefinitions.h)
167+
set(HDRS_INSTALL ${HDRS_INSTALL} SliceTracker/GPUTPCDefinitions.h
168+
Base/GPUO2FakeClasses.h)
184169
endif()
185170

186171
# Optional sources depending on optional dependencies
@@ -302,10 +287,8 @@ if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT")
302287
${CMAKE_SOURCE_DIR}/GPU/GPUTracking/SliceTracker
303288
${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Merger
304289
${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Global
305-
${CMAKE_SOURCE_DIR}/GPU/GPUTracking/dEdx
306-
${CMAKE_SOURCE_DIR}/GPU/GPUTracking/gpucf
307-
${CMAKE_SOURCE_DIR}/GPU/GPUTracking/ITS
308290
${CMAKE_SOURCE_DIR}/GPU/GPUTracking/TPCConvert
291+
${CMAKE_SOURCE_DIR}/GPU/GPUTracking/dEdx
309292
${CMAKE_SOURCE_DIR}/GPU/GPUTracking/TRDTracking
310293
${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Standalone
311294
${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/cuda

GPU/GPUTracking/Global/GPUChainTracking.cxx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
/// \author David Rohr
1313

1414
#include "GPUChainTracking.h"
15-
#include "GPUTPCConvert.h"
16-
#include "GPUTPCCompression.h"
1715
#include "GPUTPCClusterData.h"
1816
#include "GPUTPCSliceOutput.h"
1917
#include "GPUTPCSliceOutTrack.h"
@@ -31,11 +29,16 @@
3129
#include "GPUTRDTrackletLabels.h"
3230
#include "GPUDisplay.h"
3331
#include "GPUQA.h"
34-
#include "GPUTPCClusterStatistics.h"
3532
#include "GPULogging.h"
3633
#include "GPUReconstructionConvert.h"
3734
#include "GPUMemorySizeScalers.h"
3835

36+
#ifdef HAVE_O2HEADERS
37+
#include "GPUTPCClusterStatistics.h"
38+
#else
39+
#include "GPUO2FakeClasses.h"
40+
#endif
41+
3942
#include "TPCFastTransform.h"
4043

4144
#include "utils/linux_helpers.h"
@@ -263,6 +266,7 @@ int GPUChainTracking::Init()
263266

264267
void GPUChainTracking::PrepareEventFromNative()
265268
{
269+
#ifdef HAVE_O2HEADERS
266270
ClusterNativeAccess* tmp = mClusterNativeAccess.get();
267271
if (tmp != mIOPtrs.clustersNative) {
268272
*tmp = *mIOPtrs.clustersNative;
@@ -276,12 +280,14 @@ void GPUChainTracking::PrepareEventFromNative()
276280
processors()->tpcCompressor.mMaxClusters = mIOPtrs.clustersNative->nClustersTotal;
277281
mRec->MemoryScalers()->nTPCHits = mIOPtrs.clustersNative->nClustersTotal;
278282
GPUInfo("Event has %d TPC Clusters, %d TRD Tracklets", tmp->nClustersTotal, mIOPtrs.nTRDTracklets);
283+
#endif
279284
}
280285

281286
int GPUChainTracking::PrepareEvent()
282287
{
283288
mRec->MemoryScalers()->nTRDTracklets = mIOPtrs.nTRDTracklets;
284289
if (mIOPtrs.tpcPackedDigits) {
290+
#ifdef HAVE_O2HEADERS
285291
mRec->MemoryScalers()->nTPCdigits = 0;
286292
size_t maxDigits = 0;
287293
for (unsigned int iSlice = 0; iSlice < NSLICES; iSlice++) {
@@ -299,6 +305,7 @@ int GPUChainTracking::PrepareEvent()
299305
processors()->tpcCompressor.mMaxClusters = mRec->MemoryScalers()->nTPCHits;
300306
processors()->tpcConverter.mNClustersTotal = mRec->MemoryScalers()->nTPCHits;
301307
GPUInfo("Event has %lld TPC Digits", (long long int)mRec->MemoryScalers()->nTPCdigits);
308+
#endif
302309
} else if (mIOPtrs.clustersNative) {
303310
PrepareEventFromNative();
304311
} else {
@@ -307,7 +314,9 @@ int GPUChainTracking::PrepareEvent()
307314
processors()->tpcTrackers[iSlice].Data().SetClusterData(mIOPtrs.clusterData[iSlice], mIOPtrs.nClusterData[iSlice], offset);
308315
offset += mIOPtrs.nClusterData[iSlice];
309316
}
317+
#ifdef HAVE_O2HEADERS
310318
processors()->tpcCompressor.mMaxClusters = offset;
319+
#endif
311320
mRec->MemoryScalers()->nTPCHits = offset;
312321
GPUInfo("Event has %d TPC Clusters (converted), %d TRD Tracklets", offset, mIOPtrs.nTRDTracklets);
313322
}
@@ -689,6 +698,7 @@ void GPUChainTracking::WriteOutput(int iSlice, int threadId)
689698

690699
void GPUChainTracking::ForwardTPCDigits()
691700
{
701+
#ifdef HAVE_O2HEADERS
692702
if (GetRecoStepsGPU() & RecoStep::TPCClusterFinding) {
693703
throw std::runtime_error("Cannot forward TPC digits with Clusterizer on GPU");
694704
}
@@ -725,6 +735,7 @@ void GPUChainTracking::ForwardTPCDigits()
725735
mIOPtrs.clustersNative = mClusterNativeAccess.get();
726736
printf("Forwarded %u TPC clusters\n", nTotal);
727737
PrepareEventFromNative();
738+
#endif
728739
}
729740

730741
int GPUChainTracking::GlobalTracking(int iSlice, int threadId)

GPU/GPUTracking/Global/GPUChainTracking.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class GPUChainTracking : public GPUChain, GPUReconstructionHelpers::helperDelega
190190

191191
// Ptr to reconstruction detector objects
192192
std::unique_ptr<o2::tpc::ClusterNativeAccess> mClusterNativeAccess; // Internal memory for clusterNativeAccess
193-
std::unique_ptr<o2::gpu::GPUTrackingInOutDigits> mDigitMap; // Internal memory for digit-map, if needed
193+
std::unique_ptr<GPUTrackingInOutDigits> mDigitMap; // Internal memory for digit-map, if needed
194194
std::unique_ptr<TPCFastTransform> mTPCFastTransformU; // Global TPC fast transformation object
195195
std::unique_ptr<o2::base::MatLayerCylSet> mMatLUTU; // Material Lookup Table
196196
std::unique_ptr<o2::trd::TRDGeometryFlat> mTRDGeometryU; // TRD Geometry

0 commit comments

Comments
 (0)