Skip to content

Commit cd082dc

Browse files
committed
GPU: Fix some protections for AliRoot compilation
1 parent 7be44fa commit cd082dc

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

GPU/Common/GPUCommonAlgorithm.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616

1717
#include "GPUCommonDef.h"
1818

19-
#if !defined(GPUCA_GPUCODE_DEVICE)
20-
//#include <algorithm>
19+
#if !defined(GPUCA_GPUCODE_DEVICE) && (!defined __cplusplus || __cplusplus < 201402L)
20+
#include <algorithm>
21+
#define GPUCA_ALGORITHM_FALLBACK
2122
#endif
2223

2324
// ----------------------------- SORTING -----------------------------
@@ -71,6 +72,7 @@ namespace GPUCA_NAMESPACE
7172
namespace gpu
7273
{
7374

75+
#ifndef GPUCA_ALGORITHM_FALLBACK
7476
template <typename I>
7577
GPUdi() void GPUCommonAlgorithm::IterSwap(I a, I b) noexcept
7678
{
@@ -196,6 +198,7 @@ GPUdi() void GPUCommonAlgorithm::QuickSort(I f, I l) noexcept
196198
{
197199
QuickSort(f, l, [](auto&& x, auto&& y) { return x < y; });
198200
}
201+
#endif
199202

200203
typedef GPUCommonAlgorithm CAAlgo;
201204

@@ -218,13 +221,21 @@ namespace gpu
218221
template <class T>
219222
GPUdi() void GPUCommonAlgorithm::sort(T* begin, T* end)
220223
{
224+
#ifdef GPUCA_ALGORITHM_FALLBACK
225+
std::sort(begin, end);
226+
#else
221227
QuickSort(begin, end, [](auto&& x, auto&& y) { return x < y; });
228+
#endif
222229
}
223230

224231
template <class T, class S>
225232
GPUdi() void GPUCommonAlgorithm::sort(T* begin, T* end, const S& comp)
226233
{
234+
#ifdef GPUCA_ALGORITHM_FALLBACK
235+
std::sort(begin, end, comp);
236+
#else
227237
QuickSort(begin, end, comp);
238+
#endif
228239
}
229240

230241
template <class T>

GPU/GPUTracking/Base/GPUReconstructionIncludesDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ using namespace GPUCA_NAMESPACE::gpu;
4141
#include "GPUTPCStartHitsSorter.cxx"
4242
#include "GPUTPCTrackletConstructor.cxx"
4343

44-
#if (!defined(__OPENCL__) || defined(__OPENCLCPP__)) && !defined(GPUCA_ALIROOT_LIB)
44+
#if !defined(GPUCA_OPENCL1) && !defined(GPUCA_ALIROOT_LIB)
4545
// Files for TPC Merger
4646
#include "GPUTPCGMMergerGPU.cxx"
4747
#include "GPUTPCGMMerger.h"

GPU/GPUTracking/Base/GPUReconstructionKernels.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ GPUCA_KRNL((GPUTPCTrackletConstructor, singleSlice ), (single, REG, (GPUCA
2323
GPUCA_KRNL((GPUTPCTrackletConstructor, allSlices ), (single, REG, (GPUCA_THREAD_COUNT_CONSTRUCTOR, GPUCA_BLOCK_COUNT_CONSTRUCTOR_MULTIPLIER)), (), ())
2424
GPUCA_KRNL((GPUTPCTrackletSelector ), (both, REG, (GPUCA_THREAD_COUNT_SELECTOR, GPUCA_BLOCK_COUNT_SELECTOR_MULTIPLIER)), (), ())
2525
GPUCA_KRNL((GPUMemClean16 ), (simple, REG, (GPUCA_THREAD_COUNT, 1)), (, GPUPtr1(void*, ptr), unsigned long size), (, GPUPtr2(void*, ptr), size))
26-
#ifndef GPUCA_OPENCL1
26+
#if !defined(GPUCA_OPENCL1) && (!defined(GPUCA_ALIROOT_LIB) || !defined(GPUCA_GPUCODE))
2727
GPUCA_KRNL((GPUTPCGMMergerTrackFit ), (simple, REG, (GPUCA_THREAD_COUNT_FIT, 1)), (), ())
2828
#ifdef HAVE_O2HEADERS
2929
GPUCA_KRNL((GPUTRDTrackerGPU ), (simple, REG, (GPUCA_THREAD_COUNT_TRD, 1)), (), ())

GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,21 @@
6060
#define assert(param)
6161
#ifndef __OPENCLCPP__
6262
#define static_assert(...)
63+
#define GPUCA_OPENCL1
6364
#endif
6465

6566
#include "GPUReconstructionIncludesDevice.h"
6667
#include "GPUConstantMem.h"
6768

6869
// if (gpu_mem != pTracker.GPUParametersConst()->gpumem) return; //TODO!
6970

70-
#ifndef __OPENCLCPP__
71-
#define GPUCA_OPENCL1
72-
#endif
7371
#define GPUCA_KRNL(x_class, x_attributes, x_arguments, x_forward) GPUCA_KRNL_WRAP(GPUCA_KRNL_LOAD_, x_class, x_attributes, x_arguments, x_forward)
7472
#define GPUCA_KRNL_LOAD_single(x_class, x_attributes, x_arguments, x_forward) GPUCA_KRNLGPU_SINGLE(x_class, x_attributes, x_arguments, x_forward)
7573
#define GPUCA_KRNL_LOAD_multi(x_class, x_attributes, x_arguments, x_forward) GPUCA_KRNLGPU_MULTI(x_class, x_attributes, x_arguments, x_forward)
7674
#define GPUCA_CONSMEM_PTR GPUglobal() char *gpu_mem, GPUconstant() MEM_CONSTANT(GPUConstantMem) * pConstant,
7775
#define GPUCA_CONSMEM *pConstant
7876
#include "GPUReconstructionKernels.h"
7977
#undef GPUCA_KRNL
80-
#undef GPUCA_OPENCL1
8178
#undef GPUCA_KRNL_LOAD_single
8279
#undef GPUCA_KRNL_LOAD_multi
8380

GPU/GPUTracking/Global/GPUChainTracking.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ void GPUChainTracking::ConvertRun2RawToNative()
719719

720720
void GPUChainTracking::ConvertZSEncoder(bool zs12bit)
721721
{
722+
#ifdef HAVE_O2HEADERS
722723
GPUTrackingInOutZS* tmp;
723724
GPUReconstructionConvert::RunZSEncoder(mIOPtrs.tpcPackedDigits, tmp, param(), zs12bit);
724725
mIOPtrs.tpcZS = tmp;
@@ -731,6 +732,7 @@ void GPUChainTracking::ConvertZSEncoder(bool zs12bit)
731732
}
732733
}
733734
}
735+
#endif
734736
}
735737

736738
void GPUChainTracking::ConvertZSFilter(bool zs12bit)

0 commit comments

Comments
 (0)