Skip to content

Commit 0429a54

Browse files
committed
Feat: add skeleton for GPUErrorQA task
1 parent 97c3e51 commit 0429a54

File tree

4 files changed

+128
-1
lines changed

4 files changed

+128
-1
lines changed

Diff for: Detectors/TPC/qc/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ o2_add_library(TPCQC
1919
src/SACs.cxx
2020
src/IDCsVsSACs.cxx
2121
src/TrackClusters.cxx
22+
src/GPUErrorQA.cxx
2223
PUBLIC_LINK_LIBRARIES O2::TPCBase
2324
O2::DataFormatsTPC
2425
O2::GPUO2Interface
@@ -36,7 +37,8 @@ o2_target_root_dictionary(TPCQC
3637
include/TPCQC/DCSPTemperature.h
3738
include/TPCQC/SACs.h
3839
include/TPCQC/IDCsVsSACs.h
39-
include/TPCQC/TrackClusters.h)
40+
include/TPCQC/TrackClusters.h
41+
include/TPCQC/GPUErrorQA.h)
4042

4143
o2_add_test(PID
4244
COMPONENT_NAME tpc

Diff for: Detectors/TPC/qc/include/TPCQC/GPUErrorQA.h

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
///
13+
/// @file GPUErrorQA.h
14+
/// @author Anton Riedel, [email protected]
15+
///
16+
17+
#ifndef AliceO2_TPC_QC_GPUERRORQA_H
18+
#define AliceO2_TPC_QC_GPUERRORQA_H
19+
20+
#include <memory>
21+
#include <gsl/span>
22+
23+
// root includes
24+
#include "TH1.h"
25+
26+
// o2 includes
27+
// #include "DataFormatsTPC/Defs.h"
28+
29+
namespace o2
30+
{
31+
namespace tpc
32+
{
33+
namespace qc
34+
{
35+
36+
/// @brief TPC QC task for errors from GPU reconstruction
37+
///
38+
/// This class is used to retrieve and visualize GPU errors
39+
/// according to corresponding error code and location.
40+
///
41+
/// origin: TPC
42+
/// @author Anton Riedel, [email protected]
43+
class GPUErrorQA
44+
{
45+
public:
46+
/// \brief Constructor.
47+
GPUErrorQA() = default;
48+
49+
/// process gpu error reported by the reconstruction workflow
50+
void processErrors(gsl::span<const std::array<uint32_t, 4>> errors);
51+
52+
/// Initialize all histograms
53+
void initializeHistograms();
54+
55+
/// Reset all histograms
56+
void resetHistograms();
57+
58+
/// Dump results to a file
59+
void dumpToFile(std::string filename);
60+
61+
private:
62+
std::unique_ptr<TH1F> mHist;
63+
ClassDefNV(GPUErrorQA, 1)
64+
};
65+
} // namespace qc
66+
} // namespace tpc
67+
} // namespace o2
68+
69+
#endif // AliceO2_TPC_QC_GPUERRORQA_H

Diff for: Detectors/TPC/qc/src/GPUErrorQA.cxx

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2019-2025 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#define _USE_MATH_DEFINES
13+
14+
#include <cmath>
15+
#include <memory>
16+
17+
// root includes
18+
#include "TFile.h"
19+
#include <TH1.h>
20+
21+
// o2 includes
22+
#include "TPCQC/GPUErrorQA.h"
23+
#include "GPUErrors.h"
24+
25+
ClassImp(o2::tpc::qc::GPUErrorQA);
26+
27+
using namespace o2::tpc::qc;
28+
29+
//______________________________________________________________________________
30+
void GPUErrorQA::initializeHistograms()
31+
{
32+
TH1::AddDirectory(false);
33+
mHist = std::make_unique<TH1F>("ErrorCounter", "ErrorCounter", o2::gpu::GPUErrors::getMaxErrors(), 0, o2::gpu::GPUErrors::getMaxErrors());
34+
}
35+
//______________________________________________________________________________
36+
void GPUErrorQA::resetHistograms()
37+
{
38+
mHist->Reset();
39+
}
40+
//______________________________________________________________________________
41+
void GPUErrorQA::processErrors(gsl::span<const std::array<uint32_t, 4>> errors)
42+
{
43+
for (const auto& error : errors) {
44+
uint32_t errorCode = error[0];
45+
mHist->Fill(static_cast<float>(errorCode));
46+
}
47+
}
48+
49+
//______________________________________________________________________________
50+
void GPUErrorQA::dumpToFile(const std::string filename)
51+
{
52+
auto f = std::unique_ptr<TFile>(TFile::Open(filename.c_str(), "recreate"));
53+
mHist->Write();
54+
f->Close();
55+
}

Diff for: Detectors/TPC/qc/src/TPCQCLinkDef.h

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#pragma link C++ class o2::tpc::qc::SACs + ;
2525
#pragma link C++ class o2::tpc::qc::IDCsVsSACs + ;
2626
#pragma link C++ class o2::tpc::qc::TrackClusters + ;
27+
#pragma link C++ class o2::tpc::qc::GPUErrorQA + ;
2728
#pragma link C++ function o2::tpc::qc::helpers::makeLogBinning + ;
2829
#pragma link C++ function o2::tpc::qc::helpers::setStyleHistogram1D + ;
2930
#pragma link C++ function o2::tpc::qc::helpers::setStyleHistogram2D + ;

0 commit comments

Comments
 (0)