Skip to content

Commit a809af1

Browse files
sawenzelclaude
andcommitted
Add opt-in switches for the multithreaded TPC digitizer
This adds two options to o2dpg_sim_workflow.py that change how TPC is digitized. Both are off by default. - --tpc-mt-digitizer runs TPC digitization in one device with NWORKERS_TF threads instead of NWORKERS_TF lanes. - It also computes the distortions with NWORKERS_TF threads, and it needs TPC digit chunking. - --tpc-sector-seeding seeds the lane digitizer per sector, so that the digits do not depend on the number of lanes. - The metrics tool reads the worker count of the tpcdigi task from --tpc-digi-threads too. - Both options need an O2 version with the sector seeding and the multithreaded TPC digitizer. https://its.cern.ch/jira/browse/O2-7309 AliceO2Group/AliceO2#16085 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent eff59ef commit a809af1

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎MC/bin/o2dpg_sim_workflow.py‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@
163163
parser.add_argument('--tpc-distortion-type', default=0, type=int, help='Simulate distortions in the TPC (0=no distortions, 1=distortions without scaling, 2=distortions with CTP scaling)')
164164
parser.add_argument('--tpc-corrmap-lumi-mode', default=2, type=int, help='TPC corrections mode (0=linear, 1=derivative, 2=derivative for special MC maps')
165165
parser.add_argument('--ctp-scaler', default=0, type=float, help='CTP raw scaler value used for distortion simulation')
166+
parser.add_argument('--tpc-mt-digitizer', action='store_true', help='Digitize TPC in one multithreaded device instead of one process per lane (needs TPC digit chunking)')
167+
parser.add_argument('--tpc-sector-seeding', action='store_true', help='Seed the TPC digitizer per sector so that the digits do not depend on the number of lanes')
166168
# Global Forward reconstruction configuration
167169
parser.add_argument('--fwdmatching-assessment-full', action='store_true', help='enables complete assessment of global forward reco')
168170
parser.add_argument('--fwdmatching-4-param', action='store_true', help='excludes q/pt from matching parameters')
@@ -477,6 +479,12 @@ def extractVertexArgs(configKeyValuesStr, finalDiamondDict):
477479
print('o2dpg_sim_workflow: Error! generator name not provided')
478480
exit(1)
479481

482+
if args.tpc_mt_digitizer and args.no_tpc_digitchunking:
483+
print('o2dpg_sim_workflow: Error! --tpc-mt-digitizer needs TPC digit chunking')
484+
exit(1)
485+
if args.tpc_mt_digitizer and args.tpc_sector_seeding:
486+
print('o2dpg_sim_workflow: --tpc-sector-seeding is implied by --tpc-mt-digitizer')
487+
480488
INIFILE=''
481489
if args.ini!= '':
482490
INIFILE=' --configFile ' + args.ini
@@ -1166,12 +1174,17 @@ def putConfigValues(listOfMainKeys=[], localCF = {}, globalTFConfig = True):
11661174
TPCDigitask['cmd'] += '${O2_ROOT}/bin/o2-ccdb-downloadccdbfile --host http://alice-ccdb.cern.ch -p TPC/Config/RunInfoV2 --timestamp ' \
11671175
+ str(args.timestamp) + ' --created-not-after ' + str(args.condition_not_after) + ' -d ${ALICEO2_CCDB_LOCALCACHE} ; '
11681176
TPCDigitask['cmd'] += '${O2_ROOT}/bin/o2-sim-digitizer-workflow ' + getDPL_global_options(bigshm=True) + ' -n ' + str(args.ns) + simsoption \
1169-
+ ' --onlyDet TPC --TPCuseCCDB --interactionRate ' + str(INTRATE) + ' --tpc-lanes ' + str(NWORKERS_TF) \
1177+
+ ' --onlyDet TPC --TPCuseCCDB --interactionRate ' + str(INTRATE) \
11701178
+ ' --incontext ' + str(CONTEXTFILE) + ' --disable-write-ini --early-forward-policy always --forceSelectedDets ' \
11711179
+ ' --tpc-distortion-type ' + str(tpcDistortionType) \
1172-
+ ' --n-threads-distortions 1 ' \
11731180
+ putConfigValues(["TPCGasParam","TPCGEMParam","TPCEleParam","TPCITCorr","TPCDetParam"],
11741181
localCF=tpcLocalCF)
1182+
if args.tpc_mt_digitizer:
1183+
# one device with NWORKERS_TF threads; it always seeds per sector
1184+
TPCDigitask['cmd'] += ' --tpc-digi-threads ' + str(NWORKERS_TF) + ' --n-threads-distortions ' + str(NWORKERS_TF)
1185+
else:
1186+
TPCDigitask['cmd'] += ' --tpc-lanes ' + str(NWORKERS_TF) + ' --n-threads-distortions 1'
1187+
TPCDigitask['cmd'] += ('',' --tpc-sector-seeding')[args.tpc_sector_seeding]
11751188
TPCDigitask['cmd'] += (' --tpc-chunked-writer','')[args.no_tpc_digitchunking]
11761189
TPCDigitask['cmd'] += ('',' --disable-mc')[args.no_mc_labels]
11771190
# we add any other extra command line options (power user customization) with an environment variable

‎MC/utils/o2dpg_sim_metrics.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,7 @@ def incorporate_log_times(json_path, search_path):
12351235
re.compile(r'\$\{O2DPG_DYNAMIC_NWORKER_OVERWRITE:-(\d+)\}'), # ${VAR:-N} — default value
12361236
re.compile(r'(?<![A-Za-z_])-j\s+(\d+)'), # -j N
12371237
re.compile(r'--tpc-lanes\s+(\d+)'), # --tpc-lanes N
1238+
re.compile(r'--tpc-digi-threads\s+(\d+)'), # --tpc-digi-threads N
12381239
]
12391240

12401241

0 commit comments

Comments
 (0)