Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September 2007 1 Recommendations for improving application performance (… but not presentation.

Slides:



Advertisements
Similar presentations
The Geant4 Kernel: Status and Recent Developments John Apostolakis, Gabriele Cosmo – CERN / PH Makoto Asai – SLAC On behalf the Geant4 collaboration April.
Advertisements

Geant4 v9.2p02 Speed up Makoto Asai (SLAC) Geant4 Tutorial Course.
Stefan Roesler SC-RP/CERN on behalf of the CERN-SLAC RP Collaboration
Use of G EANT 4 in CMS AIHENP’99 Crete, April 1999 Véronique Lefébure CERN EP/CMC.
Pedro Arce Point detector scoring 1 Point detector scoring in GEANT4 Pedro Arce, (CIEMAT) Miguel Embid (CIEMAT) Juan Ignacio Lagares (CIEMAT) Geant4 Event.
Implicit Capture Overview Jane Tinslay, SLAC March 2007.
14 User Documents and Examples I SLAC Geant4 Tutorial 3 November 2009 Dennis Wright Geant4 V9.2.p02.
Alex Howard - Event Biasing Mini-Workshop - SLAC Geometrical Event biasing and Variance Reduction – Talk 2 Alex Howard, CERN Event Biasing Mini-Workshop,
Highlights of latest developments ESA/ESTEC Makoto Asai (SLAC)
Geant4 Event Biasing Jane Tinslay, SLAC May 2007, Geant4 v8.2.p01.
J. Tinslay 1, B. Faddegon 2, J. Perl 1 and M. Asai 1 (1) Stanford Linear Accelerator Center, Menlo Park, CA, (2) UC San Francisco, San Francisco, CA Verification.
Interaction Forcing Overview Jane Tinslay, SLAC March 2007.
14 Overview of Geant4 Examples 2 nd Finnish Geant4 Workshop 6-7 June 2005 Dennis Wright (SLAC)
Leading Particle Biasing Overview Jane Tinslay, SLAC March 2007.
Lecture 9: SHELL PROGRAMMING (continued) Creating shell scripts!
CMS Full Simulation for Run-2 M. Hildrith, V. Ivanchenko, D. Lange CHEP'15 1.
Geant4 New Features Joseph Perl (SLAC/SCCS) G4NAMU AAPM Minneapolis 22 July 2007.
Alex Howard, CERN - Event Biasing Overview – Hebden Bridge 12 th September Event biasing – An Overview Alex Howard, CERN Event Biasing Overview.
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Japan.
Photon reconstruction and calorimeter software Mikhail Prokudin.
G EANT 4 energy loss of protons, electrons and magnetic monopole M. Vladymyrov.
Workshop on Physics on Nuclei at Extremes, Tokyo Institute of Technology, Institute for Nuclear Research and Nuclear Energy Bulgarian Academy.
User Documents and Examples I Sébastien Incerti Slides thanks to Dennis Wrigth, SLAC.
Tracking at LHCb Introduction: Tracking Performance at LHCb Kalman Filter Technique Speed Optimization Status & Plans.
Precision Analysis of Electron Energy Deposition in Detectors Simulated by Geant4 M. Bati č, S. Granato, G. Hoff, M.G. Pia, G. Weidenspointner 2012 NSS-MIC.
Geant4 Acceptance Suite for Key Observables CHEP06, T.I.F.R. Mumbai, February 2006 J. Apostolakis, I. MacLaren, J. Apostolakis, I. MacLaren, P. Mendez.
Profiling study of Geant4-GATE VRTs discussion Nicolas Karakatsanis Alexander Howard Geant4 Users Workshop Medical/GATE Parallel Session 13 th September.
Medical Accelerator F. Foppiano, M.G. Pia, M. Piergentili
Geant4 Event Biasing Marc Verderi, LLR (Heavily copied from Jane Tinslay, SLAC) June 2007.
Optimising Cuts for HLT George Talbot Supervisor: Stewart Martin-Haugh.
Computing Performance Recommendations #13, #14. Recommendation #13 (1/3) We recommend providing a simple mechanism for users to turn off “irrelevant”
Hadronic Interaction Studies for LHCb Nigel Watson/Birmingham [Thanks to Silvia M., Jeroen v T.]
Simulation of the energy response of  rays in CsI crystal arrays Thomas ZERGUERRAS EXL-R3B Collaboration Meeting, Orsay (France), 02/02/ /03/2006.
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Collaboration.
Alex Howard - Event Biasing Geant4 Users - Lisbon Event biasing and Variance Reduction - Geometrical Alex Howard, CERN Geant4 Users Workshop, Lisbon.
Geant4 in production: status and developments John Apostolakis (CERN) Makoto Asai (SLAC) for the Geant4 collaboration.
New software library of geometrical primitives for modelling of solids used in Monte Carlo detector simulations Marek Gayer, John Apostolakis, Gabriele.
LHCb production experience with Geant4 LCG Applications Area Meeting October F.Ranjard/ CERN.
Release Validation J. Apostolakis, M. Asai, G. Cosmo, S. Incerti, V. Ivantchenko, D. Wright for Geant4 12 January 2009.
Status of ATLAS Liquid Argon Calorimeter Simulations With GEANT4 G. Azuelos , A. Chekhtman , J. Dodd , A. Kiryunin , M. Leltchouk , R. Mazini , G.
Geant4 v9.4 Kernel III Makoto Asai (SLAC) Geant4 Tutorial Course.
The CMS Simulation Software Julia Yarba, Fermilab on behalf of CMS Collaboration 22 m long, 15 m in diameter Over a million geometrical volumes Many complex.
1 Performance of a Magnetised Scintillating Detector for a Neutrino Factory Scoping Study Meeting Rutherford Appleton Lab Tuesday 25 th April 2006 M. Ellis.
Alex Howard, ETH, Zurich 13 th September 2012, 17 th Collaboration Meeting, Chartres 1 Geometrical Event Biasing Facility Alex Howard ETH, Zurich Geometrical.
Bremsstrahlung Splitting Overview Jane Tinslay, SLAC March 2007.
Geant4 Simulation of the Beam Line for the HARP Experiment M.Gostkin, A.Jemtchougov, E.Rogalev (JINR, Dubna)
Bartol Flux Calculation presented by Giles Barr, Oxford ICRR-Kashiwa December 2004.
Profiling study of Geant4-GATE Discussion of suggested VRTs Nicolas Karakatsanis, George Loudos, Arion Chatziioannou Geant4-GATE technical meeting 12 th.
Geant4 CPU performance : an update Geant4 Technical Forum, CERN, 07 November 2007 J.Apostolakis, G.Cooperman, G.Cosmo, V.Ivanchenko, I.Mclaren, T.Nikitina,
Geant4 on GPU prototype Nicholas Henderson (Stanford Univ. / ICME)
Alex Howard, CERN - Event Biasing Overview – Hebden Bridge 13 th September Event biasing and Variance Reduction Alex Howard, CERN Event Biasing.
Pedro Arce Introducción a GEANT4 1 GAMOS tutorial RadioTherapy Exercises Pedro Arce Dubois CIEMAT
Geant4 release 5.1 summary Gabriele Cosmo EP/SFT.
1 Giuseppe G. Daquino 26 th January 2005 SoFTware Development for Experiments Group Physics Department, CERN Background radiation studies using Geant4.
Feb. 3, 2007IFC meeting1 Beam test report Ph. Bruel on behalf of the beam test working group Gamma-ray Large Area Space Telescope.
Reconstruction code and comparison between Genie and Genhen A. Trovato, C. Distefano, R. Coniglione and P. Sapienza Kick-off ORCA meeting: 6 September.
CHEP ’06 GEANT4E 1 GEANT4E: Error propagation for track reconstruction inside the GEANT4 framework Pedro Arce (CIEMAT) CHEP 2006, Mumbai, 13-17th February.
Plans of developments and validation for th Geant4 Workshop September 2011 SLAC, Stanford, CA, USA.
Alex Howard, ETHZ – Biasing Requirements – SLAC 21 st September Biasing Requirements and Interfaces Alex Howard ETH, Zurich Biasing Space User Requirements.
Interaction with the Geant4 kernel
Geant4 Geometry Speed-ups
Status of Biasing Development
Interaction with the Geant4 kernel
User Documents and Examples I
The Hadrontherapy Geant4 advanced example
Summary of dE/dx studies in silicon and MS in muon system
Geant4 in HARP V.Ivanchenko For the HARP Collaboration
Marc Verderi GEANT4 collaboration meeting 01/10/2002
Based on a presentation of M.Verderi
GEANT4 performance studies
Presentation transcript:

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Recommendations for improving application performance (… but not presentation speed) Alex Howard, CERN CPU Performance: Recommendations for improving application performance Geant4 Users Workshop Hebden Bridge 14 th September 2007 With input from Tatsumi Koi, Vladimir Ivanchenko, Jane Tinslay, Gabriele Cosmo, Tatiana Nikitina, Makoto Asai, John Apostolakis 1.Physics Based Biasing 2.Geometrical Biasing 3.Neutron_HP 4.Physics Tuning and Electromagnetic Physics 5.Geometry/Detector Description 6.Magnetic Field Tuning 7.User Actions 8.Configuration issues 9.Summary

2 Uniform Bremsstrahlung Splitting Thick target bremsstrahlung simulation Primary electron energy of 15.8 MeV Low energy physics list with 0.1mm cut Target materials: beryllium, aluminium and lead Photons are counted on a scoring sphere 1m from the target Jane Tinslay, SLAC

3 Using G4WrapperProcess, speed up simulation using the uniform bremsstrahlung splitting with Russian roulette variance reduction technique: A.F. Bielajew et al., SLAC-PUB-6499 (1994) Bremsstrahlung splitting Reduce time spent tracking electrons Do regular electron transport until bremsstrahlung interaction occurs Then generate 100 unique secondary photons instead of just one Apply relative weight correction of 1/100 to photons Russian roulette Population control Don’t want too many low weight particles Keep only 1/100 charged secondaries with their weight increased by a factor of 100 Net effect is that all photons have relative weight of 1/100, while all electrons have same weight Jane Tinslay, SLAC

4 Splitting factor = 100No splitting Scoring Geometry Uniform Bremsstrahlung Splitting Jane Tinslay, SLAC

5 BerylliumAluminiumLead Efficiency Estimate biasing efficiency: Efficiency drops off as a function of atomic number since more bremsstrahlung photons interact in higher atomic number material Speedup is reasonable Jane Tinslay, SLAC

6 Geometrical Biasing (1) Michael Dressel, TRIUMF Collaboration Workshop 2003

7 Geometrical Biasing (2) Michael Dressel, TRIUMF Collaboration Workshop 2003

8 Geometrical Biaising (3) Michael Dressel, TRIUMF Collaboration Workshop 2003

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Neutron_HP - Switching off Doppler Broadening (1) Since v9.0 you can switch off Doppler Broadening in neutron_hp – due to the thermal motion of the target nucleus. The broadening is used to correct the G4NDLdata, which are at zero temperature. This must be done only for appropriate applications. To switch broadening off, the environment variable G4NEUTRONHP_NEGLECT_DOPPLER must be set Note the thermal motion of the nucleus is still taken into account in the FinalState Generator. This option provides a significant CPU performance advantage It is not suitable for simulation in which low energy (thermal) neutrons are important, as related observables

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Neutron_HP – switching off Doppler Broadening (2) setenv G4NEUTRONHP_NEGLECT_DOPPLER=1 T. Koi

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Physics Tuning and Electromagnetic Physics Adequate physics list – what do you need for your use case/application? Choice of models – parametrized, FAST, theoretical driven, data-base driven energy ranges… Cuts in energy, particle type, range cuts Cuts by region Processes with infra-red divergence – what production cut do I need? EM settings? –E.g. Multiple scattering – model, parameters, range cut, choice of skin value, default values Initialisation time, data-base loading…

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September How to optimize CPU usage for EM applications CPU of a job is strongly correlated with number of simulation steps –Production thresholds (cuts) –Step limitations from energy loss processes –Step limitation from multiple scattering process –User step limitation CPU optimisation is (nearly) always a compromise with accuracy V.Ivanchenko

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Visible energy in EM calorimeters and CPU performance ATLAS barrel LHCb V.Ivanchenko et al., CHEP’07, Victoria, Canada, Sept. 2-7, 2007

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Step limitation from continuous energy loss The cross sections depend of the energy. The step size must be small enough to ensure a small fraction of energy loss along the step : This constraint must be relaxed when E  0 finalRange M.Maire dRoverRange

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Fano Cavity test of e - transport S. Elles, M. Maire 1 MeV gamma beam in water with cavity of water-gas The absolute prediction of the dose deposition inside the cavity Significant deviation for EMV Physics List Default EMV

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Multiple scattering options G4MscStepLimitType  Minimal - equivalent to the original algorithm, as implemented in Geant4 7.1 and earlier releases.  UseSafety - the current default, which makes use of the geometrical safety  UseDistanceToBoundary - the most advanced, recommended for accuracy in the cases where no magnetic field is set Multiple scattering configuration /process/msc/StepLimit UseDistanceToBoundary /process/msc/LateralDisplacement true /process/msc/RangeFactor 0.02 /process/msc/GeomFactor 3.5 /process/msc/Skin 2 V.Ivanchenko

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Some tips to consider We are making our best effort to improve the speed of Geant4 toolkit. But, since it is a toolkit, a user may also make the simulation unnecessarily slow. For general applications –Check methods which are invoked frequently, e.g. UserSteppingAction(), ProcessHits(), ComputeTransformation(), GetField() etc. –In such methods, avoid string manipulation, file access or cout, unnecessary object instantiation or deletion, or unnecessary massive polynomial calculation such as sin(), cos(), log(), exp(). For relatively complex geometry or high energy applications –Kill unnecessary secondary particles as soon as possible. –Utilize G4Region for regional cut-offs, user limits. –For geometry, consider replica rather than parameterized volume as much as possible. Also consider nested parameterization. –Do not keep too many trajectories. For relatively simple geometry or low energy applications –Do not store the random number engine status for each event. M. Asai

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Geometry/Detector Description (1) The way in which geometry is defined in Geant4 allows the possibility to very optimised or clearly sub-optimal Care should be made on organisation of physical volumes The navigator “prefers” a hierarchical approach – i.e. a tree. Flat designs should be avoided, but the number of daughters per volume should also not become excessive Replicas are better than placements are better than parameterisations! Too many placements are not good Too complicated parameterisations should also be avoided Replicas are always good (if of regular geometry) Assemblies are convenient but are less performant than placements Choice of solids by complexity (polycons, polyhedra, traps, toruses, twisted solids, …)

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Geometry/Detector Description (2) Definition of detector regions – can help significantly with cuts, fields etc… Geometry optimisation - can give memory and initialisation issues - scanning the tree –3-D voxelisation (significant improvement, if possible) –Smartless factor – number of divisions, if you have a granular geometry with large spaces, optimisation will make things worse –Run/verbosity 2 should tell you the output of the geometry optimiser Choice of navigation (voxelised or not, navigation for regular structures (phantoms) - Pedro’s talk earlier, …) Geometry correctness (avoid overlaps – can lead to stuck particles) Avoid rebuild of whole geometry in dynamical setups Switch off optimisation for part of geometry that’s moving

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Magnetic field tuning ConfigureForTrack() –Change parameters of propagation in field –accuracy vs. particle vs. energy Choice of steppers –E.g. G4HelixMixedStepper –G4RKG3_Stepper (calls the field one less time per step) Proper definition of zero field (e.g. example N02) Proper definition and access to user-defined field-maps Setting field by region Choosing algorithm by region Set local field Multiple scattering options (skin = 0 - default) Tatiana Nikitina

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September User Actions It’s not always appreciated that user actions can be used inappropriately – the UserSteppingAction is called every step UserTrackingAction for every new track… Use of allocators for hits/tracks… Sensitive detectors, hits collections Primitive scorers (could save memory and I/O)

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Configuration Issues G4_NO_VERBOSE – could give a 15% speed up –Less info –Less error reporting Run-time commands to reduce/switch off verbosity Avoid G4DEBUG and use default optimised builds Use of a performant compiler (gcc 4.X series) Use of a performant system (Mac, iPhone, iPod, multi-cores) Static libraries (single executable) vs. shared Benchmark issues – care about system should be made: –Standalone system, local disk, single user, stability… –Avoid afs, virtual cpu’s/hyperthreading, memory swapping Profiling can also help a lot

Alex Howard, CERN – Performance Improvement – Hebden Bridge 14 th September Summary/Final Remarks …This talk is by no means exhaustive There are a very large number of ways an application can be speeded up There are an equally large number of ways an application can be slowed down! The documentation and release notes can be very helpful Comparison with data and the application output should always be considered…