]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fix of segm. violation in the GPU tracker (by D.Rohr)
authorsgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 May 2012 10:34:31 +0000 (10:34 +0000)
committersgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 May 2012 10:34:31 +0000 (10:34 +0000)
HLT/TPCLib/tracking-ca/AliHLTTPCCACompressedInputData.h
HLT/TPCLib/tracking-ca/AliHLTTPCCASliceData.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCASliceOutTrack.h
HLT/TPCLib/tracking-ca/AliHLTTPCCATrackerComponent.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCATrackerFramework.cxx

index 785f163935c123e03f45261e6ebb6bea8bb47b2c..68234274cf7800a1e41dda9fab3cd98f0046c023 100644 (file)
@@ -2,7 +2,11 @@
 #ifndef ALIHLTTPCCACOMPRESSEDINPUTDATA_H
 #define ALIHLTTPCCACOMPRESSEDINPUTDATA_H
 
+#ifdef HLTCA_STANDALONE
+#include "AliHLTTPCRootTypes.h"
+#else
 #include "Rtypes.h"
+#endif
 
 /**
  * @struct AliHLTTPCCACompressedCluster
index 91d1e60a226ad662e584672cf24b910bae59827c..ed878daf0251804ca0f56d658b70e1d5547e4f3a 100644 (file)
@@ -167,15 +167,26 @@ size_t AliHLTTPCCASliceData::SetPointers(const AliHLTTPCCAClusterData *data, boo
     // HitWeights, ClusterDataIndex
     fNumberOfHitsPlusAlign * 2 * sizeof( int );
 
-  if ( 1 ){// fMemorySize < memorySize ) { // release the memory on CPU
-       fMemorySize = memorySize;
-       if (allocate && !fIsGpuSliceData)
+  if ( 1 )// fMemorySize < memorySize ) { // release the memory on CPU
+  {
+       fMemorySize = memorySize + 4;
+       if (allocate)
        {
-               if (fMemory)
+               if (!fIsGpuSliceData)
+               {
+                       if (fMemory)
+                       {
+                               delete[] fMemory;
+                       }
+                       fMemory = new char[fMemorySize];// kVectorAlignment];
+               }
+               else
                {
-                       delete[] fMemory;
+                       if (fMemorySize > HLTCA_GPU_SLICE_DATA_MEMORY)
+                       {
+                               return(0);
+                       }
                }
-         fMemory = new char[fMemorySize + 4];// kVectorAlignment];
        }
   }
 
@@ -209,7 +220,7 @@ void AliHLTTPCCASliceData::InitFromClusterData( const AliHLTTPCCAClusterData &da
   }
   const int memorySize = fNumberOfHits * sizeof( short_v::Type )
   */
-  SetPointers(&data, true);
+  if (SetPointers(&data, true) == 0) return;
 
   ////////////////////////////////////
   // 2. fill HitData and FirstHitInBin
index 7b164ca45d806ca8e70c9df4f3f9dc026817110b..6617a20cf6b67ea4b950b6b9b6ef840c78904ae3 100644 (file)
@@ -59,8 +59,11 @@ class AliHLTTPCCASliceOutTrack
     AliHLTTPCCABaseTrackParam fParam; //* fitted track parameters at its innermost cluster
     int fNClusters;             //* number of track clusters
        int fLocalTrackId;                      //See AliHLTPCCATrack.h
+#ifdef HLTCA_STANDALONE
+    AliHLTTPCCASliceOutCluster fClusters[1]; //* track clusters
+#else
     AliHLTTPCCASliceOutCluster fClusters[0]; //* track clusters
-
+#endif
        static const int fgkMaxTrackIdInSlice = 4096;
 };
 
index f928900d94e8579fa0a39a88181bb9ea732877e2..bd3e6e63ad1786db66819848411dc28234020db0 100644 (file)
@@ -631,8 +631,15 @@ int AliHLTTPCCATrackerComponent::DoEvent
          Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reading hits",
                           "Total %d hits to read for slice %d", nClustersTotal, slice );
 
+         if (nClustersTotal > 500000)
+         {
+                 HLTWarning( "Too many clusters in tracker input: Slice %d, Number of Clusters %d, some clusters are droped", slice, nClustersTotal );
+                 nClustersTotal = 500000;
+         }
+
 
          clusterData[islice].StartReading( slice, nClustersTotal );
+         int nSliceClust = 0;
 
          for ( std::vector<unsigned long>::iterator pIter = patchIndices.begin(); pIter != patchIndices.end(); pIter++ ) {
                ndx = *pIter;
@@ -650,7 +657,11 @@ int AliHLTTPCCATrackerComponent::DoEvent
                      HLTError( "Wrong TPC cluster with row number %d received", c->fPadRow );
                      continue;
                    }
-                   clusterData[islice].ReadCluster( c->fID, c->fPadRow, c->fX, c->fY, c->fZ, c->fCharge );
+                       if (nSliceClust < nClustersTotal)
+                       {
+                     clusterData[islice].ReadCluster( c->fID, c->fPadRow, c->fX, c->fY, c->fZ, c->fCharge );
+                         nSliceClust++;
+                       }
                  }           
                } else         
                if ( iter->fDataType == AliHLTTPCCADefinitions::fgkCompressedInputDataType){
@@ -683,8 +694,9 @@ int AliHLTTPCCATrackerComponent::DoEvent
                      
                      UInt_t cluId = AliHLTTPCSpacePointData::GetID( jslice, jpatch, nPatchClust );
                      //cout<<"clu "<<i<<": "<<x<<" "<<y<<" "<<z<<" "<<cluId<<endl;
-                     if ( CAMath::Abs( z ) <= fClusterZCut ){
+                     if ( CAMath::Abs( z ) <= fClusterZCut && nSliceClust < nClustersTotal){
                        clusterData[islice].ReadCluster( cluId, jrow, x, y, z, 0 );
+                       nSliceClust++;
                      }
                      nPatchClust++;              
                    }
@@ -726,7 +738,7 @@ int AliHLTTPCCATrackerComponent::DoEvent
   for (int islice = 0;islice < slicecount;islice++)
   {
     if( outputControl.fEndOfSpace ){
-      HLTWarning( "Output buffer size exceed, tracks are not stored" );
+      HLTWarning( "Output buffer size exceed (buffer size %d, current size %d), tracks are not stored", maxBufferSize, mySize );
       ret = -ENOSPC;
       error = 1;
       break;     
@@ -744,7 +756,7 @@ int AliHLTTPCCATrackerComponent::DoEvent
       }
     else
       {
-       HLTWarning( "Output buffer size exceed (buffer size %d, current size %d), tracks are not stored", maxBufferSize, mySize );
+       HLTWarning( "Error during Tracking, no tracks stored" );
        mySize = 0;
        ret = -ENOSPC;
        ntracks = 0;
index 56d409a34e8c2c8fde572442986727a98d5179b7..804803a86e88bb74b8316e673c4ff08259e928aa 100644 (file)
@@ -283,6 +283,7 @@ AliHLTTPCCATrackerFramework::~AliHLTTPCCATrackerFramework()
        {
                if (fGPUTracker)
                {
+                       ExitGPU();
 #ifdef R__WIN32
                        FARPROC destroyFunc = GetProcAddress(hGPULib, "AliHLTTPCCAGPUTrackerNVCCDestroy");
 #else