Skip to content

Commit c97ed0e

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 5182bea commit c97ed0e

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')
@@ -480,6 +482,12 @@ def extractVertexArgs(configKeyValuesStr, finalDiamondDict):
480482
print('o2dpg_sim_workflow: Error! generator name not provided')
481483
exit(1)
482484

485+
if args.tpc_mt_digitizer and args.no_tpc_digitchunking:
486+
print('o2dpg_sim_workflow: Error! --tpc-mt-digitizer needs TPC digit chunking')
487+
exit(1)
488+
if args.tpc_mt_digitizer and args.tpc_sector_seeding:
489+
print('o2dpg_sim_workflow: --tpc-sector-seeding is implied by --tpc-mt-digitizer')
490+
483491
INIFILE=''
484492
if args.ini!= '':
485493
INIFILE=' --configFile ' + args.ini
@@ -1172,12 +1180,17 @@ def putConfigValues(listOfMainKeys=[], localCF = {}, globalTFConfig = True):
11721180
TPCDigitask['cmd'] += '${O2_ROOT}/bin/o2-ccdb-downloadccdbfile --host http://alice-ccdb.cern.ch -p TPC/Config/RunInfoV2 --timestamp ' \
11731181
+ str(args.timestamp) + ' --created-not-after ' + str(args.condition_not_after) + ' -d ${ALICEO2_CCDB_LOCALCACHE} ; '
11741182
TPCDigitask['cmd'] += '${O2_ROOT}/bin/o2-sim-digitizer-workflow ' + getDPL_global_options(bigshm=True) + ' -n ' + str(args.ns) + simsoption \
1175-
+ ' --onlyDet TPC --TPCuseCCDB --interactionRate ' + str(INTRATE) + ' --tpc-lanes ' + str(NWORKERS_TF) \
1183+
+ ' --onlyDet TPC --TPCuseCCDB --interactionRate ' + str(INTRATE) \
11761184
+ ' --incontext ' + str(CONTEXTFILE) + ' --disable-write-ini --early-forward-policy always --forceSelectedDets ' \
11771185
+ ' --tpc-distortion-type ' + str(tpcDistortionType) \
1178-
+ ' --n-threads-distortions 1 ' \
11791186
+ putConfigValues(["TPCGasParam","TPCGEMParam","TPCEleParam","TPCITCorr","TPCDetParam"],
11801187
localCF=tpcLocalCF)
1188+
if args.tpc_mt_digitizer:
1189+
# one device with NWORKERS_TF threads; it always seeds per sector
1190+
TPCDigitask['cmd'] += ' --tpc-digi-threads ' + str(NWORKERS_TF) + ' --n-threads-distortions ' + str(NWORKERS_TF)
1191+
else:
1192+
TPCDigitask['cmd'] += ' --tpc-lanes ' + str(NWORKERS_TF) + ' --n-threads-distortions 1'
1193+
TPCDigitask['cmd'] += ('',' --tpc-sector-seeding')[args.tpc_sector_seeding]
11811194
TPCDigitask['cmd'] += (' --tpc-chunked-writer','')[args.no_tpc_digitchunking]
11821195
TPCDigitask['cmd'] += ('',' --disable-mc')[args.no_mc_labels]
11831196
# 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)