Presentation is loading. Please wait.

Presentation is loading. Please wait.

Maria Grazia Pia, INFN Genova New techniques in Monte Carlo simulation: experience with a prototype of generic programming application to Geant4 physics.

Similar presentations


Presentation on theme: "Maria Grazia Pia, INFN Genova New techniques in Monte Carlo simulation: experience with a prototype of generic programming application to Geant4 physics."— Presentation transcript:

1 Maria Grazia Pia, INFN Genova New techniques in Monte Carlo simulation: experience with a prototype of generic programming application to Geant4 physics processes SNA + MC 2010 Joint International Conference on Supercomputing in Nuclear Applications + Monte Carlo 2010 Maria Grazia Pia INFN Genova, Italy Maria Grazia Pia 1, Mauro Augelli 2, Marcia Begalli 3, Lina Quintieri 4, Paolo Saracco 1, Manju Sudhakar 1, Georg Weidenspointner 5, Andreas Zoglauer 6 1 INFN Sezione di Genova, Italy – 2 CNES, France 3 State University Rio de Janeiro, Brazil – 4 INFN Laboratori Nazionali di Frascati, Italy 5 MPE and MPI Halbleiterlabor, Germany – 6 University of California at Berkeley, USA

2 Maria Grazia Pia, INFN Genova Acknowledgments The physics models and original implementations of the physics processes mentioned in this talk derive from Geant4 Standard and Low Energy Electromagnetic packages as in Geant4 9.1 (9.2) Thanks to Sergio Bertolucci (INFN and CERN) Tom Evans (ORNL) Simone Giani (CERN) Alessandro Montanari (INFN Bologna) Andreas Pfeiffer (CERN) for helpful discussions and advice The performance results concerning Compton scattering in Geant4 are published in IEEE NSS 2008 proceedings (F. Longo, L. Pandola and M.G. Pia)

3 Maria Grazia Pia, INFN Genova Courtesy Borexino Courtesy H. Araujo and A. Howard, IC London ZEPLIN III Courtesy CMS Collaboration Courtesy ATLAS Collaboration Courtesy GATE Collaboration Courtesy R. Nartallo et al.,ESA Widely used also in Space science and astronomy Medical physics, nuclear medicine Radiation protection Accelerator physics Humanitarian projects, security etc. Technology transfer to industry, hospitals… Born from the requirements of large scale HEP experiments Most cited Nuclear Science and Technology publication! >140000 papers since 1990 2 nd most cited CERN/INFN paper Modern classic S. Agostinelli et al. GEANT4 - a simulation toolkit NIM A 506 (2003) 250-303 GEANT4 - a simulation toolkit

4 Maria Grazia Pia, INFN Genova Geant4 is a mature Monte Carlo system nowadays Widely used in a variety of experimental applications LHC has entered production phase 1994 – 1998 Pioneering project in HEP environment Cutting-edge technology Rigorous software development methodologies πάντα ε New software technologies have emerged since then Could Geant4 profit from them? New software technologies have emerged since then Could Geant4 profit from them? More than one decades growth since RD44 Could Geant4 be rejuvenated by pruning ? More than one decades growth since RD44 Could Geant4 be rejuvenated by pruning ?

5 Maria Grazia Pia, INFN Genova Generic programming Powerful paradigm Bringing aspects of generic programming into the mainstream is most likely C++s greatest contribution to the software development community during this period. B. Stroustrup, Proc. 3 rd ACM SIGPLAN Conf. on History of programming languages, 2007 Drawbacks code bloat compiler support poor error messages, cumbersome debugging Explore pro and contra by means of a prototype Small enough to require relatively limited investment Large enough for the exercise to be meaningful Quantitative metrics

6 Maria Grazia Pia, INFN Genova A policy defines a class or class template interface Policy host classes are parameterised classes Advantages Policies are not required to inherit from a base class The code is bound at compile time No need of virtual methods, resulting in faster execution Policy-based design Syntax-oriented rather than signature-oriented Weak dependency of the policy and the policy based class on the policy interface Highly customizable design First introduced in Geant4 S. Chauvie et al., Geant4 physics processes for microdosimetry simulation: design foundation and implementation of the first set of models IEEE Trans. Nucl. Sci., vol. 54, no. 6, 2619-2628, 2007 R&D! C++ is capable of a Turing machine at two levels Exploit both Mix and match

7 Maria Grazia Pia, INFN Genova 1 st cycle: propaedeutic exploration R&D on generic programming techniques in Geant4 physics Problem domain analysis Dismount Geant4 physics processes Identify objects subject to mutability Dismount Geant4 physics processes Identify objects subject to mutability Added complexity Deterioration of performance? Side requirements Agility of configuration Transparency Easy verification & validation Agility of configuration Transparency Easy verification & validation Technology Support to requirements UP: iterative and incremental software process

8 Maria Grazia Pia, INFN Genova Vision 1 st prototype: photon interactions Metrics Software development process Software performance Extension to charged particle interactions Metrics I2: Low Energy Electrons and Photons Design, development and validation of electron ionisation models for nano-scale simulation Evaluation on satellite domains Metrics G3: Information Technology and its Applications Physics data management tools: computational evolutions and benchmarks -testing in concrete use cases Metrics Some of these processes are concurrent

9 Maria Grazia Pia, INFN Genova

10 A condition of complete simplicity (Costing not less than everything) T.S. Eliot, Four Quartets (Little Gidding) typedef G4PhotonProcess G4ComptonStandard> Interface: only mandatory inherited pure virtual functions Preliminary Refinements in further design iterations (based on metrics)

11 Maria Grazia Pia, INFN Genova Minimalism… G4VEMProcess G4VEMModel

12 Maria Grazia Pia, INFN Genova Compton cross section % difference 2 test NIST Phys. Ref. Data p-value Library 0.982 Penelope <0.001 0.993 excluding 1 keV Standard 0.189 Library-Penelope Si, Z=14 Different scale! Library-Standard Si, Z=14 Different scale! Penelope-Standard Si, Z=14 Different scale! Example: Compton in Si 1 keV – 100 GeV Agility

13 Maria Grazia Pia, INFN Genova Doppler broadening in Compton scattering Library Penelope Standard final state Generators Si, 40 keV Cs, 400 keV Yes, physics does make sense. And is transparently exposed. Validation on experimental data by Namito et al. There is only the fight to recover what has been lost And found and lost again and again: and now, under conditions That seem unpropitious. T.S. Eliot, Four Quartets (East Coker)

14 Maria Grazia Pia, INFN Genova Performance improvement (where no improvement is expected) Policy-based designGeant4 9.1Gain C4.156.0832% Si6.238.3726% Cu7.6410.7829% W14.0619.1827% Move lowenergy-Penelope to Standard package design: ~10% gain, including implementation improvements Source: L. Pandola, http://workgroup.lngs.infn.it/geant4lns/group-meetings-directory/l.pandola http://workgroup.lngs.infn.it/geant4lns/group-meetings-directory/l.pandola Penelope Compton Example: Penelope Compton NO ATTEMPT [yet] TO IMPROVE THE IMPLEMENTATION 40 keV, 10 6 events, Intel Core2 Duo Processor E6420, 2.13 GZ, 4 GB RAM Low Energy – Library: 28% gain with policy-based design Preliminary

15 Maria Grazia Pia, INFN Genova Metrics Old G4-NIST comparison test 4134 LoC* O(months) CPU+human time Photon cross sections test Test with new design <50 LoC*, O(human minutes) K. Amako et al., Comparison of Geant4 electromagnetic physics models against the NIST reference data IEEE Trans. Nucl. Sci., vol. 52, no. 4, pp. 910-918, Aug. 2005

16 Maria Grazia Pia, INFN Genova Adopt best practices, build on existing body of knowledge

17 Maria Grazia Pia, INFN Genova Physics on a diet The design exposes the physics at very fine granularity Unprecedented opportunity for thorough validation Identification of epistemic uncertainties Similarities and differences among Geant4 models Accuracy Accuracy Computational performance Computational performance Toolkit nature of Geant4: provide a variety of models Replicas of the same physics functionality? Often result of evolution: initially they were different Pruning keeps trees healthier! Cost of maintenance of a complex software system Long time scale of LHC operation (various developers will be retired) Only a fraction of Geant4 physics has documented validation in the literature Strive for simplicity, transparency, agility

18 Maria Grazia Pia, INFN Genova No charged photons

19 Maria Grazia Pia, INFN Genova No nostalgia of FORTRAN common block… Encapsulation robustness, transparency G4VEMProcess G4VEMModel

20 Maria Grazia Pia, INFN Genova src/G4BetheBlochModel.cc: fParticleChange = reinterpret_cast src/G4BetheHeitlerModel.cc: fParticleChange = reinterpret_cast (pParticleChange); src/G4BraggIonModel.cc: reinterpret_cast (pParticleChange); src/G4BraggModel.cc: reinterpret_cast (pParticleChange); src/G4eBremsstrahlungModel.cc: fParticleChange = reinterpret_cast (pParticleChange); src/G4eBremsstrahlungRelModel.cc: fParticleChange = reinterpret_cast (pParticleChange); src/G4eCoulombScatteringModel.cc: reinterpret_cast (pParticleChange); src/G4KleinNishinaCompton.cc: fParticleChange = reinterpret_cast (pParticleChange); src/G4MollerBhabhaModel.cc: fParticleChange = reinterpret_cast src/G4MscModel71.cc: fParticleChange = reinterpret_cast (pParticleChange); src/G4MultipleScattering71.cc: model = dynamic_cast (SelectModel(e)); src/G4PEEffectModel.cc: fParticleChange = reinterpret_cast (pParticleChange); src/G4UrbanMscModel2.cc: fParticleChange = reinterpret_cast (pParticleChange); src/G4UrbanMscModel90.cc: fParticleChange = reinterpret_cast (pParticleChange); src/G4UrbanMscModel.cc: fParticleChange = reinterpret_cast (pParticleChange); Design, design, design…

21 Maria Grazia Pia, INFN Genova The only wisdom we can hope to acquire Is the wisdom of humility: humility is endless. T.S. Eliot, Four Quartets (East Coker) First considerations The technology looks promising for application to a large, complex, computationally intensive physics simulation domain Enormous gain in Transparency Agility Easy verification and validation Maintenance effort Significant performance improvement At a very early stage of the project, still room for further improvement But there is still a long way to go…


Download ppt "Maria Grazia Pia, INFN Genova New techniques in Monte Carlo simulation: experience with a prototype of generic programming application to Geant4 physics."

Similar presentations


Ads by Google