@@ -303,7 +303,10 @@ bool GPUChainTracking::ValidateSettings()
303303 GPUError (" Invalid outputs for double pipeline mode 0x%x" , (unsigned int )GetRecoStepsOutputs ());
304304 return false ;
305305 }
306- if (((GetRecoStepsOutputs ().isSet (GPUDataTypes::InOutType::TPCCompressedClusters) && mOutputCompressedClusters == nullptr ) || (GetRecoStepsOutputs ().isSet (GPUDataTypes::InOutType::TPCClusters) && mOutputClustersNative == nullptr ) || (GetRecoStepsOutputs ().isSet (GPUDataTypes::InOutType::TPCMergedTracks) && mOutputTPCTracks == nullptr ))) {
306+ if (((GetRecoStepsOutputs ().isSet (GPUDataTypes::InOutType::TPCCompressedClusters) && mSubOutputControls [GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::compressedClusters)] == nullptr ) ||
307+ (GetRecoStepsOutputs ().isSet (GPUDataTypes::InOutType::TPCClusters) && mSubOutputControls [GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::clustersNative)] == nullptr ) ||
308+ (GetRecoStepsOutputs ().isSet (GPUDataTypes::InOutType::TPCMergedTracks) && mSubOutputControls [GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::tpcTracks)] == nullptr ) ||
309+ (GetProcessingSettings ().outputSharedClusterMap && mSubOutputControls [GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::sharedClusterMap)] == nullptr ))) {
307310 GPUError (" Must use external output for double pipeline mode" );
308311 return false ;
309312 }
@@ -342,20 +345,10 @@ int GPUChainTracking::Init()
342345 return 1 ;
343346 }
344347
345- if (mOutputCompressedClusters == nullptr ) {
346- mOutputCompressedClusters = &mRec ->OutputControl ();
347- }
348- if (mOutputClustersNative == nullptr ) {
349- mOutputClustersNative = &mRec ->OutputControl ();
350- }
351- if (mOutputTPCTracks == nullptr ) {
352- mOutputTPCTracks = &mRec ->OutputControl ();
353- }
354- if (mOutputSharedClusterMap == nullptr ) {
355- mOutputSharedClusterMap = &mRec ->OutputControl ();
356- }
357- if (mOutputClusterLabels == nullptr ) {
358- mOutputClusterLabels = &mRec ->OutputControl ();
348+ for (unsigned int i = 0 ; i < mSubOutputControls .size (); i++) {
349+ if (mSubOutputControls [i] == nullptr ) {
350+ mSubOutputControls [i] = &mRec ->OutputControl ();
351+ }
359352 }
360353
361354 if (!ValidateSettings ()) {
@@ -1128,7 +1121,7 @@ int GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
11281121 AllocateRegisteredMemory (mInputsHost ->mResourceClusterNativeBuffer );
11291122 }
11301123 if (buildNativeHost && !(buildNativeGPU && GetProcessingSettings ().delayedOutput )) {
1131- AllocateRegisteredMemory (mInputsHost ->mResourceClusterNativeOutput , mOutputClustersNative );
1124+ AllocateRegisteredMemory (mInputsHost ->mResourceClusterNativeOutput , mSubOutputControls [ GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::clustersNative)] );
11321125 }
11331126
11341127 GPUTPCLinearLabels mcLinearLabels;
@@ -1377,10 +1370,10 @@ int GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
13771370 if (propagateMCLabels) {
13781371 // TODO: write to buffer directly
13791372 o2::dataformats::MCTruthContainer<o2::MCCompLabel> mcLabels;
1380- if (mOutputClusterLabels == nullptr || !mOutputClusterLabels ->allocator ) {
1373+ if (mSubOutputControls [ GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::clusterLabels)] == nullptr || !mSubOutputControls [ GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::clusterLabels)] ->allocator ) {
13811374 throw std::runtime_error (" Cluster MC Label buffer missing" );
13821375 }
1383- ClusterNativeAccess::ConstMCLabelContainerViewWithBuffer* container = reinterpret_cast <ClusterNativeAccess::ConstMCLabelContainerViewWithBuffer*>(mOutputClusterLabels ->allocator (0 ));
1376+ ClusterNativeAccess::ConstMCLabelContainerViewWithBuffer* container = reinterpret_cast <ClusterNativeAccess::ConstMCLabelContainerViewWithBuffer*>(mSubOutputControls [ GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::clusterLabels)] ->allocator (0 ));
13841377
13851378 assert (propagateMCLabels ? mcLinearLabels.header .size () == nClsTotal : true );
13861379 assert (propagateMCLabels ? mcLinearLabels.data .size () >= nClsTotal : true );
@@ -1393,7 +1386,7 @@ int GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
13931386
13941387 if (buildNativeHost && buildNativeGPU && GetProcessingSettings ().delayedOutput ) {
13951388 mInputsHost ->mNClusterNative = mInputsShadow ->mNClusterNative = nClsTotal;
1396- AllocateRegisteredMemory (mInputsHost ->mResourceClusterNativeOutput , mOutputClustersNative );
1389+ AllocateRegisteredMemory (mInputsHost ->mResourceClusterNativeOutput , mSubOutputControls [ GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::clustersNative)] );
13971390 for (unsigned int i = outputQueueStart; i < mOutputQueue .size (); i++) {
13981391 mOutputQueue [i].dst = (char *)mInputsHost ->mPclusterNativeOutput + (size_t )mOutputQueue [i].dst ;
13991392 }
@@ -1959,8 +1952,8 @@ int GPUChainTracking::RunTPCTrackingMerger(bool synchronizeOutput)
19591952
19601953 SynchronizeGPU (); // Need to know the full number of slice tracks
19611954 SetupGPUProcessor (&Merger, true );
1962- AllocateRegisteredMemory (Merger.MemoryResOutput (), mOutputTPCTracks );
1963- AllocateRegisteredMemory (Merger.MemoryResOutputState (), mOutputSharedClusterMap );
1955+ AllocateRegisteredMemory (Merger.MemoryResOutput (), mSubOutputControls [ GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::tpcTracks)] );
1956+ AllocateRegisteredMemory (Merger.MemoryResOutputState (), mSubOutputControls [ GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::sharedClusterMap)] );
19641957
19651958 if (Merger.CheckSlices ()) {
19661959 return 1 ;
@@ -2182,7 +2175,7 @@ int GPUChainTracking::RunTPCCompression()
21822175 O->nAttachedClustersReduced = O->nAttachedClusters - O->nTracks ;
21832176 O->nSliceRows = NSLICES * GPUCA_ROW_COUNT;
21842177 O->nComppressionModes = param ().rec .tpcCompressionModes ;
2185- size_t outputSize = AllocateRegisteredMemory (Compressor.mMemoryResOutputHost , mOutputCompressedClusters );
2178+ size_t outputSize = AllocateRegisteredMemory (Compressor.mMemoryResOutputHost , mSubOutputControls [ GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::compressedClusters)] );
21862179 Compressor.mOutputFlat ->set (outputSize, *Compressor.mOutput );
21872180 char * hostFlatPtr = (char *)Compressor.mOutput ->qTotU ; // First array as allocated in GPUTPCCompression::SetPointersCompressedClusters
21882181 size_t copySize = 0 ;
@@ -2325,7 +2318,7 @@ int GPUChainTracking::RunTPCDecompression()
23252318 TPCClusterDecompressor decomp;
23262319 auto allocator = [this ](size_t size) {
23272320 this ->mInputsHost ->mNClusterNative = this ->mInputsShadow ->mNClusterNative = size;
2328- this ->AllocateRegisteredMemory (this ->mInputsHost ->mResourceClusterNativeOutput , this ->mOutputClustersNative );
2321+ this ->AllocateRegisteredMemory (this ->mInputsHost ->mResourceClusterNativeOutput , this ->mSubOutputControls [ GPUTrackingOutputs::getIndex (&GPUTrackingOutputs::clustersNative)] );
23292322 return this ->mInputsHost ->mPclusterNativeOutput ;
23302323 };
23312324 auto & gatherTimer = getTimer<TPCClusterDecompressor>(" TPCDecompression" , 0 );
0 commit comments