ALICE experience with ROOT IO Andrei Gheata ROOT

  • Slides: 15
Download presentation
ALICE experience with ROOT I/O Andrei Gheata ROOT I/O Worksop and Future Plans 25

ALICE experience with ROOT I/O Andrei Gheata ROOT I/O Worksop and Future Plans 25 June 2014

A. Gheata, ROOT I/O Workshop Outline The I/O issues in ALICE Analysis and ROOT

A. Gheata, ROOT I/O Workshop Outline The I/O issues in ALICE Analysis and ROOT I/O Tree caching and prefetching Flattening the AOD structure

A. Gheata, ROOT I/O Workshop I/O issues in ALICE Ali. Root framework using ROOT

A. Gheata, ROOT I/O Workshop I/O issues in ALICE Ali. Root framework using ROOT as foundation Entire I/O based on ROOT: raw data, simulation, reconstruction, analysis Complex detector with 18 subsystems Large event size, dominated by TPC contribution Up to 5 -8 MB Pb-Pb uncompressed I/O “contributors” Raw data reconstruction: raw data as input (local disk), reconstructed ESD events as output (local disk) Simulation: no input data, hits&digits + kinematics as output (local disk) Filtering/skimming: ESD as input (LAN/WAN), (nano)AOD as output (local disk) Analysis: all event formats (ESD, (nano)AOD) as input (LAN/WAN), histograms or other intermediate formats as output (local disk)

ALICE data flow DETECTOR ALGORITHMS FILTERING CALIBRATION RECONSTRU CTION RAW ROOTIFY OFFLINE ONLINE SHUTTLE

ALICE data flow DETECTOR ALGORITHMS FILTERING CALIBRATION RECONSTRU CTION RAW ROOTIFY OFFLINE ONLINE SHUTTLE Detector algorithms Ali. ESDs. root AODB (analysis database) Ali. AOD. root results. root RAW. root OCDB Calibration data ANALYSIS QUALITY ASSURANCE ALIEN + FILE CATALOG 4

Event size by collision type Collisio n p-p Pb-Pb p-Pb * Year RAW size

Event size by collision type Collisio n p-p Pb-Pb p-Pb * Year RAW size [k. B/ev] ESD size* [k. B/ev] AOD size* [k. B/ev] 2010 550 62 10. 5 8. 8 6. 0 2011 500 61 6. 7 8. 2 9. 8 2012 1820 113 9. 6 16. 1 11. 8 2010 11380 1710 365 6. 7 4. 7 2011 5490 4070 1800 1. 35 2. 3 2013 612 271 60 2. 6 4. 5 2013 1660 1640 379 1. 0 4. 3 Compressed data with compression factor ~4 -5 RAW/ES ESD/AO D D

A. Gheata, ROOT I/O Workshop Analysis and ROOT I/O Most I/O issues become visible

A. Gheata, ROOT I/O Workshop Analysis and ROOT I/O Most I/O issues become visible in distributed analysis Big input data, not necessarily matching CPU workload Combined LAN/WAN read access Workload management policy enforcing locality as much as possible, WAN/LAN access ratio evolved from ~20 -30% to less than 10% average Several directions to tackle the I/O problem Combine analysis in trains Restrict the number of branches to the minimum needed Filter to more compact formats (nano. AOD’s) Enable ROOT I/O helpers: tree caching & prefetching Flatten the AOD format

A. Gheata, ROOT I/O Workshop Asynchronous prefetching Elvin Selaru, ROOT Users Workshop, Saas-Fee 2013

A. Gheata, ROOT I/O Workshop Asynchronous prefetching Elvin Selaru, ROOT Users Workshop, Saas-Fee 2013

A. Gheata, ROOT I/O Workshop Caching and prefetching in analysis ALICE analysis built on

A. Gheata, ROOT I/O Workshop Caching and prefetching in analysis ALICE analysis built on top of TChain: : Process(TSelector) We can use ROOT built-in functionality to enhance read performance Caching enabled by default in ALICE analysis framework Adjustable cache size Most frequent use case for trains: sequential read, all branches enabled Testing prefetching: WAN read AOD: ~300 MB read from Torino: : SE (RTT ~22 ms) Analysis task reading in all events and emulating CPU per track Plotting “useful” analysis CPU versus real time for the job No caching/prefetching TTree. Cache enabled Prefetching enabled

A. Gheata, ROOT I/O Workshop Prefetching exercise no caching I/O bound CPU bound caching

A. Gheata, ROOT I/O Workshop Prefetching exercise no caching I/O bound CPU bound caching prefetching

A. Gheata, ROOT I/O Workshop Prefetching gain 10 -15% in I/O bound regime, less

A. Gheata, ROOT I/O Workshop Prefetching gain 10 -15% in I/O bound regime, less than 5% if CPU bound

A. Gheata, ROOT I/O Workshop Flattening AOD’s Current AOD event structure: more than 400

A. Gheata, ROOT I/O Workshop Flattening AOD’s Current AOD event structure: more than 400 branches, deep object hierarchy Format highly dependent on Ali. Root types How costly is hierarchy, can we get benefits from flattening the structure Better compression Analysis less dependent on Ali. Root Faster I/O Structure more adapted for vectorization

A. Gheata, ROOT I/O Workshop Flat AOD exercise Use AODtree->Make. Class() to generate a

A. Gheata, ROOT I/O Workshop Flat AOD exercise Use AODtree->Make. Class() to generate a skeleton, then rework Keep all AOD info, but restructure the format Int_t f. Tracks. f. Det. Pid. f. TRDncls -> Int_t *f. Tracks_f. Det. Pid_f. TRDncls; //[ntracks_] More complex cases to support I/O: typedef struct { Double 32_t x[10]; } vec 10 dbl 32; Double 32_t f. Tracks. f. PID[10] -> vec 10 dbl 32 *f. Tracks_f. PID; //[ntracks_] Double 32_t *f. V 0 s. f. Px //[f. Nprongs] -> TArray. F *f. V 0 s. f. Px; //[nv 0 s_] Convert Ali. AODEvent-> Flat. Event Try to keep the full content AND size Write Flat. Event on file Compare compression, file size and read speed

Results Tested on AOD Pb. Pb: Ali. AOD. root *************************************** *Tree : aod. Tree

Results Tested on AOD Pb. Pb: Ali. AOD. root *************************************** *Tree : aod. Tree : Ali. AOD tree *Entries : * : 2327 : Total = * 2761263710 bytes File Size = 660491257 * : Tree compression factor = 4. 18 * ****************************************************************************** *Tree : Ali. AODFlat: Flattened Ali. AODEvent *Entries : 2327 : Total = * : Tree compression factor = 5. 84 : * 2248164303 bytes File Size = 385263726 * * *************************************** Data smaller (no TObject overhead, TRef->int) 30% better compression Reading speed Old: CPU time= 103 s , Real time=120 s New: CPU time= 54 s , Real time= 64 s

Implications User analysis more simple, working mostly with basic types (besides the event) Simplified

Implications User analysis more simple, working mostly with basic types (besides the event) Simplified access to data, highly reducing number of (virtual) calls ROOT-only analysis Backward incompatible, but migration from old to new format possible Sacrificing performance as first step (built-in transient event converter) Much better vectorizable track loops This approach is now taken seriously for Run 2 and Run 3

A. Gheata, ROOT I/O Workshop Some concerns… Few things that I hope will be

A. Gheata, ROOT I/O Workshop Some concerns… Few things that I hope will be covered by the discussions Asynchronous de-serialization of different entries in trees/chains In local processing, this is a serial step overwhelming disk reading Thread safe concurrent containers as replacement for existing ones Including I/O friendly ones C++11 comes at rescue… Re-design of thread safety in handling critical data structures related to I/O Like histograms and trees, avoiding TThread: : Lock