Skip to content

Commit 4c0fee6

Browse files
authored
Merge d16c8a9 into sapling-pr-archive-ktf
2 parents 59ae7da + d16c8a9 commit 4c0fee6

39 files changed

+150
-133
lines changed

Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ void BarrelAlignmentSpec::updateTimeDependentParams(ProcessingContext& pc)
265265
prevField = newField;
266266
if (mDetMask[DetID::TPC]) {
267267
mTPCParam.reset(new o2::gpu::GPUParam);
268-
mTPCParam->SetDefaults(o2::base::Propagator::Instance()->getNominalBz());
268+
mTPCParam->SetDefaults(o2::base::Propagator::Instance()->getNominalBz(), false);
269269
mController->setTPCParam(mTPCParam.get());
270270
}
271271
}

Framework/AnalysisSupport/src/Plugin.cxx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,24 @@ struct RunSummary : o2::framework::ServicePlugin {
117117
LOGP(info, "Last file opened: {}", lastFileRead);
118118
}
119119
}
120+
for (size_t li = 0; li < metrics.metricLabels.size(); ++li) {
121+
MetricLabel const&label = metrics.metricLabels[li];
122+
if (strcmp(label.label, "aod-file-open-info") != 0) {
123+
continue;
124+
}
125+
MetricInfo const&metric = metrics.metrics[li];
126+
auto &files = metrics.stringMetrics[metric.storeIdx];
127+
if (metric.filledMetrics) {
128+
LOGP(info, "### Files opened stats ###");
129+
}
130+
std::string lastFileRead;
131+
for (size_t fi = 0; fi < metric.filledMetrics; ++fi) {
132+
lastFileRead = files[fi % files.size()].data;
133+
}
134+
if (lastFileRead.empty() == false) {
135+
LOGP(info, "Last file opened: {}", lastFileRead);
136+
}
137+
}
120138
} },
121139
.kind = ServiceKind::Serial};
122140
}

Framework/Core/include/Framework/AnalysisDataModel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ DECLARE_SOA_COLUMN(Chi2NDF, chi2NDF, float); //! chi^
17761776
DECLARE_SOA_COLUMN(PsiPair, psiPair, float); //! Psi pair
17771777
DECLARE_SOA_COLUMN(DCAr, dcaR, float); //! DCA in radial direction
17781778
DECLARE_SOA_COLUMN(DCAz, dcaZ, float); //! DCA in z direction
1779-
DECLARE_SOA_COLUMN(Mass, mass, float); //! mass of the conversion. Do NOT use for cut!
1779+
DECLARE_SOA_COLUMN(MassInMeV, mass, float); //! mass of the conversion in MeV. Do NOT use for cut!
17801780
} // namespace oftv0
17811781
namespace pmd
17821782
{
@@ -1824,7 +1824,7 @@ DECLARE_SOA_TABLE(Run2OTFV0s, "AOD", "Run2OTFV0", //! Run 2 V0 on the fly table
18241824
run2::oftv0::X, run2::oftv0::Y, run2::oftv0::Z,
18251825
run2::oftv0::Chi2NDF, run2::oftv0::PsiPair,
18261826
run2::oftv0::DCAr, run2::oftv0::DCAz,
1827-
run2::oftv0::Mass);
1827+
run2::oftv0::MassInMeV);
18281828

18291829
using Run2OTFV0 = Run2OTFV0s::iterator;
18301830

Framework/Core/include/Framework/TableBuilder.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -753,11 +753,12 @@ auto makeEmptyTable()
753753
return b.finalize();
754754
}
755755

756-
template <typename... Cs>
757-
auto makeEmptyTable(const char* name, framework::pack<Cs...> p)
756+
757+
template <PackLike P>
758+
auto makeEmptyTable(const char* name)
758759
{
759760
TableBuilder b;
760-
[[maybe_unused]] auto writer = b.cursor(p);
761+
[[maybe_unused]] auto writer = b.cursor(P{});
761762
b.setLabel(name);
762763
return b.finalize();
763764
}
@@ -772,7 +773,7 @@ auto spawner(std::shared_ptr<arrow::Table> const& fullTable, const char* name, o
772773
{
773774
using placeholders_pack_t = typename o2::aod::MetadataTrait<D>::metadata::placeholders_pack_t;
774775
if (fullTable->num_rows() == 0) {
775-
return makeEmptyTable(name, placeholders_pack_t{});
776+
return makeEmptyTable<placeholders_pack_t>(name);
776777
}
777778
return spawnerHelper(fullTable, schema, framework::pack_size(placeholders_pack_t{}), projectors, name, projector);
778779
}
@@ -791,7 +792,7 @@ auto spawner(std::shared_ptr<arrow::Table> const& fullTable, const char* name, e
791792
{
792793
using expression_pack_t = typename o2::aod::MetadataTrait<D>::metadata::expression_pack_t;
793794
if (fullTable->num_rows() == 0) {
794-
return makeEmptyTable(name, expression_pack_t{});
795+
return makeEmptyTable<expression_pack_t>(name);
795796
}
796797
return spawnerHelper(fullTable, schema, framework::pack_size(expression_pack_t{}), projectors, name, projector);
797798
}
@@ -805,12 +806,12 @@ auto spawner(std::vector<std::shared_ptr<arrow::Table>>&& tables, const char* na
805806
}
806807

807808
template <typename... C>
808-
auto spawner(framework::pack<C...>, std::vector<std::shared_ptr<arrow::Table>>&& tables, const char* name, expressions::Projector* projectors, std::shared_ptr<gandiva::Projector>& projector, std::shared_ptr<arrow::Schema> const& schema)
809+
auto spawner(framework::pack<C...> columns, std::vector<std::shared_ptr<arrow::Table>>&& tables, const char* name, expressions::Projector* projectors, std::shared_ptr<gandiva::Projector>& projector, std::shared_ptr<arrow::Schema> const& schema)
809810
{
810811
std::array<const char*, 1> labels{"original"};
811812
auto fullTable = soa::ArrowHelpers::joinTables(std::move(tables), std::span<const char* const>{labels});
812813
if (fullTable->num_rows() == 0) {
813-
return makeEmptyTable(name, framework::pack<C...>{});
814+
return makeEmptyTable<decltype(columns)>(name);
814815
}
815816
return spawnerHelper(fullTable, schema, sizeof...(C), projectors, name, projector);
816817
}

Framework/Foundation/include/Framework/Pack.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ constexpr std::size_t pack_size(pack<Ts...> const&)
3030
return sizeof...(Ts);
3131
}
3232

33+
template <typename P>
34+
concept PackLike = requires (P &p) { o2::framework::pack_size(p); };
35+
3336
template <std::size_t I, typename T>
3437
struct pack_element;
3538

GPU/GPUTracking/Base/GPUParam.cxx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ using namespace o2::gpu;
3030

3131
#include "utils/qconfigrtc.h"
3232

33-
void GPUParam::SetDefaults(float solenoidBz)
33+
void GPUParam::SetDefaults(float solenoidBz, bool assumeConstantBz)
3434
{
3535
memset((void*)this, 0, sizeof(*this));
3636
new (&rec) GPUSettingsRec;
@@ -83,8 +83,7 @@ void GPUParam::SetDefaults(float solenoidBz)
8383
}
8484
#endif
8585

86-
par.dAlpha = 0.349066f;
87-
UpdateBzOnly(solenoidBz);
86+
UpdateBzOnly(solenoidBz, assumeConstantBz);
8887
par.dodEdx = 0;
8988

9089
constexpr float plusZmin = 0.0529937;
@@ -102,36 +101,30 @@ void GPUParam::SetDefaults(float solenoidBz)
102101
if (tmp >= GPUCA_NSECTORS / 4) {
103102
tmp -= GPUCA_NSECTORS / 2;
104103
}
105-
SectorParam[i].Alpha = 0.174533f + par.dAlpha * tmp;
104+
SectorParam[i].Alpha = 0.174533f + dAlpha * tmp;
106105
SectorParam[i].CosAlpha = CAMath::Cos(SectorParam[i].Alpha);
107106
SectorParam[i].SinAlpha = CAMath::Sin(SectorParam[i].Alpha);
108-
SectorParam[i].AngleMin = SectorParam[i].Alpha - par.dAlpha / 2.f;
109-
SectorParam[i].AngleMax = SectorParam[i].Alpha + par.dAlpha / 2.f;
107+
SectorParam[i].AngleMin = SectorParam[i].Alpha - dAlpha / 2.f;
108+
SectorParam[i].AngleMax = SectorParam[i].Alpha + dAlpha / 2.f;
110109
}
111110

112-
par.assumeConstantBz = false;
113-
par.toyMCEventsFlag = false;
114111
par.continuousTracking = false;
115112
continuousMaxTimeBin = 0;
116113
tpcCutTimeBin = 0;
117-
par.debugLevel = 0;
118114
par.earlyTpcTransform = false;
119115
}
120116

121117
void GPUParam::UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessing* p, const GPURecoStepConfiguration* w, const GPUSettingsRecDynamic* d)
122118
{
123119
if (g) {
124-
UpdateBzOnly(g->solenoidBzNominalGPU);
125-
par.assumeConstantBz = g->constBz;
126-
par.toyMCEventsFlag = g->homemadeEvents;
120+
UpdateBzOnly(g->solenoidBzNominalGPU, g->constBz);
127121
par.continuousTracking = g->grpContinuousMaxTimeBin != 0;
128122
continuousMaxTimeBin = g->grpContinuousMaxTimeBin == -1 ? GPUSettings::TPC_MAX_TF_TIME_BIN : g->grpContinuousMaxTimeBin;
129123
tpcCutTimeBin = g->tpcCutTimeBin;
130124
}
131125
par.earlyTpcTransform = rec.tpc.forceEarlyTransform == -1 ? (!par.continuousTracking) : rec.tpc.forceEarlyTransform;
132126
qptB5Scaler = CAMath::Abs(bzkG) > 0.1f ? CAMath::Abs(bzkG) / 5.006680f : 1.f; // Repeat here, since passing in g is optional
133127
if (p) {
134-
par.debugLevel = p->debugLevel;
135128
UpdateRun3ClusterErrors(p->param.tpcErrorParamY, p->param.tpcErrorParamZ);
136129
}
137130
if (w) {
@@ -145,12 +138,12 @@ void GPUParam::UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessi
145138
}
146139
}
147140

148-
void GPUParam::UpdateBzOnly(float newSolenoidBz)
141+
void GPUParam::UpdateBzOnly(float newSolenoidBz, bool assumeConstantBz)
149142
{
150143
bzkG = newSolenoidBz;
151144
bzCLight = bzkG * o2::gpu::gpu_common_constants::kCLight;
152145
polynomialField.Reset();
153-
if (par.assumeConstantBz) {
146+
if (assumeConstantBz) {
154147
GPUTPCGMPolynomialFieldManager::GetPolynomialField(GPUTPCGMPolynomialFieldManager::kUniform, bzkG, polynomialField);
155148
} else {
156149
GPUTPCGMPolynomialFieldManager::GetPolynomialField(bzkG, polynomialField);
@@ -160,7 +153,7 @@ void GPUParam::UpdateBzOnly(float newSolenoidBz)
160153

161154
void GPUParam::SetDefaults(const GPUSettingsGRP* g, const GPUSettingsRec* r, const GPUSettingsProcessing* p, const GPURecoStepConfiguration* w)
162155
{
163-
SetDefaults(g->solenoidBzNominalGPU);
156+
SetDefaults(g->solenoidBzNominalGPU, g->constBz);
164157
if (r) {
165158
rec = *r;
166159
if (rec.fitPropagateBzOnly == -1) {

GPU/GPUTracking/Base/GPUParam.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ namespace internal
4747
{
4848
template <class T, class S>
4949
struct GPUParam_t {
50+
static constexpr float dAlpha = 0.349066f;
51+
5052
T rec;
5153
S par;
5254

@@ -77,10 +79,10 @@ struct GPUParam_t {
7779
struct GPUParam : public internal::GPUParam_t<GPUSettingsRec, GPUSettingsParam> {
7880

7981
#ifndef GPUCA_GPUCODE
80-
void SetDefaults(float solenoidBz);
82+
void SetDefaults(float solenoidBz, bool assumeConstantBz);
8183
void SetDefaults(const GPUSettingsGRP* g, const GPUSettingsRec* r = nullptr, const GPUSettingsProcessing* p = nullptr, const GPURecoStepConfiguration* w = nullptr);
8284
void UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessing* p = nullptr, const GPURecoStepConfiguration* w = nullptr, const GPUSettingsRecDynamic* d = nullptr);
83-
void UpdateBzOnly(float newSolenoidBz);
85+
void UpdateBzOnly(float newSolenoidBz, bool assumeConstantBz);
8486
void UpdateRun3ClusterErrors(const float* yErrorParam, const float* zErrorParam);
8587
#endif
8688

@@ -92,7 +94,7 @@ struct GPUParam : public internal::GPUParam_t<GPUSettingsRec, GPUSettingsParam>
9294
if (iSector >= GPUCA_NSECTORS / 4) {
9395
iSector -= GPUCA_NSECTORS / 2;
9496
}
95-
return 0.174533f + par.dAlpha * iSector;
97+
return 0.174533f + dAlpha * iSector;
9698
}
9799
GPUd() float GetClusterErrorSeeding(int32_t yz, int32_t type, float zDiff, float angle2, float unscaledMult) const;
98100
GPUd() void GetClusterErrorsSeeding2(uint8_t sector, int32_t row, float z, float sinPhi, float DzDs, float time, float& ErrY2, float& ErrZ2) const;

GPU/GPUTracking/Base/GPUReconstructionTimeframe.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@
2525
#include "TPCFastTransform.h"
2626
#include "CorrectionMapsHelper.h"
2727
#include "GPUO2DataTypes.h"
28+
#include "GPUSettings.h"
2829

2930
#include <cstdio>
3031
#include <exception>
3132
#include <memory>
3233
#include <cstring>
3334

34-
#include "utils/qconfig.h"
35-
3635
using namespace o2::gpu;
3736

3837
namespace o2::gpu

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -125,34 +125,25 @@ int32_t GPUReconstructionCUDA::InitDevice_Runtime()
125125
}
126126
std::vector<bool> devicesOK(count, false);
127127
std::vector<size_t> devMemory(count, 0);
128-
bool contextCreated = false;
128+
std::vector<bool> contextCreated(count, false);
129129
for (int32_t i = 0; i < count; i++) {
130130
if (GetProcessingSettings().debugLevel >= 4) {
131131
GPUInfo("Examining device %d", i);
132132
}
133133
size_t free, total;
134-
#ifndef __HIPCC__ // CUDA
135-
if (GPUChkErrI(cudaInitDevice(i, 0, 0))) {
136-
#else // HIP
137-
if (GPUChkErrI(hipSetDevice(i))) {
138-
#endif
134+
if (GPUChkErrI(cudaSetDevice(i))) {
139135
if (GetProcessingSettings().debugLevel >= 4) {
140136
GPUWarning("Couldn't create context for device %d. Skipping it.", i);
141137
}
142138
continue;
143139
}
144-
contextCreated = true;
140+
contextCreated[i] = true;
145141
if (GPUChkErrI(cudaMemGetInfo(&free, &total))) {
146142
if (GetProcessingSettings().debugLevel >= 4) {
147143
GPUWarning("Error obtaining CUDA memory info about device %d! Skipping it.", i);
148144
}
149-
GPUChkErr(cudaDeviceReset());
150145
continue;
151146
}
152-
if (count > 1) {
153-
GPUChkErr(cudaDeviceReset());
154-
contextCreated = false;
155-
}
156147
if (GetProcessingSettings().debugLevel >= 4) {
157148
GPUInfo("Obtained current memory usage for device %d", i);
158149
}
@@ -212,13 +203,20 @@ int32_t GPUReconstructionCUDA::InitDevice_Runtime()
212203
bestDevice = GetProcessingSettings().deviceNum;
213204
}
214205
}
215-
if (noDevice) {
216-
if (contextCreated) {
206+
for (int32_t i = 0; i < count; i++) {
207+
if (contextCreated[i] && (noDevice || i != bestDevice)) {
208+
GPUChkErrI(cudaSetDevice(i));
217209
GPUChkErrI(cudaDeviceReset());
218210
}
211+
}
212+
if (noDevice) {
219213
return (1);
220214
}
221215
mDeviceId = bestDevice;
216+
if (GPUChkErrI(cudaSetDevice(mDeviceId))) {
217+
GPUError("Could not set CUDA Device!");
218+
return (1);
219+
}
222220

223221
GPUChkErrI(cudaGetDeviceProperties(&deviceProp, mDeviceId));
224222

@@ -262,15 +260,6 @@ int32_t GPUReconstructionCUDA::InitDevice_Runtime()
262260
}
263261
#endif
264262

265-
#ifndef __HIPCC__ // CUDA
266-
if (contextCreated == 0 && GPUChkErrI(cudaInitDevice(mDeviceId, 0, 0))) {
267-
#else // HIP
268-
if (contextCreated == 0 && GPUChkErrI(hipSetDevice(mDeviceId))) {
269-
#endif
270-
GPUError("Could not set CUDA Device!");
271-
return (1);
272-
}
273-
274263
#ifndef __HIPCC__ // CUDA
275264
if (GPUChkErrI(cudaDeviceSetLimit(cudaLimitStackSize, GPUCA_GPU_STACK_SIZE))) {
276265
GPUError("Error setting CUDA stack size");
@@ -420,8 +409,10 @@ void GPUReconstructionCUDA::genAndLoadRTC()
420409
mInternals->kernelModules.emplace_back(std::make_unique<CUmodule>());
421410
GPUChkErr(cuModuleLoad(mInternals->kernelModules.back().get(), (filename + "_" + std::to_string(i) + mRtcBinExtension).c_str()));
422411
}
423-
remove((filename + "_" + std::to_string(i) + mRtcSrcExtension).c_str());
424-
remove((filename + "_" + std::to_string(i) + mRtcBinExtension).c_str());
412+
if (!GetProcessingSettings().rtctech.keepTempFiles) {
413+
remove((filename + "_" + std::to_string(i) + mRtcSrcExtension).c_str());
414+
remove((filename + "_" + std::to_string(i) + mRtcBinExtension).c_str());
415+
}
425416
}
426417
if (GetProcessingSettings().rtctech.runTest == 2) {
427418
return;

GPU/GPUTracking/DataCompression/GPUTPCCompressionTrackModel.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ GPUd() void GPUTPCCompressionTrackModel::Init(float x, float y, float z, float a
2727
{
2828
mProp.SetMaterialTPC();
2929
mProp.SetMaxSinPhi(GPUCA_MAX_SIN_PHI);
30-
mProp.SetToyMCEventsFlag(false);
3130
mProp.SetSeedingErrors(true); // Larger errors for seeds, better since we don't start with good hypothesis
3231
mProp.SetFitInProjections(true);
3332
mProp.SetPropagateBzOnly(true);

0 commit comments

Comments
 (0)