Skip to content

Commit 1cf99d4

Browse files
committed
GPU: Workaround to keep the code compiled by AliRoot, be C++11 and CINT compatible
1 parent 7ad478d commit 1cf99d4

5 files changed

Lines changed: 21 additions & 11 deletions

File tree

GPU/GPUTracking/Base/GPUParam.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "GPUTPCGeometry.h"
2222
#include "GPUTPCGMPolynomialField.h"
2323

24-
#ifndef GPUCA_GPUCODE
24+
#if !defined(GPUCA_GPUCODE) && defined(GPUCA_NOCOMPAT)
2525
namespace o2::base
2626
{
2727
template <typename>
@@ -63,7 +63,7 @@ struct GPUParam_t {
6363
};
6464
} // namespace internal
6565

66-
#if !(defined(__CINT__) || defined(__ROOTCINT__)) || defined(__CLING__) // Hide from ROOT 5 CINT since it triggers a CINT but
66+
#if !(defined(__CINT__) || defined(__ROOTCINT__)) || defined(__CLING__) // Hide from ROOT 5 CINT
6767
MEM_CLASS_PRE()
6868
struct GPUParam : public internal::GPUParam_t<GPUSettingsRec, GPUSettingsParam> {
6969

GPU/GPUTracking/DataTypes/GPUDataTypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace o2
4949
class MCCompLabel;
5050
namespace base
5151
{
52-
template <typename>
52+
template <typename T>
5353
class PropagatorImpl;
5454
class MatLayerCylSet;
5555
} // namespace base

GPU/GPUTracking/TRDTracking/GPUTRDTrackerKernels.cxx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,26 @@
2020

2121
using namespace GPUCA_NAMESPACE::gpu;
2222

23+
#ifdef HAVE_O2HEADERS
24+
template <int I>
25+
GPUd() auto& getTracker(GPUTRDTrackerKernels::processorType& processors);
2326
template <>
24-
GPUdi() auto& GPUTRDTrackerKernels::getTracker<0>(processorType& processors)
27+
GPUdi() auto& getTracker<0>(GPUTRDTrackerKernels::processorType& processors)
2528
{
2629
return processors.trdTrackerGPU;
2730
}
28-
2931
template <>
30-
GPUdi() auto& GPUTRDTrackerKernels::getTracker<1>(processorType& processors)
32+
GPUdi() auto& getTracker<1>(GPUTRDTrackerKernels::processorType& processors)
3133
{
3234
return processors.trdTrackerO2;
3335
}
36+
#else
37+
template <int I>
38+
GPUdi() GPUTRDTrackerGPU& getTracker(GPUTRDTrackerKernels::processorType& processors)
39+
{
40+
return processors.trdTrackerGPU;
41+
}
42+
#endif
3443

3544
template <int I>
3645
GPUdii() void GPUTRDTrackerKernels::Thread(int nBlocks, int nThreads, int iBlock, int iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors)
@@ -43,4 +52,6 @@ GPUdii() void GPUTRDTrackerKernels::Thread(int nBlocks, int nThreads, int iBlock
4352
}
4453

4554
template GPUd() void GPUTRDTrackerKernels::Thread<0>(int nBlocks, int nThreads, int iBlock, int iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors);
55+
#ifdef HAVE_O2HEADERS
4656
template GPUd() void GPUTRDTrackerKernels::Thread<1>(int nBlocks, int nThreads, int iBlock, int iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors);
57+
#endif

GPU/GPUTracking/TRDTracking/GPUTRDTrackerKernels.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ class GPUTRDTrackerKernels : public GPUKernelTemplate
2727
GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::TRDTracking; }
2828
template <int iKernel = defaultKernel>
2929
GPUd() static void Thread(int nBlocks, int nThreads, int iBlock, int iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors);
30-
31-
private:
32-
template <int I>
33-
GPUd() static auto& getTracker(processorType& processors);
3430
};
3531
} // namespace gpu
3632
} // namespace GPUCA_NAMESPACE

GPU/GPUTracking/utils/strtag.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
#include <string>
1919

2020
template <class T = unsigned long>
21-
constexpr T qStr2Tag(const char* str)
21+
#if defined(__cplusplus) && __cplusplus >= 201402L
22+
constexpr
23+
#endif
24+
T qStr2Tag(const char* str)
2225
{
2326
if (strlen(str) != sizeof(T)) {
2427
throw std::runtime_error("Invalid tag length");

0 commit comments

Comments
 (0)