Skip to content

Commit ab7a243

Browse files
Use template wrapper<S, F>
1 parent c6039f5 commit ab7a243

28 files changed

Lines changed: 510 additions & 460 deletions

GPU/Common/GPUCommonAlgorithm.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,20 @@ namespace o2::gpu
2828
{
2929
class GPUCommonAlgorithm
3030
{
31+
3132
public:
3233
template <class T>
33-
GPUd() static void sort(T* begin, T* end);
34+
GPUd() static void sort(T begin, T end);
3435
template <class T>
3536
GPUd() static void sortInBlock(T* begin, T* end);
3637
template <class T>
37-
GPUd() static void sortDeviceDynamic(T* begin, T* end);
38+
GPUd() static void sortDeviceDynamic(T begin, T end);
3839
template <class T, class S>
39-
GPUd() static void sort(T* begin, T* end, const S& comp);
40+
GPUd() static void sort(T begin, T end, const S& comp);
4041
template <class T, class S>
4142
GPUd() static void sortInBlock(T* begin, T* end, const S& comp);
4243
template <class T, class S>
43-
GPUd() static void sortDeviceDynamic(T* begin, T* end, const S& comp);
44+
GPUd() static void sortDeviceDynamic(T begin, T end, const S& comp);
4445
#ifndef __OPENCL__
4546
template <class T, class S>
4647
GPUh() static void sortOnDevice(auto* rec, int32_t stream, T* begin, size_t N, const S& comp);
@@ -224,7 +225,7 @@ namespace o2::gpu
224225
{
225226

226227
template <class T>
227-
GPUdi() void GPUCommonAlgorithm::sortDeviceDynamic(T* begin, T* end)
228+
GPUdi() void GPUCommonAlgorithm::sortDeviceDynamic(T begin, T end)
228229
{
229230
#ifndef GPUCA_GPUCODE
230231
GPUCommonAlgorithm::sort(begin, end);
@@ -234,7 +235,7 @@ GPUdi() void GPUCommonAlgorithm::sortDeviceDynamic(T* begin, T* end)
234235
}
235236

236237
template <class T, class S>
237-
GPUdi() void GPUCommonAlgorithm::sortDeviceDynamic(T* begin, T* end, const S& comp)
238+
GPUdi() void GPUCommonAlgorithm::sortDeviceDynamic(T begin, T end, const S& comp)
238239
{
239240
GPUCommonAlgorithm::sort(begin, end, comp);
240241
}
@@ -248,7 +249,7 @@ namespace o2::gpu
248249
{
249250

250251
template <class T>
251-
GPUdi() void GPUCommonAlgorithm::sort(T* begin, T* end)
252+
GPUdi() void GPUCommonAlgorithm::sort(T begin, T end)
252253
{
253254
#ifdef GPUCA_ALGORITHM_STD
254255
std::sort(begin, end);
@@ -258,7 +259,7 @@ GPUdi() void GPUCommonAlgorithm::sort(T* begin, T* end)
258259
}
259260

260261
template <class T, class S>
261-
GPUdi() void GPUCommonAlgorithm::sort(T* begin, T* end, const S& comp)
262+
GPUdi() void GPUCommonAlgorithm::sort(T begin, T end, const S& comp)
262263
{
263264
#ifdef GPUCA_ALGORITHM_STD
264265
std::sort(begin, end, comp);

GPU/Common/GPUCommonAlgorithmThrust.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "GPUCommonDef.h"
2727
#include "GPUCommonHelpers.h"
28+
#include "GPUTPCTrack.h"
2829

2930
#ifndef __HIPCC__ // CUDA
3031
#include <cub/cub.cuh>
@@ -81,19 +82,15 @@ GPUdi() void GPUCommonAlgorithm::sortInBlock(T* begin, T* end, const S& comp)
8182
*/
8283

8384
template <class T>
84-
GPUdi() void GPUCommonAlgorithm::sortDeviceDynamic(T* begin, T* end)
85+
GPUdi() void GPUCommonAlgorithm::sortDeviceDynamic(T begin, T end)
8586
{
86-
thrust::device_ptr<T> thrustBegin(begin);
87-
thrust::device_ptr<T> thrustEnd(end);
88-
thrust::sort(GPUCA_THRUST_NAMESPACE::par, thrustBegin, thrustEnd);
87+
thrust::sort(GPUCA_THRUST_NAMESPACE::par, begin, end);
8988
}
9089

9190
template <class T, class S>
92-
GPUdi() void GPUCommonAlgorithm::sortDeviceDynamic(T* begin, T* end, const S& comp)
91+
GPUdi() void GPUCommonAlgorithm::sortDeviceDynamic(T begin, T end, const S& comp)
9392
{
94-
thrust::device_ptr<T> thrustBegin(begin);
95-
thrust::device_ptr<T> thrustEnd(end);
96-
thrust::sort(GPUCA_THRUST_NAMESPACE::par, thrustBegin, thrustEnd, comp);
93+
thrust::sort(GPUCA_THRUST_NAMESPACE::par, begin, end, comp);
9794
}
9895

9996
#ifndef GPUCA_GPUCODE_COMPILEKERNELS

0 commit comments

Comments
 (0)