Thomas Jefferson National Accelerator Facility (JLab) 6/16/09Multi-threaded event processing with JANA -- David Lawrence 1 6 GeV electron accelerator user.

Slides:



Advertisements
Similar presentations
The C ++ Language BY Shery khan. The C++ Language Bjarne Stroupstrup, the language’s creator C++ was designed to provide Simula’s facilities for program.
Advertisements

RunJob in CMS Greg Graham Discussion Slides. RunJob in CMS RunJob is an Application Configuration and Job Creation Tool –RunJob uses metadata to abstract.
March 24-28, 2003Computing for High-Energy Physics Configuration Database for BaBar On-line Rainer Bartoldus, Gregory Dubois-Felsmann, Yury Kolomensky,
The June Software Review David Lawrence, JLab Feb. 16, /16/121Preparations for June Software Review David Lawrence.
O. Stézowski IPN Lyon AGATA Week September 2003 Legnaro Data Analysis – Team #3 ROOT as a framework for AGATA.
David Adams ATLAS DIAL Distributed Interactive Analysis of Large datasets David Adams BNL March 25, 2003 CHEP 2003 Data Analysis Environment and Visualization.
Hall-D Software Status May 12, 2009 David Lawrence 5/12/091.
Reconstruction and Analysis on Demand: A Success Story Christopher D. Jones Cornell University, USA.
Test results Test definition (1) Istituto Nazionale di Fisica Nucleare, Sezione di Roma; (2) Istituto Nazionale di Fisica Nucleare, Sezione di Bologna.
Infinity-project.org Engineering education for today’s classroom The Infinity Project SM LabVIEW for The Infinity Project.
CLEO’s User Centric Data Access System Christopher D. Jones Cornell University.
Hall D Online Data Acquisition CEBAF provides us with a tremendous scientific opportunity for understanding one of the fundamental forces of nature. 75.
Offline Software Status Jan. 30, 2009 David Lawrence JLab 1.
The JANA Calibrations and Conditions Database API March 23, 2009 David Lawrence JLab 3/23/091JANA Calibration API David Lawrence -- JLab.
The June Software Review David Lawrence, JLab Feb. 16, 2012.
Multi-threaded Event Processing with JANA David Lawrence – Jefferson Lab Nov. 3, /3/08 Multi-threaded Event Processing with JANA - D. Lawrence JLab.
XML I/O in ROOT S. Linev, R. Brun, H.G. Essel CHEP 2004.
I/O bound Jobs Multiple processes accessing the same disc leads to competition for the position of the read head. A multi -threaded process can stream.
May. 11, 2015 David Lawrence JLab Counting House Operations.
Introduction to Hall-D Software February 27, 2009 David Lawrence - JLab.
Online Data Challenges David Lawrence, JLab Feb. 20, /20/14Online Data Challenges.
The GlueX Collaboration Meeting October 4-6, 2012 Jefferson Lab Curtis Meyer.
Flexibility and user-friendliness of grid portals: the PROGRESS approach Michal Kosiedowski
HPS Online Software Discussion Jeremy McCormick, SLAC Status and Plans.
The GlueX Detector 5/29/091CIPANP The GlueX Detector -- David Lawrence (JLab) David Lawrence (JLab) Electron beam accelerator continuous-wave (1497MHz,
Copyright © 2000 OPNET Technologies, Inc. Title – 1 Distributed Trigger System for the LHC experiments Krzysztof Korcyl ATLAS experiment laboratory H.
David N. Brown Lawrence Berkeley National Lab Representing the BaBar Collaboration The BaBar Mini  BaBar  BaBar’s Data Formats  Design of the Mini 
Bookkeeping Tutorial. Bookkeeping & Monitoring Tutorial2 Bookkeeping content  Contains records of all “jobs” and all “files” that are created by production.
Event Data History David Adams BNL Atlas Software Week December 2001.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
NOVA Networked Object-based EnVironment for Analysis P. Nevski, A. Vaniachine, T. Wenaus NOVA is a project to develop distributed object oriented physics.
JANA and Raw Data David Lawrence, JLab Oct. 5, 2012.
Calibration API in JANA David Lawrence, Jlab July 17, 2007.
R.T. Jones, Newport News, May The GlueX Simulation Framework GEANT4 Tutorial Workshop Newport News, May 22-26, 2006 R.T. Jones, UConn Monte Carlo.
DANA uses a factory model to deliver data “just in time”
Electronics play a critical role in modern accelerator physics experiments. Events will be recorded at a rate of 200,000/second. Modular electronics such.
EGEE is a project funded by the European Union under contract IST HEP Use Cases for Grid Computing J. A. Templon Undecided (NIKHEF) Grid Tutorial,
CHEP ‘06 David Lawrence JLab C++ Introspection and Object Persistency through JIL David Lawrence Ph. D. Jefferson Lab, Newport News VA.
CEBAF The Continuous Electron Beam Accelerating Facility(CEBAF) is the central particle accelerator at JLab. CEBAF is capable of producing electron beams.
Hall-D/GlueX Software Status 12 GeV Software Review III February 11[?], 2015 Mark Ito.
Report on CHEP ‘06 David Lawrence. Conference had many participants, but was clearly dominated by LHC LHC has 4 major experiments: ALICE, ATLAS, CMS,
STAR Event data storage and management in STAR V. Perevoztchikov Brookhaven National Laboratory,USA.
H.G.Essel: Go4 - J. Adamczewski, M. Al-Turany, D. Bertini, H.G.Essel, S.Linev CHEP 2003 GSI Online Offline Object Oriented Go4.
David Adams ATLAS Virtual Data in ATLAS David Adams BNL May 5, 2002 US ATLAS core/grid software meeting.
David Adams ATLAS DIAL: Distributed Interactive Analysis of Large datasets David Adams BNL August 5, 2002 BNL OMEGA talk.
HIGUCHI Takeo Department of Physics, Faulty of Science, University of Tokyo Representing dBASF Development Team BELLE/CHEP20001 Distributed BELLE Analysis.
SoLID simulation with GEMC Zhiwen Zhao 2015/03/26.
Bookkeeping Tutorial. 2 Bookkeeping content  Contains records of all “jobs” and all “files” that are produced by production jobs  Job:  In fact technically.
DØ Offline Reconstruction and Analysis Control Framework J.Kowalkowski, H.Greenlee, Q.Li, S.Protopopescu, G.Watts, V.White, J.Yu.
Dual Target Design for CLAS12 Omair Alam and Gerard Gilfoyle Department of Physics, University of Richmond Introduction One of the fundamental goals of.
Claudio Grandi INFN-Bologna CHEP 2000Abstract B 029 Object Oriented simulation of the Level 1 Trigger system of a CMS muon chamber Claudio Grandi INFN-Bologna.
The JANA Reconstruction Framework David Lawrence - JLab May 25, /25/101JANA - Lawrence - CLAS12 Software Workshop.
Online Monitoring System at KLOE Alessandra Doria INFN - Napoli for the KLOE collaboration CHEP 2000 Padova, 7-11 February 2000 NAPOLI.
The GlueX Detector in Hall-D at Jefferson Lab February 16, 2010 David Lawrence, Jefferson Lab (for Curtis A. Meyer, Carnegie Mellon University) July 7,
Oct HPS Collaboration Meeting Jeremy McCormick (SLAC) HPS Web 2.0 OR Web Apps and Databases (Oh My!) Jeremy McCormick (SLAC)
The DCS Databases Peter Chochula. 31/05/2005Peter Chochula 2 Outline PVSS basics (boring topic but useful if one wants to understand the DCS data flow)
GlueX Software Status + Framework Development David Lawrence JLab September 19, /19/081Software Status -- David Lawrence, JLab.
Event Management. EMU Graham Heyes April Overview Background Requirements Solution Status.
October 21, 2010 David Lawrence JLab Oct. 21, 20101RootSpy -- CHEP10, Taipei -- David Lawrence, JLab Parallel Session 53: Software Engineering, Data Stores,
October 19, 2010 David Lawrence JLab Oct. 19, 20101RootSpy -- CHEP10, Taipei -- David Lawrence, JLab Parallel Session 18: Software Engineering, Data Stores,
Barthélémy von Haller CERN PH/AID For the ALICE Collaboration The ALICE data quality monitoring system.
1 GlueX Software Oct. 21, 2004 D. Lawrence, JLab.
David Lawrence JLab May 11, /11/101Reconstruction Framework -- GlueX Collab. meeting -- D. Lawrence.
Fermilab Scientific Computing Division Fermi National Accelerator Laboratory, Batavia, Illinois, USA. Off-the-Shelf Hardware and Software DAQ Performance.
DAQ thoughts about upgrade 11/07/2012
DANA David Lawrence Oct. 21, D. Lawrence, JLab GlueX Software Workshop Oct Outline Requirements Philosophy Overview of Features Open Questions.
Go4 v2.2 Status & Overview CHEP 2003
CMS High Level Trigger Configuration Management
The DANA Analysis Framework David Lawrence Jlab Jan. 19,
CLAS Simulations for the E5 Data Set
Presentation transcript:

Thomas Jefferson National Accelerator Facility (JLab) 6/16/09Multi-threaded event processing with JANA -- David Lawrence 1 6 GeV electron accelerator user facility funded by the US Dept. of Energy Located in Newport News on the east coast of Virginia, USA 1 of the 2 major nuclear physics research labs in the U.S. CHL 2 for basic research into the quark structure of nuclear matter 12 GeV 11 GeV (CD-3 approval came in Sept with data planned in 2014)

The GlueX Experiment in Hall-D 6/16/09Multi-threaded event processing with JANA -- David Lawrence2 real  beam 2 Tesla solenoid magnet 30 cm LH 2 target Forward EM calorimeter and forward TOF wall downstream Cylindrical and planar drift chambers inside magnet Barrel EM calorimeter inside magnet Conventional meson has quantum numbers determined only by constituent quarks Hybrid meson has some quantum properties due to contributions from the “glue” Mapping the spectrum of light-quark, exotic, hybrid mesons Mapping the spectrum of light-quark, exotic, hybrid mesons

Data Rates in 12GeV era Front End DAQ Rate Event Size L1 Trigger Rate Bandwidth to mass Storage GlueX3 GB/s15 kB200 kHz300 MB/s CLAS12100 MB/s20 kB10 kHz100 MB/s ALICE500 GB/s2.5 MB200 kHz200 MB/s ATLAS113 GB/s1.5MB75 kHz300 MB/s CMS200 GB/s1 MB100kHz100 MB/s LHCb40 GB/s40 kB1 MHz100 MB/s STAR8 GB/s80 MB100 Hz30 MB/s PHENIX900 MB/s~60 kB~ 15 kHz450 MB/s 6/16/09Multi-threaded event processing with JANA -- David Lawrence3 LHC JLab BNL * CHEP2007 talk Sylvain Chapelin private comm. * NIM A499 Mar ppg ** CHEP2006 talk MartinL. Purschke **

4/27 Categories of Developers A: Framework B: Reconstruction C: End users (Analysis) 6/16/09Multi-threaded event processing with JANA -- David Lawrence

5/27 What is the Job of the Reconstruction Framework? Allow users to implement code in a consistent way Provide access to calibrations, run conditions and geometry databases Modular enough to allow simple programs (calibration) Extensible enough to allow complex programs (full reconstruction) 6/16/09Multi-threaded event processing with JANA -- David Lawrence motherhood statements

CPU development in the coming years 6/16/09Multi-threaded event processing with JANA -- David Lawrence6 From “Platform 2015: Intel Platform Evolution for the Next Decade” expect more than 100 cores in a box by 2014! CPU development has shifted from increased clock speed to multiple cores Dual quad core CPUs are common today (8cores + 8hyperthreads) Some type of parallelization must be done to use all of the power in a next generation CPU

The JANA Factory Model 6/16/09Multi-threaded event processing with JANA -- David Lawrence7 Algorithms are represented as “factory” classes Only const pointers are passed out of the factory (ownership stays with the factory) Passing out only const pointers guarantees that only the factory may modify the objects Subsequent requests get the same const pointers vector tracks; loop->Get(tracks); Templated Get() method helps ensure type safety Data-on-demand structure allows dynamic determination of which algorithms are activated for a given event

Threads in JANA 6/16/09Multi-threaded event processing with JANA -- David Lawrence8 Each thread in JANA is composed of its own event processing loop and a complete set of factories Reconstruction of a given event is done entirely inside of a single thread No mutex locking is required by authors of reconstruction code Threads work asynchronously to maximize rates at the expense of not maintaining the event order on output raw data read in reconstructed values written out (e.g. ROOT tree)

The GlueX Reconstruction Tree (factory call graph created using janadot plugin) 6/16/09Multi-threaded event processing with JANA -- David Lawrence9 Number of calls and amount of time spent satisfying each is reported Objects at bottom of graph are (mostly) supplied by event source arrows indicate calling sequence data flow is in opposite direction

Multi-threading when CPU limited 6/16/09Multi-threaded event processing with JANA -- David Lawrence10 CPU intensive jobs are the ideal application for multi-threading Blue circles are reconstruction of data from a Monte Carlo simulation Red triangles are from a CPU-hungry speed testing plugin Both show very good scaling of the event processing rate with the number of threads Reconstruction of MC data, CPU bound jobs only Overall event processing rate scales linearly with the number of threads

Multi-threading when I/O limited 6/16/09Multi-threaded event processing with JANA -- David Lawrence11 Multiple processes trying to access different locations on the same disk leads to competition causing the read head to physically move back and forth from one location on the disk to another A multi-threaded application will access a single file in sequence reducing the number of moves the read head must make blue circles : one multi-threaded process reading from a single file red triangles : multiple single-thread processes reading different files from the same disk No processing of event data, I/O bound jobs only

12/27 JANA is implemented in C++ JANA relies heavily on templates – Provides better type safety – Easily extensible External services need not be in C++ – Calibration server – Geometry description (XML) – Distributed deployment layer 6/16/09Multi-threaded event processing with JANA -- David Lawrence

Targeted Customers for JCalibration “B”-coders = reconstruction code authors (“A”-coders = framework authors; “C”-coders = physics analysis) 6/16/09Multi-threaded event processing with JANA -- David Lawrence13 JCalibration URL run_number context (string) … Reconstruction Code namepath (string) STL container ref. Database Reconstruction Program B-codersA-coders The minimal information needed from the reconstruction code is the name of the constants and a container to put them in. (The container implicitly contains a data type.)

Calibration Web Service The JCalibrationWS class provides calibration constants through a web service – Implemented as a plugin so remote access can be added to an existing executable – Allows read-only access to calibration constants from anywhere in the world over HTTP ( – Uses gSOAP, a C++ SOAP implementation – Currently works like a proxy for JCalibrationFile on server side, but could trivially be made to use another type of backend Calibration constants will need to be accessible from remote computers via the internet Direct access to a database is problematic due to cybersecurity concerns Web services work over HTTP and so are the appropriate mechanism for remote access 6/16/0914Multi-threaded event processing with JANA -- David Lawrence

Saving a (semi-)complete set of calibration constants to the local disk All JANA programs have the command line option: --dumpcalibrations Records which namepaths are requested during a job and writes the constants into ASCII files compatible with JCalibrationFile Avoids copying and running entire database or even copying a “complete” set of calibration constants (which could include obsolete ones or ones not applicable to the current run/code version) 6/16/0915Multi-threaded event processing with JANA -- David Lawrence

BCAL Beam test 2006 The JANA framework was used during a beam test in 2006 to test a 4m long calorimeter module in photon beam. Reconstruction built around objects that could be constructed from multiple event sources. Online/offline systems built around simulated data in ROOT files. Later fed from DAQ system in online environment and finally from raw data files in offline. 6/16/0916Multi-threaded event processing with JANA -- David Lawrence

The janaroot plugin (for automatic creation of ROOT TTrees) 6/16/09Multi-threaded event processing with JANA -- David Lawrence17 Each data object implements a toStrings() method which provides an expression of the data object that may not be a full representation of the object The toStrings() mechanism was developed for allowing a simple, low-level dump of objects from single events to the screen This mechanism is leveraged by janaroot to provide a similar expression as TTree s An empty event tree is also created with all other trees Each leaf is an array of size “N” to represent the N objects of this type in the event A leaf named “N” is automatically added to each tree listed as friends so that a leaves from multiple objects can be used together in expressions Limitations make this unsuitable for all applications, but it does provide a quick, easy way to make plots of some reconstructed values for less experienced users

JANA is a multi-threaded event processing framework designed to build full reconstruction packages for a multi-core environment Numerous features like: plugins, automatic ROOT-tree generation, and calibrations/conditions DB API with working Web Services implementation Data-on-demand design makes it suitable for L3 trigger algorithm. 6/16/09Multi-threaded event processing with JANA -- David Lawrence18

Backup slides 6/16/0919Multi-threaded event processing with JANA -- David Lawrence

CEBAF The Continuous Electron Beam Accelerating Factility Electron beam accelerator continuous-wave (1497MHz, 2ns bunch structure in halls) Polarized electron beam Upgrading to 12GeV (from 6GeV) 70  A 12GeV (200  A 6GeV) Existing experimental halls A, B, C Future Hall-D site 6/16/0920Multi-threaded event processing with JANA -- David Lawrence

21/27 Plugins void InitPlugin(JApplication *app) A plugin defines one external routine: Event Processors Event Source Generators Factory Generators Plugins can be used to add: 6/16/09Multi-threaded event processing with JANA -- David Lawrence

22 API For Accessing Constants Constants can be stored in either arrays (1D) or tables (2D) and can be indexed either by name (key-value) or by position. // Get 1-D array of values indexed by name bool Get(string namepath, map &vals) // Get 1-D array of values indexed by row bool Get(string namepath, vector &vals) // Get 2-D table of values indexed by row and name bool Get(string namepath, vector > &vals) // Get 2-D table of values indexed by row and column bool Get(string namepath, vector > &vals) // Get 1-D array of values indexed by name bool Get(string namepath, map &vals) // Get 1-D array of values indexed by row bool Get(string namepath, vector &vals) // Get 2-D table of values indexed by row and name bool Get(string namepath, vector > &vals) // Get 2-D table of values indexed by row and column bool Get(string namepath, vector > &vals) arrays tables 6/16/09Multi-threaded event processing with JANA -- David Lawrence // Get list of available namepaths from backend void GetListOfNamepaths(vector &namepaths) // Get list of available namepaths from backend void GetListOfNamepaths(vector &namepaths) discovery

map twpars; loop->Get("FDC/driftvelocity/timewalk_parameters", twpars); slope = twpars["slope"]; offset = twpars["offset"]; exponent = twpars["exponent"]; map twpars; loop->Get("FDC/driftvelocity/timewalk_parameters", twpars); slope = twpars["slope"]; offset = twpars["offset"]; exponent = twpars["exponent"]; 23 Example of Accessing Calibration Constants as key-value pairs... in factory class definition … Template method converts values to doubles using stringstream class For a few parameters like this, it makes sense to copy them into local data members of the factory class 6/16/09Multi-threaded event processing with JANA -- David Lawrence double slope, offset, exponent; double slope, offset, exponent;... in brun() method...

Backend Requirements 6/16/09Multi-threaded event processing with JANA -- David Lawrence24 virtual bool GetCalib(string namepath, map &svals) virtual bool GetCalib(string namepath, vector > &svals) virtual void GetListOfNamepaths(vector &namepaths) virtual bool GetCalib(string namepath, map &svals) virtual bool GetCalib(string namepath, vector > &svals) virtual void GetListOfNamepaths(vector &namepaths) To implement a JCalibration interface to a new backend, only 3 virtual methods need to be implemented! OK, actually, it’s closer to 6, but these 3 are for the generator class and are trivial. virtual const char* Description(void) virtual double CheckOpenable(string url, int run, string context) virtual JCalibration* MakeJCalibration(string url, int run, string context) virtual const char* Description(void) virtual double CheckOpenable(string url, int run, string context) virtual JCalibration* MakeJCalibration(string url, int run, string context) The generator mechanism allows access to multiple types of databases in the same executable. Access to a new type can even be brought in through a plugin.

25/27 Configuration Parameters 6/16/09Multi-threaded event processing with JANA -- David Lawrence

26/27 Implementing an Event Source To implement an event source, 2 classes must be provided: JEventSourceGenerator const char* Description(void); double CheckOpenable(string source); JEventSource* MakeJEventSource(string source); JEventSource jerror_t GetEvent(JEvent &event); void FreeEvent(JEvent &event); jerror_t GetObjects(JEvent &event, JFactory_base *factory); 6/16/09Multi-threaded event processing with JANA -- David Lawrence

27/27 JANA’s GUI API JANA’s has publicly accessible, lower level methods that allow the main “event” loop to be external to JEventLoop 6/16/09Multi-threaded event processing with JANA -- David Lawrence