Skip to content

Commit e924b16

Browse files
committed
Changes to workflow generator
* Split TPC clusterization into 2 stages so that we can fit into 16GB for ~100PbPb. * Introduce additional cluster merging step to prepare one file for TPC reco * Add ROOT macro helper for the merge step (to be generalized later) * Adjust some memory/cpu resource estimates (based on ~100PbPb dataframes) * Don't use --rate 1 for TOF reco workflow. Now terminates much faster.
1 parent 0c09bc0 commit e924b16

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,26 @@ def createRestDigiTask(name, det='ALLSMALLER'):
390390
# -----------
391391

392392
# TODO: check value for MaxTimeBin; A large value had to be set tmp in order to avoid crashes based on "exceeding timeframe limit"
393-
TPCRECOtask1=createTask(name='tpccluster_'+str(tf), needs=[TPCDigitask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='3', mem='16000')
394-
TPCRECOtask1['cmd'] = 'o2-tpc-chunkeddigit-merger --rate 1 --tpc-lanes ' + str(NWORKERS) + ' --session ' + str(taskcounter)
395-
TPCRECOtask1['cmd'] += ' | o2-tpc-reco-workflow ' + getDPL_global_options(bigshm=True, nosmallrate=True) + ' --input-type digitizer --output-type clusters,send-clusters-per-sector --configKeyValues "GPU_global.continuousMaxTimeBin=100000;GPU_proc.ompThreads='+str(NWORKERS)+'"'
396-
workflow['stages'].append(TPCRECOtask1)
397393

398-
TPCRECOtask=createTask(name='tpcreco_'+str(tf), needs=[TPCRECOtask1['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='3', mem='16000')
394+
# We treat TPC clusterization in multiple (sector) steps in order to stay within the memory limit
395+
TPCCLUStask1=createTask(name='tpcclusterpart1_'+str(tf), needs=[TPCDigitask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='8', mem='16000')
396+
TPCCLUStask1['cmd'] = 'o2-tpc-chunkeddigit-merger --tpc-sectors 0-17 --rate 1 --tpc-lanes ' + str(NWORKERS) + ' --session ' + str(taskcounter)
397+
TPCCLUStask1['cmd'] += ' | o2-tpc-reco-workflow ' + getDPL_global_options(bigshm=True, nosmallrate=True) + ' --input-type digitizer --output-type clusters,send-clusters-per-sector --tpc-sectors 0-17 --configKeyValues "GPU_global.continuousMaxTimeBin=100000;GPU_proc.ompThreads='+str(NWORKERS)+'"'
398+
TPCCLUStask1['cmd'] += ' ; mv tpc-native-clusters.root tpc-native-clusters-part1.root'
399+
workflow['stages'].append(TPCCLUStask1)
400+
401+
TPCCLUStask2=createTask(name='tpcclusterpart2_'+str(tf), needs=[TPCDigitask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='8', mem='16000')
402+
TPCCLUStask2['cmd'] = 'o2-tpc-chunkeddigit-merger --tpc-sectors 18-35 --rate 1 --tpc-lanes ' + str(NWORKERS) + ' --session ' + str(taskcounter)
403+
TPCCLUStask2['cmd'] += ' | o2-tpc-reco-workflow ' + getDPL_global_options(bigshm=True, nosmallrate=True) + ' --input-type digitizer --output-type clusters,send-clusters-per-sector --tpc-sectors 18-35 --configKeyValues "GPU_global.continuousMaxTimeBin=100000;GPU_proc.ompThreads='+str(NWORKERS)+'"'
404+
TPCCLUStask2['cmd'] += ' ; mv tpc-native-clusters.root tpc-native-clusters-part2.root'
405+
workflow['stages'].append(TPCCLUStask2)
406+
407+
# additional file merge step (TODO: generalize to arbitrary number of files)
408+
TPCCLUSMERGEtask=createTask(name='tpcclustermerge_'+str(tf), needs=[TPCCLUStask1['name'], TPCCLUStask2['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='1')
409+
TPCCLUSMERGEtask['cmd']='root -q -b -l "$O2DPG_ROOT/MC/utils/merge_TTrees.C(\\"tpc-native-clusters-part1.root\\", \\"tpc-native-clusters-part2.root\\", \\"tpcrec\\", \\"tpc-native-clusters.root\\")"'
410+
workflow['stages'].append(TPCCLUSMERGEtask)
411+
412+
TPCRECOtask=createTask(name='tpcreco_'+str(tf), needs=[TPCCLUSMERGEtask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='3', mem='16000')
399413
TPCRECOtask['cmd'] = 'o2-tpc-reco-workflow ' + getDPL_global_options(bigshm=True, nosmallrate=True) + ' --input-type clusters --output-type tracks,send-clusters-per-sector --configKeyValues "GPU_global.continuousMaxTimeBin=100000;GPU_proc.ompThreads='+str(NWORKERS)+'"'
400414
workflow['stages'].append(TPCRECOtask)
401415

@@ -421,14 +435,14 @@ def createRestDigiTask(name, det='ALLSMALLER'):
421435
workflow['stages'].append(TRDTRACKINGtask)
422436

423437
TOFRECOtask = createTask(name='tofmatch_'+str(tf), needs=[ITSTPCMATCHtask['name'], det_to_digitask["TOF"]['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"])
424-
TOFRECOtask['cmd'] = 'o2-tof-reco-workflow ' + getDPL_global_options()
438+
TOFRECOtask['cmd'] = 'o2-tof-reco-workflow ' + getDPL_global_options(nosmallrate=True)
425439
workflow['stages'].append(TOFRECOtask)
426440

427441
TOFTPCMATCHERtask = createTask(name='toftpcmatch_'+str(tf), needs=[TOFRECOtask['name'], TPCRECOtask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"])
428442
TOFTPCMATCHERtask['cmd'] = 'o2-tof-matcher-tpc ' + getDPL_global_options()
429443
workflow['stages'].append(TOFTPCMATCHERtask)
430444

431-
PVFINDERtask = createTask(name='pvfinder_'+str(tf), needs=[ITSTPCMATCHtask['name'], FT0RECOtask['name'], TOFTPCMATCHERtask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='4')
445+
PVFINDERtask = createTask(name='pvfinder_'+str(tf), needs=[ITSTPCMATCHtask['name'], FT0RECOtask['name'], TOFTPCMATCHERtask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='8', mem='4000')
432446
PVFINDERtask['cmd'] = 'o2-primary-vertexing-workflow ' + getDPL_global_options(nosmallrate=True)
433447
workflow['stages'].append(PVFINDERtask)
434448

@@ -439,7 +453,7 @@ def createRestDigiTask(name, det='ALLSMALLER'):
439453
if usebkgcache:
440454
aodneeds += [ BKG_KINEDOWNLOADER_TASK['name'] ]
441455

442-
AODtask = createTask(name='aod_'+str(tf), needs=aodneeds, tf=tf, cwd=timeframeworkdir, lab=["AOD"], mem='5000', cpu='1')
456+
AODtask = createTask(name='aod_'+str(tf), needs=aodneeds, tf=tf, cwd=timeframeworkdir, lab=["AOD"], mem='4000', cpu='1')
443457
AODtask['cmd'] = ('','ln -nfs ../bkg_Kine.root . ;')[doembedding]
444458
AODtask['cmd'] += 'o2-aod-producer-workflow --reco-mctracks-only 1 --aod-writer-keep dangling --aod-writer-resfile \"AO2D\" --aod-writer-resmode UPDATE --aod-timeframe-id ' + str(tf) + ' ' + getDPL_global_options(bigshm=True)
445459
workflow['stages'].append(AODtask)

MC/utils/merge_TTrees.C

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// A helper to "vertically" merge the set of (distinct) branches of 2 trees
2+
// into a single common (non-friended) tree in a new file.
3+
//
4+
// This is using RDataFrame mechanics as suggested by the ROOT team.
5+
// TODO: generalize to abirtrary list of files.
6+
void merge_TTrees(std::string f1, std::string f2, std::string treename, std::string outname) {
7+
TFile file(f1.c_str(), "OPEN");
8+
auto t1=(TTree*)file.Get(treename.c_str());
9+
t1->AddFriend(treename.c_str(), f2.c_str());
10+
ROOT::RDataFrame df(*t1);
11+
df.Snapshot(treename.c_str(), outname.c_str(), ".*");
12+
}

0 commit comments

Comments
 (0)