@@ -825,11 +825,31 @@ void GPURecoWorkflowSpec::run(ProcessingContext& pc)
825825
826826 lockDecodeInput.reset ();
827827
828+ uint32_t threadIndex;
828829 if (mConfParam ->dump ) {
829- if (mNTFs == 1 ) {
830- mGPUReco ->DumpSettings ();
830+ if (mSpecConfig .enableDoublePipeline && pipelineContext->jobSubmitted ) {
831+ while (pipelineContext->jobThreadIndex == -1 ) {
832+ }
833+ threadIndex = pipelineContext->jobThreadIndex ;
834+ } else {
835+ threadIndex = 0 ; // TODO: Not sure if this is safe, but it is not yet known which threadIndex will pick up the enqueued job
836+ }
837+
838+ std::string dir = " " ;
839+ if (mConfParam ->dumpFolder != " " ) {
840+ dir = std::regex_replace (mConfParam ->dumpFolder , std::regex (" \\ [P\\ ]" ), std::to_string (getpid ()));
841+ if (mNTFs == 1 ) {
842+ mkdir (dir.c_str (), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
843+ }
844+ dir += " /" ;
845+ }
846+ if (mNTFs == 1 ) { // Must dump with first TF, since will enforce enqueued calib updates
847+ mGPUReco ->DumpSettings (threadIndex, dir.c_str ());
848+ }
849+ if (tinfo.tfCounter >= mConfParam ->dumpFirst && (mConfParam ->dumpLast == -1 || tinfo.tfCounter <= mConfParam ->dumpLast )) {
850+ mGPUReco ->DumpEvent (mNTFDumps , &ptrs, threadIndex, dir.c_str ());
851+ mNTFDumps ++;
831852 }
832- mGPUReco ->DumpEvent (mNTFs - 1 , &ptrs);
833853 }
834854 std::unique_ptr<GPUTrackingInOutPointers> ptrsDump;
835855 if (mConfParam ->dumpBadTFMode == 2 ) {
@@ -847,9 +867,10 @@ void GPURecoWorkflowSpec::run(ProcessingContext& pc)
847867 std::unique_lock lk (pipelineContext->jobFinishedMutex );
848868 pipelineContext->jobFinishedNotify .wait (lk, [context = pipelineContext.get ()]() { return context->jobFinished ; });
849869 retVal = pipelineContext->jobReturnValue ;
870+ threadIndex = pipelineContext->jobThreadIndex ;
850871 } else {
851872 // uint32_t threadIndex = pc.services().get<ThreadPool>().threadIndex;
852- uint32_t threadIndex = mNextThreadIndex ;
873+ threadIndex = mNextThreadIndex ;
853874 if (mConfig ->configProcessing .doublePipeline ) {
854875 mNextThreadIndex = (mNextThreadIndex + 1 ) % 2 ;
855876 }
@@ -879,7 +900,7 @@ void GPURecoWorkflowSpec::run(ProcessingContext& pc)
879900 }
880901 fclose (fp);
881902 } else if (mConfParam ->dumpBadTFMode == 2 ) {
882- mGPUReco ->DumpEvent (mNDebugDumps - 1 , ptrsDump.get ());
903+ mGPUReco ->DumpEvent (mNDebugDumps - 1 , ptrsDump.get (), threadIndex );
883904 }
884905 }
885906
0 commit comments