Skip to content

Commit

Permalink
GPU: Add GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf and remove cop…
Browse files Browse the repository at this point in the history
…y&paste
  • Loading branch information
davidrohr committed Nov 8, 2024
1 parent ac19d82 commit c4f9811
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Detectors/TPC/workflow/src/EntropyEncoderSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc)
LOG(fatal) << "configKeyValue tpcTriggeredMode does not match GRP isDetContinuousReadOut(TPC) setting";
}

mConfig->configGRP.grpContinuousMaxTimeBin = (GRPGeomHelper::instance().getGRPECS()->getNHBFPerTF() * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(GRPGeomHelper::instance().getGRPECS()->getNHBFPerTF());
mConfig->configGRP.solenoidBzNominalGPU = GPUO2InterfaceUtils::getNominalGPUBz(*GRPGeomHelper::instance().getGRPMagField());
mParam->UpdateSettings(&mConfig->configGRP);

Expand Down
7 changes: 6 additions & 1 deletion GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ std::unique_ptr<GPUParam> GPUO2InterfaceUtils::getFullParam(float solenoidBz, ui
*autoMaxTimeBin = (*pConfiguration)->configGRP.grpContinuousMaxTimeBin == -1;
}
if ((*pConfiguration)->configGRP.grpContinuousMaxTimeBin == -1) {
(*pConfiguration)->configGRP.grpContinuousMaxTimeBin = (nHbfPerTf * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
(*pConfiguration)->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(nHbfPerTf);
}
retVal->SetDefaults(&(*pConfiguration)->configGRP, &(*pConfiguration)->configReconstruction, &(*pConfiguration)->configProcessing, nullptr);
return retVal;
Expand All @@ -135,3 +135,8 @@ void GPUO2InterfaceUtils::paramUseExternalOccupancyMap(GPUParam* param, uint32_t
}
}
}

uint32_t GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(uint32_t nHbf)
{
return (nHbf * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
}
1 change: 1 addition & 0 deletions GPU/GPUTracking/Interface/GPUO2InterfaceUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class GPUO2InterfaceUtils
static std::unique_ptr<GPUParam> getFullParam(float solenoidBz, uint32_t nHbfPerTf = 0, std::unique_ptr<GPUO2InterfaceConfiguration>* pConfiguration = nullptr, std::unique_ptr<GPUSettingsO2>* pO2Settings = nullptr, bool* autoMaxTimeBin = nullptr);
static std::shared_ptr<GPUParam> getFullParamShared(float solenoidBz, uint32_t nHbfPerTf = 0, std::unique_ptr<GPUO2InterfaceConfiguration>* pConfiguration = nullptr, std::unique_ptr<GPUSettingsO2>* pO2Settings = nullptr, bool* autoMaxTimeBin = nullptr); // Return owning pointer
static void paramUseExternalOccupancyMap(GPUParam* param, uint32_t nHbfPerTf, const uint32_t* occupancymap, int32_t occupancyMapSize);
static uint32_t getTpcMaxTimeBinFromNHbf(uint32_t nHbf);

class GPUReconstructionZSDecoder
{
Expand Down
4 changes: 2 additions & 2 deletions GPU/Workflow/src/GPUWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void GPURecoWorkflowSpec::init(InitContext& ic)
mAutoSolenoidBz = mConfParam->solenoidBzNominalGPU == -1e6f;
mAutoContinuousMaxTimeBin = mConfig->configGRP.grpContinuousMaxTimeBin < 0;
if (mAutoContinuousMaxTimeBin) {
mConfig->configGRP.grpContinuousMaxTimeBin = ((mConfParam->overrideNHbfPerTF ? mConfParam->overrideNHbfPerTF : 256) * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(mConfParam->overrideNHbfPerTF ? mConfParam->overrideNHbfPerTF : 256);
}
if (mConfig->configProcessing.deviceNum == -2) {
int32_t myId = ic.services().get<const o2::framework::DeviceSpec>().inputTimesliceId;
Expand Down Expand Up @@ -1013,7 +1013,7 @@ void GPURecoWorkflowSpec::doCalibUpdates(o2::framework::ProcessingContext& pc, c
LOG(info) << "Updating solenoid field " << newCalibValues.solenoidField;
}
if (mAutoContinuousMaxTimeBin) {
mConfig->configGRP.grpContinuousMaxTimeBin = (mTFSettings->nHBFPerTF * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(mTFSettings->nHBFPerTF);
newCalibValues.newContinuousMaxTimeBin = true;
newCalibValues.continuousMaxTimeBin = mConfig->configGRP.grpContinuousMaxTimeBin;
LOG(info) << "Updating max time bin " << newCalibValues.continuousMaxTimeBin << " (" << mTFSettings->nHBFPerTF << " orbits)";
Expand Down
2 changes: 1 addition & 1 deletion GPU/Workflow/src/O2GPUDPLDisplay.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void O2GPUDPLDisplaySpec::run(ProcessingContext& pc)
mGRPGeomUpdated = false;
mConfig->configGRP.solenoidBzNominalGPU = GPUO2InterfaceUtils::getNominalGPUBz(*GRPGeomHelper::instance().getGRPMagField());
if (mAutoContinuousMaxTimeBin) {
mConfig->configGRP.grpContinuousMaxTimeBin = (mTFSettings->nHBFPerTF * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(mTFSettings->nHBFPerTF);
}
mDisplay->UpdateGRP(&mConfig->configGRP);
if (mGeometryCreated == 0) {
Expand Down

0 comments on commit c4f9811

Please sign in to comment.