Download presentation
Presentation is loading. Please wait.
Published byCecily Mason Modified over 9 years ago
1
IEEE Nuclear Science Symposium and Medical Imaging Conference Short Course The Geant4 Simulation Toolkit Sunanda Banerjee (Saha Inst. Nucl. Phys., Kolkata, India) Min Cheol Han (Hanyang Univ., Seoul, Korea) Steffen Hauf (XFEL, Hamburg, Germany) Maria Grazia Pia (INFN Genova, Italy) MariaGrazia.Pia@ge.infn.it Seoul, 27 October 2013 http://www.ge.infn.it/geant4/events/nss2013/geant4course.html This course encompasses training material developed by several Geant4 members: thanks to all of them!
2
Geant4 MultiThreading
3
Geant4 Multithreading3 Evolution of Computer Technology Increase in CPU power used to be done by increasing frequency. This has reached a plateau because of power needs. So expectation in future trend in computer technology: –No major increase in single core performance –Many cores in a processor (double/2 year?) –Less memory per core Need new software models to take these into account → increase parallelism In Geant4 events are supposed to be independent. –Each event can be simulated separately –To keep backward compatibility with user code, multi-threading at event level is a natural choice for parallelism
4
Geant4 Multithreading4 What is a thread? Sequential applicationStart N copies of application in the cores if they fit in memory MT Application: master controls workers that do simulation Introduce shared objects to reduce overall memory consumption
5
Geant4 Multithreading5 Geant4 MT Model Steps to be taken –Isolate static data structure from the dynamic one –Protect dynamic part of memory which can be shared among the working threads A Geant4 (with MT) application can be seen as simple finite state machine Threads do not exist before /run/beamOn. Master writes shared memory. When threads start they cannot change the shared memory No locking
6
Geant4 Multithreading6 Geant4 MT Model Seeds pre-prepared per event in a “queue” Threads compete for next event to be processed Command line scoring and G4tools merge results from threads
7
Geant4 Multithreading7 User Application in Sequential Model
8
Geant4 Multithreading8 User Application in MT Mode
9
Geant4 Multithreading9 Migration to MT (1) Move user action class from main() to a new ActionInitialization class
10
Geant4 Multithreading10 Migration to MT (2)
11
Geant4 Multithreading11 Migration to MT (3) Instantiate G4MTRunManager and replace the code moved in ActionInitialization with use of this class If sensitive detectors are present separate their creation in a new function CreateSDandField() –A new utility function can be used: G4VUserDetectorConstruction::SetSensitiveDetector If magnetic field is present, move it to CreateSDandField()
12
Geant4 Multithreading12 Migration to MT (4) Typically G4Allocator us used in Hit, Trajectory and TrajectoryPoint classes –Change static declarations to static G4ThreadLocal
13
Geant4 Multithreading13 Computing Performance Deviation from linearity less than 6% Memory saving is better than 40%
14
Geant4 Multithreading14 Physics Performance MT reproduces sequential results faithfully ATLAS TileCal
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.