Skip to content

Commit

Permalink
GPU: Rename some continuousMaxTimeBin to avoid confusion, improve def…
Browse files Browse the repository at this point in the history
…aults, and cleanup
  • Loading branch information
davidrohr committed Nov 8, 2024
1 parent 56ccb8b commit ac19d82
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Detectors/TPC/qc/src/Tracking.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void Tracking::initialize(outputModes outputMode, bool postprocessOnly)
const auto grp = o2::parameters::GRPObject::loadFrom();
if (grp) {
mQAConfig->configGRP.solenoidBzNominalGPU = GPUO2InterfaceUtils::getNominalGPUBz(*grp);
mQAConfig->configGRP.continuousMaxTimeBin = grp->isDetContinuousReadOut(o2::detectors::DetID::TPC) ? -1 : 0;
mQAConfig->configGRP.grpContinuousMaxTimeBin = grp->isDetContinuousReadOut(o2::detectors::DetID::TPC) ? -1 : 0;
} else {
throw std::runtime_error("Failed to initialize run parameters from GRP");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TPCTrackingDigitsPreCheck::precheckModifiedData TPCTrackingDigitsPreCheck::runPr
std::unique_ptr<precheckModifiedDataInternal> retVal = std::make_unique<precheckModifiedDataInternal>();
retVal->tpcDigitsMap = *ptrs->tpcPackedDigits;
const float zsThreshold = config->configReconstruction.tpc.zsThreshold;
const int maxContTimeBin = config->configGRP.continuousMaxTimeBin;
const int maxContTimeBin = config->configGRP.grpContinuousMaxTimeBin;
static bool filterOutOfTF = getenv("TPC_WORKFLOW_FILTER_DIGITS_OUTSIDE_OF_TF") && atoi(getenv("TPC_WORKFLOW_FILTER_DIGITS_OUTSIDE_OF_TF"));
bool updateDigits = (zsThreshold > 0 || filterOutOfTF) && ptrs->tpcZS == nullptr;
const auto& d = ptrs->tpcPackedDigits;
Expand Down
2 changes: 1 addition & 1 deletion Detectors/TPC/reconstruction/test/testGPUCATracking.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(CATracking_test1)
config.configProcessing.eventDisplay = nullptr; //Ptr to event display backend, for running standalone OpenGL event display

config.configGRP.solenoidBzNominalGPU = solenoidBz;
config.configGRP.continuousMaxTimeBin = continuous ? GPUSettings::TPC_MAX_TF_TIME_BIN : 0; //Number of timebins in timeframe if continuous, 0 otherwise
config.configGRP.grpContinuousMaxTimeBin = continuous ? GPUSettings::TPC_MAX_TF_TIME_BIN : 0; // Number of timebins in timeframe if continuous, 0 otherwise

config.configReconstruction.tpc.nWays = 3; //Should always be 3!
config.configReconstruction.tpc.nWaysOuter = true; //Will create outer param for TRD
Expand Down
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.continuousMaxTimeBin = (GRPGeomHelper::instance().getGRPECS()->getNHBFPerTF() * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
mConfig->configGRP.grpContinuousMaxTimeBin = (GRPGeomHelper::instance().getGRPECS()->getNHBFPerTF() * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
mConfig->configGRP.solenoidBzNominalGPU = GPUO2InterfaceUtils::getNominalGPUBz(*GRPGeomHelper::instance().getGRPMagField());
mParam->UpdateSettings(&mConfig->configGRP);

Expand Down
4 changes: 2 additions & 2 deletions GPU/GPUTracking/Base/GPUParam.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ void GPUParam::UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessi
UpdateBzOnly(g->solenoidBzNominalGPU);
par.assumeConstantBz = g->constBz;
par.toyMCEventsFlag = g->homemadeEvents;
par.continuousTracking = g->continuousMaxTimeBin != 0;
continuousMaxTimeBin = g->continuousMaxTimeBin == -1 ? GPUSettings::TPC_MAX_TF_TIME_BIN : g->continuousMaxTimeBin;
par.continuousTracking = g->grpContinuousMaxTimeBin != 0;
continuousMaxTimeBin = g->grpContinuousMaxTimeBin == -1 ? GPUSettings::TPC_MAX_TF_TIME_BIN : g->grpContinuousMaxTimeBin;
}
par.earlyTpcTransform = rec.tpc.forceEarlyTransform == -1 ? (!par.continuousTracking) : rec.tpc.forceEarlyTransform;
qptB5Scaler = CAMath::Abs(bzkG) > 0.1f ? CAMath::Abs(bzkG) / 5.006680f : 1.f; // Repeat here, since passing in g is optional
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUTracking/DataTypes/GPUSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct GPUSettingsGRP {
float solenoidBzNominalGPU = -5.00668f; // solenoid field strength
int32_t constBz = 0; // for test-MC events with constant Bz
int32_t homemadeEvents = 0; // Toy-MC events
int32_t continuousMaxTimeBin = 0; // 0 for triggered events, -1 for default TF length
int32_t grpContinuousMaxTimeBin = -2; // 0 for triggered events, -1 for automatic setting, -2 invalid default
int32_t needsClusterer = 0; // Set to true if the data requires the clusterizer
int32_t doCompClusterDecode = 0; // Set to true if the data contains compressed TPC clusters
};
Expand Down
4 changes: 2 additions & 2 deletions GPU/GPUTracking/Definitions/GPUSettingsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ AddOption(eventsDir, const char*, "pp", "events", 'e', "Directory with events to
AddOption(noEvents, bool, false, "", 0, "Run without data (e.g. for field visualization)")
AddOption(eventDisplay, int32_t, 0, "display", 'd', "Show standalone event display", def(1))
AddOption(eventGenerator, bool, false, "", 0, "Run event generator")
AddOption(cont, bool, false, "", 0, "Process continuous timeframe data")
AddOption(cont, bool, false, "", 0, "Process continuous timeframe data, even if input is triggered")
AddOption(outputcontrolmem, uint64_t, 0, "outputMemory", 0, "Use predefined output buffer of this size", min(0ul), message("Using %s bytes as output memory"))
AddOption(inputcontrolmem, uint64_t, 0, "inputMemory", 0, "Use predefined input buffer of this size", min(0ul), message("Using %s bytes as input memory"))
AddOption(cpuAffinity, int32_t, -1, "", 0, "Pin CPU affinity to this CPU core", min(-1))
Expand Down Expand Up @@ -525,7 +525,7 @@ EndConfig()
BeginSubConfig(GPUSettingsO2, global, configStandalone, "O2", 0, "O2 workflow settings", global)
AddOption(solenoidBzNominalGPU, float, -1e6f, "", 0, "Field strength of solenoid Bz in kGaus")
AddOption(constBz, bool, false, "", 0, "force constant Bz for tests")
AddOption(continuousMaxTimeBin, int32_t, 0, "", 0, "maximum time bin of continuous data, 0 for triggered events, -1 for default of 23ms")
AddOption(setMaxTimeBin, int32_t, -2, "", 0, "maximum time bin of continuous data, 0 for triggered events, -1 for automatic continuous mode, -2 for automatic continuous / triggered")
AddOption(overrideNHbfPerTF, int32_t, 0, "", 0, "Overrides the number of HBF per TF if != 0")
AddOption(deviceType, std::string, "CPU", "", 0, "Device type, CPU | CUDA | HIP | OCL1 | OCL2")
AddOption(forceDeviceType, bool, true, "", 0, "force device type, otherwise allows fall-back to CPU")
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUTracking/Global/GPUChainTracking.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ int32_t GPUChainTracking::DoQueuedUpdates(int32_t stream, bool updateSlave)
grp->solenoidBzNominalGPU = mNewCalibValues->solenoidField;
}
if (mNewCalibValues->newContinuousMaxTimeBin) {
grp->continuousMaxTimeBin = mNewCalibValues->continuousMaxTimeBin;
grp->grpContinuousMaxTimeBin = mNewCalibValues->continuousMaxTimeBin;
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions GPU/GPUTracking/Interface/GPUO2InterfaceConfigurableParam.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ GPUSettingsO2 GPUO2InterfaceConfiguration::ReadConfigurableParam(GPUO2InterfaceC
obj.configReconstruction = rec;
obj.configDisplay = display;
obj.configQA = QA;
if (obj.configGRP.continuousMaxTimeBin == 0 || obj.configGRP.continuousMaxTimeBin == -1) {
if (global.continuousMaxTimeBin) {
obj.configGRP.continuousMaxTimeBin = global.continuousMaxTimeBin;
if (obj.configGRP.grpContinuousMaxTimeBin < 0) {
if (global.setMaxTimeBin != -2) {
obj.configGRP.grpContinuousMaxTimeBin = global.setMaxTimeBin;
} else {
obj.configGRP.continuousMaxTimeBin = global.tpcTriggeredMode ? 0 : -1;
obj.configGRP.grpContinuousMaxTimeBin = global.tpcTriggeredMode ? 0 : -1;
}
}
if (global.solenoidBzNominalGPU > -1e6f) {
Expand Down
20 changes: 11 additions & 9 deletions GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,32 @@ std::unique_ptr<GPUParam> GPUO2InterfaceUtils::getFullParam(float solenoidBz, ui
{
std::unique_ptr<GPUParam> retVal = std::make_unique<GPUParam>();
std::unique_ptr<GPUO2InterfaceConfiguration> tmpConfig;
std::unique_ptr<GPUSettingsO2> tmpSettingsO2;
if (!pConfiguration) {
tmpConfig = std::make_unique<GPUO2InterfaceConfiguration>();
pConfiguration = &tmpConfig;
(*pConfiguration)->configGRP.continuousMaxTimeBin = -1;
(*pConfiguration)->configGRP.grpContinuousMaxTimeBin = -1;
} else if (!*pConfiguration) {
*pConfiguration = std::make_unique<GPUO2InterfaceConfiguration>();
(*pConfiguration)->configGRP.continuousMaxTimeBin = -1;
(*pConfiguration)->configGRP.grpContinuousMaxTimeBin = -1;
}
(*pConfiguration)->configGRP.solenoidBzNominalGPU = solenoidBz;
if (pO2Settings && *pO2Settings) {
**pO2Settings = (*pConfiguration)->ReadConfigurableParam();
} else if (pO2Settings) {
*pO2Settings = std::make_unique<GPUSettingsO2>((*pConfiguration)->ReadConfigurableParam());
} else {
(*pConfiguration)->ReadConfigurableParam();
if (!pO2Settings) {
pO2Settings = &tmpSettingsO2;
}
*pO2Settings = std::make_unique<GPUSettingsO2>((*pConfiguration)->ReadConfigurableParam());
}
if (nHbfPerTf == 0) {
nHbfPerTf = 256;
nHbfPerTf = (*pO2Settings)->overrideNHbfPerTF ? (*pO2Settings)->overrideNHbfPerTF : 256;
}
if (autoMaxTimeBin) {
*autoMaxTimeBin = (*pConfiguration)->configGRP.continuousMaxTimeBin == -1;
*autoMaxTimeBin = (*pConfiguration)->configGRP.grpContinuousMaxTimeBin == -1;
}
if ((*pConfiguration)->configGRP.continuousMaxTimeBin == -1) {
(*pConfiguration)->configGRP.continuousMaxTimeBin = (nHbfPerTf * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
if ((*pConfiguration)->configGRP.grpContinuousMaxTimeBin == -1) {
(*pConfiguration)->configGRP.grpContinuousMaxTimeBin = (nHbfPerTf * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
}
retVal->SetDefaults(&(*pConfiguration)->configGRP, &(*pConfiguration)->configReconstruction, &(*pConfiguration)->configProcessing, nullptr);
return retVal;
Expand Down
16 changes: 8 additions & 8 deletions GPU/GPUTracking/Standalone/Benchmark/standalone.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ int32_t SetupReconstruction()
printf("Error reading event config file\n");
return 1;
}
printf("Read event settings from dir %s (solenoidBz: %f, home-made events %d, constBz %d, maxTimeBin %d)\n", filename, rec->GetGRPSettings().solenoidBzNominalGPU, (int32_t)rec->GetGRPSettings().homemadeEvents, (int32_t)rec->GetGRPSettings().constBz, rec->GetGRPSettings().continuousMaxTimeBin);
printf("Read event settings from dir %s (solenoidBz: %f, home-made events %d, constBz %d, maxTimeBin %d)\n", filename, rec->GetGRPSettings().solenoidBzNominalGPU, (int32_t)rec->GetGRPSettings().homemadeEvents, (int32_t)rec->GetGRPSettings().constBz, rec->GetGRPSettings().grpContinuousMaxTimeBin);
if (configStandalone.testSyncAsync) {
recAsync->ReadSettings(filename);
}
Expand Down Expand Up @@ -331,7 +331,7 @@ int32_t SetupReconstruction()
grp.constBz = true;
}
if (configStandalone.TF.nMerge || configStandalone.TF.bunchSim) {
if (grp.continuousMaxTimeBin) {
if (grp.grpContinuousMaxTimeBin) {
printf("ERROR: requested to overlay continuous data - not supported\n");
return 1;
}
Expand All @@ -340,11 +340,11 @@ int32_t SetupReconstruction()
configStandalone.cont = true;
}
if (chainTracking->GetTPCTransformHelper()) {
grp.continuousMaxTimeBin = configStandalone.TF.timeFrameLen * ((double)GPUReconstructionTimeframe::TPCZ / (double)GPUReconstructionTimeframe::DRIFT_TIME) / chainTracking->GetTPCTransformHelper()->getCorrMap()->getVDrift();
grp.grpContinuousMaxTimeBin = configStandalone.TF.timeFrameLen * ((double)GPUReconstructionTimeframe::TPCZ / (double)GPUReconstructionTimeframe::DRIFT_TIME) / chainTracking->GetTPCTransformHelper()->getCorrMap()->getVDrift();
}
}
if (configStandalone.cont && grp.continuousMaxTimeBin == 0) {
grp.continuousMaxTimeBin = -1;
if (configStandalone.cont && grp.grpContinuousMaxTimeBin == 0) {
grp.grpContinuousMaxTimeBin = -1;
}
if (rec->GetDeviceType() == GPUReconstruction::DeviceType::CPU) {
printf("Standalone Test Framework for CA Tracker - Using CPU\n");
Expand Down Expand Up @@ -904,11 +904,11 @@ int32_t main(int argc, char** argv)

if (configStandalone.overrideMaxTimebin && (chainTracking->mIOPtrs.clustersNative || chainTracking->mIOPtrs.tpcPackedDigits || chainTracking->mIOPtrs.tpcZS)) {
GPUSettingsGRP grp = rec->GetGRPSettings();
if (grp.continuousMaxTimeBin == 0) {
if (grp.grpContinuousMaxTimeBin == 0) {
printf("Cannot override max time bin for non-continuous data!\n");
} else {
grp.continuousMaxTimeBin = chainTracking->mIOPtrs.tpcZS ? GPUReconstructionConvert::GetMaxTimeBin(*chainTracking->mIOPtrs.tpcZS) : chainTracking->mIOPtrs.tpcPackedDigits ? GPUReconstructionConvert::GetMaxTimeBin(*chainTracking->mIOPtrs.tpcPackedDigits) : GPUReconstructionConvert::GetMaxTimeBin(*chainTracking->mIOPtrs.clustersNative);
printf("Max time bin set to %d\n", (int32_t)grp.continuousMaxTimeBin);
grp.grpContinuousMaxTimeBin = chainTracking->mIOPtrs.tpcZS ? GPUReconstructionConvert::GetMaxTimeBin(*chainTracking->mIOPtrs.tpcZS) : chainTracking->mIOPtrs.tpcPackedDigits ? GPUReconstructionConvert::GetMaxTimeBin(*chainTracking->mIOPtrs.tpcPackedDigits) : GPUReconstructionConvert::GetMaxTimeBin(*chainTracking->mIOPtrs.clustersNative);
printf("Max time bin set to %d\n", grp.grpContinuousMaxTimeBin);
rec->UpdateSettings(&grp);
if (recAsync) {
recAsync->UpdateSettings(&grp);
Expand Down
8 changes: 4 additions & 4 deletions GPU/Workflow/src/GPUWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ void GPURecoWorkflowSpec::init(InitContext& ic)
}

mAutoSolenoidBz = mConfParam->solenoidBzNominalGPU == -1e6f;
mAutoContinuousMaxTimeBin = mConfig->configGRP.continuousMaxTimeBin == -1;
mAutoContinuousMaxTimeBin = mConfig->configGRP.grpContinuousMaxTimeBin < 0;
if (mAutoContinuousMaxTimeBin) {
mConfig->configGRP.continuousMaxTimeBin = ((mConfParam->overrideNHbfPerTF ? mConfParam->overrideNHbfPerTF : 256) * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
mConfig->configGRP.grpContinuousMaxTimeBin = ((mConfParam->overrideNHbfPerTF ? mConfParam->overrideNHbfPerTF : 256) * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
}
if (mConfig->configProcessing.deviceNum == -2) {
int32_t myId = ic.services().get<const o2::framework::DeviceSpec>().inputTimesliceId;
Expand Down Expand Up @@ -1013,9 +1013,9 @@ void GPURecoWorkflowSpec::doCalibUpdates(o2::framework::ProcessingContext& pc, c
LOG(info) << "Updating solenoid field " << newCalibValues.solenoidField;
}
if (mAutoContinuousMaxTimeBin) {
mConfig->configGRP.continuousMaxTimeBin = (mTFSettings->nHBFPerTF * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
mConfig->configGRP.grpContinuousMaxTimeBin = (mTFSettings->nHBFPerTF * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
newCalibValues.newContinuousMaxTimeBin = true;
newCalibValues.continuousMaxTimeBin = mConfig->configGRP.continuousMaxTimeBin;
newCalibValues.continuousMaxTimeBin = mConfig->configGRP.grpContinuousMaxTimeBin;
LOG(info) << "Updating max time bin " << newCalibValues.continuousMaxTimeBin << " (" << mTFSettings->nHBFPerTF << " orbits)";
}

Expand Down
6 changes: 3 additions & 3 deletions GPU/Workflow/src/O2GPUDPLDisplay.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void O2GPUDPLDisplaySpec::init(InitContext& ic)
mTFSettings->hasSimStartOrbit = 1;
auto& hbfu = o2::raw::HBFUtils::Instance();
mTFSettings->simStartOrbit = hbfu.getFirstIRofTF(o2::InteractionRecord(0, hbfu.orbitFirstSampled)).orbit;
mAutoContinuousMaxTimeBin = mConfig->configGRP.continuousMaxTimeBin == -1;
mAutoContinuousMaxTimeBin = mConfig->configGRP.grpContinuousMaxTimeBin < -1;

mDisplay.reset(new GPUO2InterfaceDisplay(mConfig.get()));
}
Expand All @@ -108,14 +108,14 @@ void O2GPUDPLDisplaySpec::run(ProcessingContext& pc)
mTFSettings->tfStartOrbit = pc.services().get<o2::framework::TimingInfo>().firstTForbit;
mTFSettings->hasTfStartOrbit = 1;
mTFSettings->hasNHBFPerTF = 1;
mTFSettings->nHBFPerTF = GRPGeomHelper::instance().getGRPECS()->getNHBFPerTF();
mTFSettings->nHBFPerTF = mConfParam->overrideNHbfPerTF ? mConfParam->overrideNHbfPerTF : GRPGeomHelper::instance().getGRPECS()->getNHBFPerTF();
mTFSettings->hasRunStartOrbit = 0;

if (mGRPGeomUpdated) {
mGRPGeomUpdated = false;
mConfig->configGRP.solenoidBzNominalGPU = GPUO2InterfaceUtils::getNominalGPUBz(*GRPGeomHelper::instance().getGRPMagField());
if (mAutoContinuousMaxTimeBin) {
mConfig->configGRP.continuousMaxTimeBin = (mTFSettings->nHBFPerTF * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
mConfig->configGRP.grpContinuousMaxTimeBin = (mTFSettings->nHBFPerTF * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN;
}
mDisplay->UpdateGRP(&mConfig->configGRP);
if (mGeometryCreated == 0) {
Expand Down

0 comments on commit ac19d82

Please sign in to comment.