Skip to content

Commit 42e1f6a

Browse files
committed
GPU: debug files of multiple GPU Reconstruciton instances shall not overwrite each other
1 parent 8789c46 commit 42e1f6a

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

GPU/GPUTracking/Base/GPUReconstruction.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ GPUReconstruction::GPUReconstruction(const GPUSettingsDeviceBackend& cfg) : mHos
8787
throw std::invalid_argument("Cannot be slave to a slave");
8888
}
8989
mMaster = cfg.master;
90+
mSlaveId = cfg.master->mSlaves.size();
9091
cfg.master->mSlaves.emplace_back(this);
9192
}
9293
param().SetDefaults(mGRPSettings.get());

GPU/GPUTracking/Base/GPUReconstruction.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ class GPUReconstruction
190190
// Helpers to fetch processors from other shared libraries
191191
virtual void GetITSTraits(std::unique_ptr<o2::its::TrackerTraits>* trackerTraits, std::unique_ptr<o2::its::VertexerTraits>* vertexerTraits, std::unique_ptr<o2::its::TimeFrame>* timeFrame);
192192
bool slavesExist() { return mSlaves.size() || mMaster; }
193+
int slaveId() { return mSlaveId; }
193194

194195
// Getters / setters for parameters
195196
DeviceType GetDeviceType() const;
@@ -339,6 +340,7 @@ class GPUReconstruction
339340

340341
GPUReconstruction* mMaster = nullptr; // Ptr to a GPUReconstruction object serving as master, sharing GPU memory, events, etc.
341342
std::vector<GPUReconstruction*> mSlaves; // Ptr to slave GPUReconstructions
343+
int mSlaveId = -1; // Id of this slave (-1 for master)
342344

343345
// Others
344346
bool mInitialized = false;

GPU/GPUTracking/Global/GPUChainTracking.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,8 @@ int32_t GPUChainTracking::Init()
378378
}
379379

380380
if (GetProcessingSettings().debugLevel >= 6) {
381-
mDebugFile->open(mRec->IsGPU() ? "GPU.out" : "CPU.out");
381+
std::string filename = std::string(mRec->IsGPU() ? "GPU" : "CPU") + (mRec->slaveId() != -1 ? (std::string("_slave") + std::to_string(mRec->slaveId())) : std::string(mRec->slavesExist() ? "_master" : "")) + ".out";
382+
mDebugFile->open(filename.c_str());
382383
}
383384

384385
return 0;

0 commit comments

Comments
 (0)