1 / 21

SNA + MC 2010 Joint International Conference on

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

gary
Télécharger la présentation

SNA + MC 2010 Joint International Conference on

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. New techniques in Monte Carlo simulation: experience with a prototype of generic programming application to Geant4 physics processes Maria GraziaPia INFN Genova, Italy Maria Grazia Pia1,Mauro Augelli2,Marcia Begalli3,Lina Quintieri4,Paolo Saracco1,Manju Sudhakar1,Georg Weidenspointner5, Andreas Zoglauer6 1 INFN Sezione di Genova, Italy – 2 CNES, France3 State University Rio de Janeiro, Brazil – 4 INFN LaboratoriNazionali di Frascati, Italy 5 MPE and MPI Halbleiterlabor, Germany– 6 University of California at Berkeley, USA SNA + MC 2010 Joint International Conference on Supercomputing in Nuclear Applications + Monte Carlo 2010

  2. 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. Courtesy CMS Collaboration Courtesy ATLAS Collaboration Courtesy H. Araujo and A. Howard, IC London Courtesy GATE Collaboration Courtesy R. Nartallo et al.,ESA Courtesy Borexino S. Agostinelli et al.GEANT4 - a simulation toolkitNIM A 506 (2003) 250-303 Most cited “Nuclear Science and Technology” publication! >140000 papers since 1990 2nd most cited CERN/INFN paper “Modern classic” Born from the requirements of large scale HEP experiments • 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… ZEPLIN III

  4. πάντα ῥεῖ 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? More than one decade’s growth since RD44 Could Geant4 be rejuvenated by pruning ?

  5. 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. 3rd 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. 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 Policy-based design • 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 C++ is capable of a Turing machine at two levels Weak dependency of the policy and the policy based class on the policy interface Syntax-oriented rather than signature-oriented Exploit both Mix and match Highly customizabledesign R&D!

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

  8. Vision 1st prototype: photon interactions Some of these processes are concurrent 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 b-testing in concrete use cases Metrics

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

  10. Minimalism… G4VEMModel G4VEMProcess

  11. Library-Penelope Si, Z=14 Library-Standard Si, Z=14 Different scale! Different scale! Penelope-Standard Si, Z=14 Different scale! Agility Compton cross section % difference Example: Compton in Si 1 keV – 100 GeV c2 test NIST Phys. Ref. Data

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

  13. Performance improvement(where no improvement is expected) Example: Penelope Compton NO ATTEMPT [yet] TO IMPROVE THE IMPLEMENTATION Preliminary 40 keV, 106 events, Intel Core2 Duo Processor E6420, 2.13 GZ, 4 GB RAM 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 Low Energy – Library: 28% gain with policy-based design

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

  15. Adopt best practices, build on existing body of knowledge

  16. Strive for simplicity, transparency, agility Physics on a diet Only a fraction of Geant4 physics has documented validation in the literature • 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 • 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)

  17. No charged photons

  18. No nostalgia of FORTRAN common block… G4VEMProcess Encapsulation robustness, transparency G4VEMModel

  19. Design, design, design… src/G4BetheBlochModel.cc: fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*> src/G4BetheHeitlerModel.cc: fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange); src/G4BraggIonModel.cc: reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange); src/G4BraggModel.cc: reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange); src/G4eBremsstrahlungModel.cc: fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange); src/G4eBremsstrahlungRelModel.cc: fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange); src/G4eCoulombScatteringModel.cc: reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange); src/G4KleinNishinaCompton.cc: fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange); src/G4MollerBhabhaModel.cc: fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*> src/G4MscModel71.cc: fParticleChange = reinterpret_cast<G4ParticleChangeForMSC*>(pParticleChange); src/G4MultipleScattering71.cc: model = dynamic_cast<G4MscModel71*>(SelectModel(e)); src/G4PEEffectModel.cc: fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange); src/G4UrbanMscModel2.cc: fParticleChange = reinterpret_cast<G4ParticleChangeForMSC*>(pParticleChange); src/G4UrbanMscModel90.cc: fParticleChange = reinterpret_cast<G4ParticleChangeForMSC*>(pParticleChange); src/G4UrbanMscModel.cc: fParticleChange = reinterpret_cast<G4ParticleChangeForMSC*>(pParticleChange);

  20. 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…

More Related