1 // ************************************************************************
2 // This file is property of and copyright by the ALICE HLT Project *
3 // ALICE Experiment at CERN, All rights reserved. *
4 // See cxx source for full Copyright notice *
6 //*************************************************************************
8 #ifndef ALIHLTTPCCAGPUTRACKERNVCC_H
9 #define ALIHLTTPCCAGPUTRACKERNVCC_H
11 #include "AliHLTTPCCAGPUTracker.h"
12 #include "AliHLTTPCCADef.h"
13 #include "AliHLTTPCCATracker.h"
14 #include "AliHLTLogging.h"
15 #include "AliHLTTPCCASliceOutput.h"
19 class AliHLTTPCCAGPUTrackerNVCC : public AliHLTTPCCAGPUTracker, public AliHLTLogging
22 AliHLTTPCCAGPUTrackerNVCC();
23 virtual ~AliHLTTPCCAGPUTrackerNVCC();
25 virtual int InitGPU(int sliceCount = 12, int forceDeviceID = -1);
26 virtual int Reconstruct(AliHLTTPCCASliceOutput** pOutput, AliHLTTPCCAClusterData* pClusterData, int fFirstSlice, int fSliceCount = -1);
27 virtual int ExitGPU();
29 virtual void SetDebugLevel(const int dwLevel, std::ostream* const NewOutFile = NULL);
30 virtual int SetGPUTrackerOption(char* OptionName, int OptionValue);
32 virtual unsigned long long int* PerfTimer(int iSlice, unsigned int i);
34 virtual int InitializeSliceParam(int iSlice, AliHLTTPCCAParam ¶m);
35 virtual void SetOutputControl( AliHLTTPCCASliceOutput::outputControlStruct* val);
37 virtual const AliHLTTPCCASliceOutput::outputControlStruct* OutputControl() const;
38 virtual int GetSliceCount() const;
41 static void* RowMemory(void* const BaseMemory, int iSlice) { return( ((char*) BaseMemory) + iSlice * sizeof(AliHLTTPCCARow) * (HLTCA_ROW_COUNT + 1) ); }
42 static void* CommonMemory(void* const BaseMemory, int iSlice) { return( ((char*) BaseMemory) + HLTCA_GPU_ROWS_MEMORY + iSlice * AliHLTTPCCATracker::CommonMemorySize() ); }
43 static void* SliceDataMemory(void* const BaseMemory, int iSlice) { return( ((char*) BaseMemory) + HLTCA_GPU_ROWS_MEMORY + HLTCA_GPU_COMMON_MEMORY + iSlice * HLTCA_GPU_SLICE_DATA_MEMORY ); }
44 void* GlobalMemory(void* const BaseMemory, int iSlice) const { return( ((char*) BaseMemory) + HLTCA_GPU_ROWS_MEMORY + HLTCA_GPU_COMMON_MEMORY + fSliceCount * (HLTCA_GPU_SLICE_DATA_MEMORY) + iSlice * HLTCA_GPU_GLOBAL_MEMORY ); }
45 void* TracksMemory(void* const BaseMemory, int iSlice) const { return( ((char*) BaseMemory) + HLTCA_GPU_ROWS_MEMORY + HLTCA_GPU_COMMON_MEMORY + fSliceCount * (HLTCA_GPU_SLICE_DATA_MEMORY) + iSlice * HLTCA_GPU_TRACKS_MEMORY ); }
46 void* TrackerMemory(void* const BaseMemory, int iSlice) const { return( ((char*) BaseMemory) + HLTCA_GPU_ROWS_MEMORY + HLTCA_GPU_COMMON_MEMORY + fSliceCount * (HLTCA_GPU_SLICE_DATA_MEMORY + HLTCA_GPU_TRACKS_MEMORY) + iSlice * sizeof(AliHLTTPCCATracker) ); }
48 void DumpRowBlocks(AliHLTTPCCATracker* tracker, int iSlice, bool check = true);
50 void ReleaseGlobalLock(void* sem);
51 int CheckMemorySizes(int sliceCount);
53 AliHLTTPCCATracker *fGpuTracker;
55 void* fHostLockedMemory;
57 int CUDASync(char* state = "UNKNOWN");
58 template <class T> T* alignPointer(T* ptr, int alignment);
60 void StandalonePerfTime(int iSlice, int i);
62 int fDebugLevel; //Debug Level for GPU Tracker
63 std::ostream* fOutFile; //Debug Output Stream Pointer
64 unsigned long long int fGPUMemSize; //Memory Size to allocate on GPU
70 static const int fgkNSlices = 36;
71 AliHLTTPCCATracker fSlaveTrackers[fgkNSlices];
73 bool CudaFailedMsg(cudaError_t error);
74 #endif //HLTCA_GPUCODE
76 AliHLTTPCCASliceOutput::outputControlStruct* fOutputControl;
78 static bool fgGPUUsed;
83 AliHLTTPCCAGPUTrackerNVCC( const AliHLTTPCCAGPUTrackerNVCC& );
84 AliHLTTPCCAGPUTrackerNVCC &operator=( const AliHLTTPCCAGPUTrackerNVCC& );
86 ClassDef( AliHLTTPCCAGPUTrackerNVCC, 0 )
90 #define DLL_EXPORT __declspec(dllexport)
95 extern "C" DLL_EXPORT AliHLTTPCCAGPUTracker* AliHLTTPCCAGPUTrackerNVCCCreate();
96 extern "C" DLL_EXPORT void AliHLTTPCCAGPUTrackerNVCCDestroy(AliHLTTPCCAGPUTracker* ptr);
98 #endif //ALIHLTTPCCAGPUTRACKER_H