]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCATrackerFramework.h
GPU framework update from David Rohr
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCATrackerFramework.h
1 //-*- Mode: C++ -*-
2 // @(#) $Id: AliHLTTPCCATracker.h 33907 2009-07-23 13:52:49Z sgorbuno $
3 // ************************************************************************
4 // This file is property of and copyright by the ALICE HLT Project        *
5 // ALICE Experiment at CERN, All rights reserved.                         *
6 // See cxx source for full Copyright notice                               *
7 //                                                                        *
8 //*************************************************************************
9
10 #ifndef ALIHLTTPCCATRACKERFRAMEWORK_H
11 #define ALIHLTTPCCATRACKERFRAMEWORK_H
12
13 #include "AliHLTTPCCATracker.h"
14 #include "AliHLTTPCCAGPUTracker.h"
15 #include "AliHLTTPCCAParam.h"
16 #include "AliHLTTPCCASliceOutput.h"
17 #include <iostream>
18
19 class AliHLTTPCCASliceOutput;
20 class AliHLTTPCCAClusterData;
21
22 class AliHLTTPCCATrackerFramework
23 {
24 public:
25         AliHLTTPCCATrackerFramework(int autoTryGPU = 1) :
26           fGPUTrackerAvailable(false), fUseGPUTracker(false), fGPUDebugLevel(0), fGPUSliceCount(0), fGPUTracker(), fOutputControl( NULL ), fCPUSliceCount(fgkNSlices)
27           {
28                 if (autoTryGPU)
29                 {
30                   fUseGPUTracker = (fGPUTrackerAvailable= (fGPUTracker.InitGPU() == 0));
31                   fGPUSliceCount = fGPUTrackerAvailable ? fGPUTracker.GetSliceCount() : 0;
32                 }
33           }
34         ~AliHLTTPCCATrackerFramework()
35           {}
36
37         int InitGPU(int sliceCount = 1, int forceDeviceID = -1);
38         int ExitGPU();
39         void SetGPUDebugLevel(int Level, std::ostream *OutFile = NULL, std::ostream *GPUOutFile = NULL);
40         int SetGPUTrackerOption(char* OptionName, int OptionValue) {return(fGPUTracker.SetGPUTrackerOption(OptionName, OptionValue));}
41         int SetGPUTracker(bool enable);
42
43         int InitializeSliceParam(int iSlice, AliHLTTPCCAParam &param);
44
45         GPUhd() const AliHLTTPCCASliceOutput::outputControlStruct* OutputControl() const { return fOutputControl; }
46         GPUhd() void SetOutputControl( AliHLTTPCCASliceOutput::outputControlStruct* val);
47
48         int ProcessSlices(int firstSlice, int sliceCount, AliHLTTPCCAClusterData* pClusterData, AliHLTTPCCASliceOutput** pOutput);
49         unsigned long long int* PerfTimer(int GPU, int iSlice, int iTimer);
50
51         int MaxSliceCount() const { return(fUseGPUTracker ? fGPUSliceCount : fCPUSliceCount); }
52         int GetGPUStatus() const { return(fGPUTrackerAvailable + fUseGPUTracker); }
53
54         const AliHLTTPCCAParam& Param(int iSlice) const { return(fCPUTrackers[iSlice].Param()); }
55         const AliHLTTPCCARow& Row(int iSlice, int iRow) const { return(fCPUTrackers[iSlice].Row(iRow)); }  //TODO: Should be changed to return only row parameters
56
57 private:
58   static const int fgkNSlices = 36;       //* N slices
59
60   bool fGPUTrackerAvailable; // Is the GPU Tracker Available?
61   bool fUseGPUTracker; // use the GPU tracker 
62   int fGPUDebugLevel;  // debug level for the GPU code
63   int fGPUSliceCount;   //How many slices to process parallel
64   AliHLTTPCCAGPUTracker fGPUTracker;
65
66   AliHLTTPCCASliceOutput::outputControlStruct* fOutputControl;
67
68   AliHLTTPCCATracker fCPUTrackers[fgkNSlices];
69   int fCPUSliceCount;
70
71   AliHLTTPCCATrackerFramework( const AliHLTTPCCATrackerFramework& );
72   AliHLTTPCCATrackerFramework &operator=( const AliHLTTPCCATrackerFramework& );
73
74 };
75
76 #endif