-
Notifications
You must be signed in to change notification settings - Fork 483
TPC QC: Add GPUErrorQA task #14397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
TPC QC: Add GPUErrorQA task #14397
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ab5cad3
Feat: add skeleton for GPUErrorQA task
ariedel-cern 3873f12
Feat: add GPUErrorQA class
ariedel-cern 78c3f10
Feat: movde error names to GPUErrors.h
ariedel-cern 0772de2
Fix: expose gpu error names with static function
ariedel-cern 7fd0535
Feat: account for missing error codes
ariedel-cern 1b72526
Fix: add header guard
ariedel-cern File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
| // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| // All rights not expressly granted are reserved. | ||
| // | ||
| // This software is distributed under the terms of the GNU General Public | ||
| // License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // In applying this license CERN does not waive the privileges and immunities | ||
| // granted to it by virtue of its status as an Intergovernmental Organization | ||
| // or submit itself to any jurisdiction. | ||
|
|
||
| /// | ||
| /// @file GPUErrorQA.h | ||
| /// @author Anton Riedel, anton.riedel@cern.ch | ||
| /// | ||
|
|
||
| #ifndef AliceO2_TPC_QC_GPUERRORQA_H | ||
| #define AliceO2_TPC_QC_GPUERRORQA_H | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
| #include <vector> | ||
| #include <unordered_map> | ||
|
|
||
| // root includes | ||
|
|
||
| // o2 includes | ||
| // #include "DataFormatsTPC/Defs.h" | ||
|
|
||
| class TH1; | ||
| namespace o2::tpc::qc | ||
| { | ||
|
|
||
| /// @brief TPC QC task for errors from GPU reconstruction | ||
| /// | ||
| /// This class is used to retrieve and visualize GPU errors | ||
| /// according to corresponding error code and location. | ||
| /// | ||
| /// origin: TPC | ||
| /// @author Anton Riedel, anton.riedel@cern.ch | ||
| class GPUErrorQA | ||
| { | ||
| public: | ||
| /// \brief Constructor. | ||
| GPUErrorQA() = default; | ||
|
|
||
| /// process gpu error reported by the reconstruction workflow | ||
| void processErrors(std::vector<std::array<uint32_t, 4>> errors); | ||
|
|
||
| /// Initialize all histograms | ||
| void initializeHistograms(); | ||
|
|
||
| /// Reset all histograms | ||
| void resetHistograms(); | ||
|
|
||
| /// return histograms | ||
| const std::unordered_map<std::string, std::unique_ptr<TH1>>& getMapHist() const { return mMapHist; } | ||
|
|
||
| /// Dump results to a file | ||
| void dumpToFile(std::string filename); | ||
|
|
||
| private: | ||
| std::unordered_map<std::string, std::unique_ptr<TH1>> mMapHist; | ||
|
|
||
| ClassDefNV(GPUErrorQA, 2); | ||
| }; | ||
| } // namespace o2::tpc::qc | ||
|
|
||
| #endif // AliceO2_TPC_QC_GPUERRORQA_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| // Copyright 2019-2025 CERN and copyright holders of ALICE O2. | ||
| // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| // All rights not expressly granted are reserved. | ||
| // | ||
| // This software is distributed under the terms of the GNU General Public | ||
| // License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // In applying this license CERN does not waive the privileges and immunities | ||
| // granted to it by virtue of its status as an Intergovernmental Organization | ||
| // or submit itself to any jurisdiction. | ||
|
|
||
| #define _USE_MATH_DEFINES | ||
|
|
||
| // root includes | ||
| #include "TFile.h" | ||
| #include "TH1I.h" | ||
|
|
||
| // o2 includes | ||
| #include "TPCQC/GPUErrorQA.h" | ||
| #include "GPUErrors.h" | ||
|
|
||
| ClassImp(o2::tpc::qc::GPUErrorQA); | ||
|
|
||
| using namespace o2::tpc::qc; | ||
|
|
||
| //______________________________________________________________________________ | ||
| void GPUErrorQA::initializeHistograms() | ||
| { | ||
| TH1::AddDirectory(false); | ||
|
|
||
| auto const& errorNames = o2::gpu::GPUErrors::getErrorNames(); | ||
|
|
||
| int maxErrorCode = 1; | ||
| for (const auto& [key, _] : errorNames) { | ||
| if (static_cast<int>(key) > maxErrorCode) { | ||
| maxErrorCode = key; | ||
| } | ||
| } | ||
|
|
||
| // 1D histogram counting all reported errors | ||
| mMapHist["ErrorCounter"] = std::make_unique<TH1I>("ErrorCounter", "ErrorCounter", maxErrorCode, -0.5, maxErrorCode - 0.5); | ||
| mMapHist["ErrorCounter"]->GetXaxis()->SetTitle("Error Codes"); | ||
| mMapHist["ErrorCounter"]->GetYaxis()->SetTitle("Entries"); | ||
| // for convienence, label each bin with the error name | ||
| for (size_t bin = 1; bin <= maxErrorCode; bin++) { | ||
| auto const& it = errorNames.find(bin); | ||
| if (it != errorNames.end()) { | ||
| mMapHist["ErrorCounter"]->GetXaxis()->SetBinLabel(bin, it->second); | ||
| } else { | ||
| mMapHist["ErrorCounter"]->GetXaxis()->SetBinLabel(bin, "NO_DEF"); | ||
| } | ||
| } | ||
| } | ||
| //______________________________________________________________________________ | ||
| void GPUErrorQA::resetHistograms() | ||
| { | ||
| for (const auto& pair : mMapHist) { | ||
| pair.second->Reset(); | ||
| } | ||
| } | ||
| //______________________________________________________________________________ | ||
| void GPUErrorQA::processErrors(std::vector<std::array<uint32_t, 4>> errors) | ||
| { | ||
| for (const auto& error : errors) { | ||
| uint32_t errorCode = error[0]; | ||
| mMapHist["ErrorCounter"]->AddBinContent(errorCode); | ||
| } | ||
| } | ||
|
|
||
| //______________________________________________________________________________ | ||
| void GPUErrorQA::dumpToFile(const std::string filename) | ||
| { | ||
| auto f = std::unique_ptr<TFile>(TFile::Open(filename.data(), "recreate")); | ||
| TObjArray arr; | ||
| arr.SetName("GPUErrorQA_Hists"); | ||
| for ([[maybe_unused]] const auto& [name, hist] : mMapHist) { | ||
| arr.Add(hist.get()); | ||
| } | ||
| arr.Write(arr.GetName(), TObject::kSingleKey); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still, you need to protect unordered_map with
#ifndeg GPUCA_GPUCODE_DEVICE.We do not include any std headers in GPU kernel code.
And I think you don't need GPUDefMacros.h, do you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I also fixed up the includes.