framework technologies and progress huang xingtao zou jiaheng li weidong zhang xueyao 2013.07.05
TRANSCRIPT
Framework Technologies and Progress
Huang Xingtao Zou jiaheng Li weidong Zhang xueyao
2013.07.05
Offline Tutorial II (X.T. Huang , SDU)
2
What’s a Framework?
Framework Definition– A skeleton of an application into which developers plug in their
code and provides most of the common functionalities.– Provide and define standard interfaces between components.
Framework Benefits – Better specifications of what needs to be done– Better understanding of the system.– Low coupling between concurrent developments– Smooth integration and organization of the development. – Robustness, resilient to change (change-tolerant).– Fostering code re-use
Offline Tutorial II (X.T. Huang , SDU)
3
Software Organization
Foundation Libraries
Framework
Trig
ger
Reco
nstr
uctio
n
Sim
ulati
on
Anal
ysis
Applications using framework components (Algorithms, Services, etc)
Provides basic services, common interfaces, data exchange and persistency mechanisms, interactivity
Basic libraries (such as Geant4, Root, Python, Openscientist, CLHEP, etc)
几个离线软件系统的构成
5
Gaudi Object Diagram
Converter
Algorithm
Event DataService
PersistencyService
DataFiles
AlgorithmAlgorithm
Transient Event Store
Detec. DataService
PersistencyService
DataFiles
Transient Detector Store
MessageService
JobOptionsService
Particle Prop.Service
OtherServices
HistogramService
PersistencyService
DataFiles
TransientHistogram Store
ApplicationManager
ConverterConverter
Offline Tutorial II (X.T. Huang , SDU)
6
Advantages of Gaudi
Clear separation between data and algorithms Clear separation between persistent data and transient
data Data Store-centered architectural style Encapsulated User code localized in few specific places
– Algorithms and Converters Run-time loading of components (dynamic libraries).
– addition of new components requires minimal recompilation All components with well defined interfaces and as
generic as possible
Beijing, CHINA for Review 7
Disadvantages of Gaudi
Multi-layers structure Too many third-party software or tools Relatively Slower Not suitable for non-accelerator experiments ,especially
events with time or space correlation
Light-weighted Framework (LAF) was designed and used for analysis.
13-1-6
New Experiments and New Framework
JUNO and LHAASO Experiment under R&D in China– JUNO performs very high precision measurement– LHAASO is very large scale experiment– Both are non-accelerator experiments– NuWa users’ experience shows that Gaudi is not suitable– Met the “similar” situation with BESIII in 2001 ,but huge
differenceFortran , C , C++belle (BASF), LHCb(Gaudi) , Babar or new one Finally Gaudi was chosen!!
– Lots of work has been done!
General Design Principle
JUNO
事例产生器
探测器模拟
数据刻度
事例重建
物理分析
AIDA CLHEP GCCXML ROOT Geant4 ……
SNiPER
LODESTAR
事例产生器
探测器模拟
数据刻度
事例重建
物理分析
…
SNiPER : Software for Non-collider Physics ExpeRimentsLODESTAR : LHAASO Offline Data Processing Software Framework
Beijing, CHINA for Review 10
Requirements for SNiPER
Learning from Gaudi– Data store centered architectural style
algorithms as data producers and consumers– Separation between data and algorithms
decease coupling and better for team development
– User code encapsulated in few specific places Algorithm, Service, DataObject
– Modularity Structure Run-time loading of components (dynamic libraries). Flexible execution control of algorithms
– Object I/O Capability to read/write C++ object. Independent of specific data models
– Programmable script parser for the control (Lin Tao , Xia xin)– Separation between “transient” and “persistent” representations of data???
based on the difference in different processing steps.
New requirements– Interface to distributed computing ( Zou Jiaheng )
Parallel processing Data file access over WAN (i.e. GRID)
13-1-6
11
Kernel Structure of SNiPER
svcs
algsSniperMgr
OptionParser
AlgMgr
SvcMgr
IAlgorithm
IService
initialize()run()finilize()
setOption(name, value)
initialize()execute()finilize()
initialize()finilize()
initialize()execute()finilize()
initialize()finilize()
OptionParser/PropertyMgr: run time parameters configurationAlgorithms: data calculationsServices: other useful functionalities
PropertyMgr
12
Algorithm and Service Management
Concrete Algorithm: 1. 模块化,可动态加载2. 仅通过接口与框架通信3. 每个特定类型算法可有一个或多个实例,通过
name 进行区分4. 可按配置顺序生成算法序列,支持嵌套、分支
等控制流程
IAlgorithm
ConcreteAlg
name()
IService
ConcreteSvc
name()
Concrete Service: • 具有与算法 1-3 相同特性• 可通过 name 在 SNiPER 内任意位置获取所需的
service 实例
13
Algorithm and Data
DATAin
MEMORY
Algorithm 1
Algorithm 2
Algorithm 3
DISK
DISK
InputService
OutputService
数据与算法分离
• 便于不同算法间分享数据• 算法专注于数据的计算处理,与 I/O 解耦
14
DataModel
DataObj
HeaderReadout
RawReadout McReadout RecReadout
setHeader()header
readout_map
header context
Header: 事例整体信息, id 、 detector 、 time 等Readout: 具体分支信息Header 中的 readout_map 对普通用户隐藏
DataBuffer DataBuffer
current()bigin()end()size()seek(int i)
head1 head2 head3 head4 head5 head6 head7 head8
rec1 rec2 rec5 rec6 rec8
MC2 MC5 MC7 MC8
只对头、尾进行增删操作,内部使用 deque
用户经由 header 间接访问,且有随机性( lazy load ),使用 list
15
考虑到 GenEvent 等类型与 Header 可能有一对多的对应关系,为降低内存数据维护难度, buffer 中可保存“智能指针”
• 对普通用户仅提供只读接口• 仅做为数据容器,与 I/O 解耦
16
Event Buffer
0
1
2
3
4
5
6
7
EvtNum: 0 1 2 3 4 5 6 7Exe Num
Current event
Event buffer
Other events
专为对“时间关联事例”分析进行的设计
17
运行时序示意图
每次事例循环开始时同步内存与磁盘数据( I/O )算法通过 BufferMgr 接口完成内存数据的存取
put
getexecute
read
writesyncData
SniperMgr BufferMgr DataWriter
DataReader
Algorithms
loop
Short Summary
Brief introduction to Framework Decide to design New Non-Gaudi based Framework One working version of SNiPER exists
– several main functionalities have been implmented SniperMgr Algorithm interface and management Service interface and management configuration interface one example is provided
– some need to be further optimized and discussed today In-memory data management Event data model persistency mechanism parallel processing python configuration Interface to Data base, Geometry and so on
Gaudi heavily relies on ROOT
FairRoot : developed by GSI-IT
22.05.12 Florian Uhlig CHEP 2012, New York
20
Start testing the VMC concept for CBM
First Release of CbmRoot
MPD (NICA) start also using FairRoot
ASYEOS joined(ASYEOSRoot)
GEM-TPC separated from PANDA branch (FOPIRoot)
Panda decided to join->FairRoot: same Base package for different experiments
R3B joined EIC (Electron Ion Collider BNL)EICRoot
2011201020062004
• Fully based on the ROOT
FairRoot for • Simulation , reconstruction , Data analysis
Planned Start in 2016 !
typedef std::map< std::string, TObject * > StoreObjMap typedef std::map< std::string, TClonesArray * > StoreArrayMap
Shuei YAMADA @ MEG review meeting, 2 July 2004
32
ROMERoot based Object oriented Midas Extension
• Tool for Event based Data Analysis
• Fully Object Oriented
• Root based
• Full connection to the Midas Environment
• Online and Offline
• Based on Tasks, Containers and Folders for a good Data and Program Structure
• Experiment independent Base Classes
• Experiment dependent Classes are generated out of simple XML-Files
• The Users write only experiment specific code (physics)
• Administrative code is implemented in the generated code
• Self Documenting Code
• Self Linking Project
Shuei YAMADA @ MEG review meeting, 2 July 2004
33
ROME Objects
Folders
•Objects, where data is stored in
•Stores the data of one detector (or sub detector) component
•Hierarchically arranged
•Data inside of Folders is structured
Tasks
•Tasks are objects, which provides actions
•They make calculations
•Store and read data in folders
•Fill trees and histograms
•Hierarchically arranged
•Task also own histograms
Trees
•Data Objects : only written, never read
•Used to write data on files
Histograms
•Graphical Data Objects : only written
•Belong to one Task
Steering Parameters
•Task steering
•Framework steering
Shuei YAMADA @ MEG review meeting, 2 July 2004
34
Interconnections
Folders
TasksTasksTasksFill
Read
TreesTreesTreesRead
Flag
HistogramsHistogramsHistograms
HistogramsHistogramsHistograms
HistogramsHistogramsHistograms
Fill
Fill
Disk (Output)Write (ROOT)
Disk (Input)
Read (any Format)
Facts show us
ROOT becomes more and more popular and powerful From generator to analysis, most processes data can be
saved into ROOT It is better to have as same as possible event data
definition between transient and Persistency– easy implementation of I/O
Design of Event Data Model based on ROOT– Data Object inherits from Tobject
Navigation functions replyon Header Objects.
Pros : straightforwardcons: no general enough
Dyb uses RegistrationSequncewhich is separately from headers
Event Data Model based on ROOT
Tags for fast review
Purpose of tag is to support fast review events and decide whether or not to further read more data into Store.
Layout of Store
std::deque<Tobject* > frontStore std::map< std::string, std::list<Tobject* > > backStore
Front Store Back Store
Object Access and I/O
Data Store is used to manage the layout of TObjects– support access to Data Store with path or type
Data objects could be written to and read from Data Store with the streamers of these classes which will be automatically generated and included in the dictionary library.
Manipulation of this Data Store:– Filling– Reading– Trimming– WritingNeed further design and implement
Discussion
Further collect requirements of framework– in form of Use Case Study
Discuss and finalize the Data Model Design– data structure – data navigation – data storage – implementation
similar with GOD or coded
Optimize design of In-Memory Management– Buffer mechanism– Adopting ROOT– I/O
Other functionalities discussion– Job configuration ( python )– User interfaces (Algorithm, Services, Tools……)– structure of the whole offline softer system– ……
More inputsMore thinkingMore discussion
Thanks a lot!
Art
art is a generic C++-based modular analysis framework, for use from generator-level or DAQ event building through simulation, production and user analysis. – g-2 , Mu2e , NOνA , LArSoft(μBooNE,ArgoNeuT, LBNE)
art grew out of and forked from CMS in 2010 Developer has been involved with frameworks:
– DØ, BTeV, CMS and MiniBooNE. art plans to support parallel processing of independent
events as well as to permit parallel processing within events
Art architecture