-
Notifications
You must be signed in to change notification settings - Fork 483
TPC QC: Add skeleton for GPUErrorQA task #13964
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,73 @@ | ||||||||||||||||||
| // 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 <unordered_map> | ||||||||||||||||||
| #include <gsl/span> | ||||||||||||||||||
|
|
||||||||||||||||||
| // root includes | ||||||||||||||||||
| #include "TH1.h" | ||||||||||||||||||
|
|
||||||||||||||||||
| // o2 includes | ||||||||||||||||||
| // #include "DataFormatsTPC/Defs.h" | ||||||||||||||||||
|
Comment on lines
+24
to
+28
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use forward declaration for TH1
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| namespace o2 | ||||||||||||||||||
| { | ||||||||||||||||||
| namespace tpc | ||||||||||||||||||
| { | ||||||||||||||||||
| namespace qc | ||||||||||||||||||
| { | ||||||||||||||||||
|
Comment on lines
+30
to
+35
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| /// @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(gsl::span<const std::array<uint32_t, 4>> errors); | ||||||||||||||||||
|
|
||||||||||||||||||
| /// Initialize all histograms | ||||||||||||||||||
| void initializeHistograms(); | ||||||||||||||||||
|
|
||||||||||||||||||
| /// Reset all histograms | ||||||||||||||||||
| void resetHistograms(); | ||||||||||||||||||
|
|
||||||||||||||||||
| /// return histograms | ||||||||||||||||||
| std::unordered_map<std::string, std::unique_ptr<TH1>>& getMapHist() { return mMapHist; }; | ||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the histograms don't need to be filled outside, this can be const
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| /// Dump results to a file | ||||||||||||||||||
| void dumpToFile(std::string filename); | ||||||||||||||||||
|
|
||||||||||||||||||
| private: | ||||||||||||||||||
| std::unordered_map<std::string, std::unique_ptr<TH1>> mMapHist; | ||||||||||||||||||
| ClassDefNV(GPUErrorQA, 1) | ||||||||||||||||||
| }; | ||||||||||||||||||
| } // namespace qc | ||||||||||||||||||
| } // namespace tpc | ||||||||||||||||||
| } // namespace o2 | ||||||||||||||||||
|
Comment on lines
+69
to
+71
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| #endif // AliceO2_TPC_QC_GPUERRORQA_H | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,79 @@ | ||||||||||||||||||||||||||
| // 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 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #include <cmath> | ||||||||||||||||||||||||||
| #include <memory> | ||||||||||||||||||||||||||
| #include <unordered_map> | ||||||||||||||||||||||||||
|
Comment on lines
+15
to
+16
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's already defined in the header
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // root includes | ||||||||||||||||||||||||||
| #include "TFile.h" | ||||||||||||||||||||||||||
| #include <TH1.h> | ||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // o2 includes | ||||||||||||||||||||||||||
| #include "TPCQC/GPUErrorQA.h" | ||||||||||||||||||||||||||
| #include "GPUDefMacros.h" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ClassImp(o2::tpc::qc::GPUErrorQA); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| using namespace o2::tpc::qc; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| //______________________________________________________________________________ | ||||||||||||||||||||||||||
| void GPUErrorQA::initializeHistograms() | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| TH1::AddDirectory(false); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // get gpu error names | ||||||||||||||||||||||||||
| // copied from GPUErrors.h | ||||||||||||||||||||||||||
| static std::unordered_map<uint32_t, const char*> errorNames = { | ||||||||||||||||||||||||||
| #define GPUCA_ERROR_CODE(num, name, ...) {num, GPUCA_M_STR(name)}, | ||||||||||||||||||||||||||
| #include "GPUErrorCodes.h" | ||||||||||||||||||||||||||
| #undef GPUCA_ERROR_CODE | ||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // 1D histogram counting all reported errors | ||||||||||||||||||||||||||
| mMapHist["ErrorCounter"] = std::make_unique<TH1F>("ErrorCounter", "ErrorCounter", errorNames.size(), 0, errorNames.size()); | ||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this a histogram of floats? If it is a simple counter, it could also be |
||||||||||||||||||||||||||
| 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 < mMapHist["ErrorCounter"]->GetNbinsX(); bin++) { | ||||||||||||||||||||||||||
| auto const& it = errorNames.find(bin); | ||||||||||||||||||||||||||
| mMapHist["ErrorCounter"]->GetXaxis()->SetBinLabel(bin, it->second); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| //______________________________________________________________________________ | ||||||||||||||||||||||||||
| void GPUErrorQA::resetHistograms() | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| for (const auto& pair : mMapHist) { | ||||||||||||||||||||||||||
| pair.second->Reset(); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| //______________________________________________________________________________ | ||||||||||||||||||||||||||
| void GPUErrorQA::processErrors(gsl::span<const std::array<uint32_t, 4>> errors) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| for (const auto& error : errors) { | ||||||||||||||||||||||||||
| uint32_t errorCode = error[0]; | ||||||||||||||||||||||||||
| mMapHist["ErrorCounter"]->Fill(static_cast<float>(errorCode)); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| //______________________________________________________________________________ | ||||||||||||||||||||||||||
| void GPUErrorQA::dumpToFile(const std::string filename) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| auto f = std::unique_ptr<TFile>(TFile::Open(filename.data(), "recreate")); | ||||||||||||||||||||||||||
| for (const auto& [name, hist] : mMapHist) { | ||||||||||||||||||||||||||
| TObjArray arr; | ||||||||||||||||||||||||||
| arr.SetName(name.data()); | ||||||||||||||||||||||||||
| arr.Add(hist.get()); | ||||||||||||||||||||||||||
| arr.Write(arr.GetName(), TObject::kSingleKey); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+73
to
+78
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To me it does not make sense to put each histogram in a separate array.
Suggested change
|
||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
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.