diff --git a/GPU/GPUTracking/Global/GPUChainTrackingSliceTracker.cxx b/GPU/GPUTracking/Global/GPUChainTrackingSliceTracker.cxx index 73e40ec05f9d0..7f88ced02ad48 100644 --- a/GPU/GPUTracking/Global/GPUChainTrackingSliceTracker.cxx +++ b/GPU/GPUTracking/Global/GPUChainTrackingSliceTracker.cxx @@ -247,6 +247,9 @@ int GPUChainTracking::RunTPCTrackingSlices_internal() runKernel(GetGridAuto(useStream), {iSlice}); } #endif + if (GetProcessingSettings().comparableDebutOutput) { + runKernel(GetGrid(1, 1, useStream), {iSlice}); + } DoDebugAndDump(RecoStep::TPCSliceTracking, 32, trk, &GPUTPCTracker::DumpStartHits, *mDebugFile); if (GetProcessingSettings().memoryAllocationStrategy == GPUMemoryResource::ALLOCATION_INDIVIDUAL) { diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.cxx index 63b9f9137a992..47033d5f82597 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.cxx @@ -70,3 +70,17 @@ GPUdii() void GPUTPCSectorDebugSortKernels::Thread +GPUdii() void GPUTPCSectorDebugSortKernels::Thread(int nBlocks, int nThreads, int iBlock, int iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() tracker) +{ + if (iThread || iBlock) { + return; + } + GPUCommonAlgorithm::sortDeviceDynamic(tracker.TrackletStartHits(), tracker.TrackletStartHits() + *tracker.NStartHits(), [](const GPUTPCHitId& a, const GPUTPCHitId& b) { + if (a.RowIndex() != b.RowIndex()) { + return (a.RowIndex() < b.RowIndex()); + } + return (a.HitIndex() < b.HitIndex()); + }); +} diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.h b/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.h index 8fb2bfe7a9c92..8d3c2d18a344b 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.h @@ -27,7 +27,8 @@ class GPUTPCSectorDebugSortKernels : public GPUKernelTemplate { public: enum K { defaultKernel = 0, - hitData = 0 }; + hitData = 0, + startHits = 1 }; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUDataTypes::RecoStep::TPCSliceTracking; } typedef GPUTPCTracker processorType; GPUhdi() static processorType* Processor(GPUConstantMem& processors) { return processors.tpcTrackers; } diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h b/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h index e2642bb10ce1a..9854512d508e2 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h @@ -230,7 +230,8 @@ class GPUTPCTracker : public GPUProcessor GPUhd() GPUglobalref() GPUAtomic(unsigned int) * NStartHits() const { return &mCommonMem->nStartHits; } GPUhd() GPUglobalref() const GPUTPCHitId& TrackletStartHit(int i) const { return mTrackletStartHits[i]; } - GPUhd() GPUglobalref() GPUTPCHitId* TrackletStartHits() const { return mTrackletStartHits; } + GPUhd() GPUglobalref() const GPUTPCHitId* TrackletStartHits() const { return mTrackletStartHits; } + GPUhd() GPUglobalref() GPUTPCHitId* TrackletStartHits() { return mTrackletStartHits; } GPUhd() GPUglobalref() GPUTPCHitId* TrackletTmpStartHits() const { return mTrackletTmpStartHits; } MEM_CLASS_PRE2() GPUhd() GPUglobalref() const MEM_LG2(GPUTPCTracklet) & Tracklet(int i) const { return mTracklets[i]; } diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackerDump.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCTrackerDump.cxx index c5d50779dfd49..0bc36147d2c27 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackerDump.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackerDump.cxx @@ -99,25 +99,10 @@ void GPUTPCTracker::DumpHitWeights(std::ostream& out) } } -int GPUTPCTracker::StarthitSortComparison(const void* a, const void* b) -{ - // qsort helper function to sort start hits - const GPUTPCHitId* aa = reinterpret_cast(a); - const GPUTPCHitId* bb = reinterpret_cast(b); - - if (aa->RowIndex() != bb->RowIndex()) { - return (aa->RowIndex() - bb->RowIndex()); - } - return (aa->HitIndex() - bb->HitIndex()); -} - void GPUTPCTracker::DumpStartHits(std::ostream& out) { // sort start hits and dump to file out << "\nStart Hits: (Slice" << mISlice << ") (" << *NStartHits() << ")" << std::endl; - if (mRec->GetProcessingSettings().comparableDebutOutput) { - qsort(TrackletStartHits(), *NStartHits(), sizeof(GPUTPCHitId), StarthitSortComparison); - } for (unsigned int i = 0; i < *NStartHits(); i++) { out << TrackletStartHit(i).RowIndex() << "-" << TrackletStartHit(i).HitIndex() << std::endl; } diff --git a/GPU/GPUTracking/kernels.cmake b/GPU/GPUTracking/kernels.cmake index a18cbcc568fe1..3a5c92256b222 100644 --- a/GPU/GPUTracking/kernels.cmake +++ b/GPU/GPUTracking/kernels.cmake @@ -24,6 +24,7 @@ o2_gpu_add_kernel("GPUTPCGlobalTrackingCopyNumbers" NO_OCL1 single o2_gpu_add_kernel("GPUTPCCreateSliceData" LB single) o2_gpu_add_kernel("GPUTPCGlobalTracking" LB single) o2_gpu_add_kernel("GPUTPCSectorDebugSortKernels, hitData" NO single) +o2_gpu_add_kernel("GPUTPCSectorDebugSortKernels, startHits" NO single) o2_gpu_add_kernel("GPUTPCCreateOccupancyMap, fill" LB simple GPUTPCClusterOccupancyMapBin* map) o2_gpu_add_kernel("GPUTPCCreateOccupancyMap, fold" LB simple GPUTPCClusterOccupancyMapBin* map) o2_gpu_add_kernel("GPUTPCGMMergerTrackFit" LB simple int mode)