Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
----------------------------
|
||||
|
||||
This example demonstrates a very simple application where an energy
|
||||
deposit and # of steps is accounted in thread-local (i.e. one instance per
|
||||
deposit and # of steps is accounted in thread-local (i.e. one instance per
|
||||
thread) hits maps with underlying types of plain-old data (POD) and global
|
||||
(i.e. one instance) hits maps with underlying types of atomics.
|
||||
The example uses a coarse mesh, extensive physics, and step limiters
|
||||
@@ -17,15 +17,15 @@
|
||||
when updating the scorers to test the robustness of the atomics
|
||||
classes and maximize the compounding of thread-local round-off error.
|
||||
At the end of the simulation, the scorers are printed to
|
||||
"mfd_<DATA_TYPE>_<SCORER_TYPE>.out", where DATA_TYPE is either
|
||||
"mfd_<DATA_TYPE>_<SCORER_TYPE>.out", where DATA_TYPE is either
|
||||
"tl" (thread-local) or "tg" (thread-global) and SCORER_TYPE is "EnergyDeposit"
|
||||
or "NumberOfSteps". These values are then compared to a thread-global
|
||||
sum of these scorers that were updated via mutex locking. If round-off
|
||||
errors in thread-local EnergyDeposit are present, they can be viewed
|
||||
in "mfd_diff.out" at the end of the simulation
|
||||
This example also provides a demonstration of the TiMemory (timing and
|
||||
memory analysis) package provided in Geant4 -- for documentation of TiMemory
|
||||
see https://github.com/jrmadsen/TiMemory.
|
||||
This example also provides a demonstration of the timemory (a performance
|
||||
instrumentation toolkit) package provided in Geant4 -- for documentation of timemory
|
||||
see https://github.com/NERSC/timemory and https://timemory.readthedocs.io.
|
||||
|
||||
1- ATOMICS and the ATOMIC SCORERS
|
||||
|
||||
@@ -38,33 +38,33 @@
|
||||
in atomic.hh has limited copy-construction and still cannot be used in
|
||||
STL containers. Use these copy-constructors with extreme caution. See
|
||||
opening comments of G4atomic.hh for more details.
|
||||
|
||||
|
||||
The newly provided classes in this example (G4atomic, G4TAtomicHitsMap, and
|
||||
G4TAtomicHitsCollection) are intended for applications where memory is a
|
||||
G4TAtomicHitsCollection) are intended for applications where memory is a
|
||||
greater concern than performance. While atomics generally perform better than
|
||||
mutex locking, the synchronization is not without a cost. However, since
|
||||
the memory consumed by thread-local hits maps scales roughly linearly
|
||||
with the number of threads, simulations with a large number of scoring
|
||||
volumes can decrease simulation time by increasing the number of threads
|
||||
volumes can decrease simulation time by increasing the number of threads
|
||||
beyond what was previously allowed due to the increase in memory consumption.
|
||||
|
||||
|
||||
The G4TAtomicHitsMap and G4TAtomicHitsCollection work exactly the same way
|
||||
as the standard G4THitsMap and G4THitsCollection, respectively, with the
|
||||
exception(s) that you should only implement one instance and provide a
|
||||
exception(s) that you should only implement one instance and provide a
|
||||
pointer/reference of that instance to the threads instead of having the
|
||||
threads create them. Additionally, there is no need to include them
|
||||
in the G4Run::Merge().
|
||||
|
||||
|
||||
2- GEOMETRY DEFINITION
|
||||
|
||||
|
||||
The geometry is constructed in the TSDetectorConstruction class.
|
||||
The setup consists of a box filling the world. The volume is divided into
|
||||
subregions, where the outermost boxes are a different material. The materials
|
||||
by default are water and boron as these have large scattering cross-sections
|
||||
for neutrons (the default particle).
|
||||
|
||||
by default are water and boron as these have large scattering cross-sections
|
||||
for neutrons (the default particle).
|
||||
|
||||
3- PHYSICS LIST
|
||||
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set are built from a variety of physics constructors.
|
||||
The chosen physics lists are extensive, primarily
|
||||
@@ -90,28 +90,28 @@
|
||||
in multi-threading mode the same method is invoked for each thread worker
|
||||
and so all user action classes are defined thread-local.
|
||||
|
||||
A run action class is instantiated both thread-local
|
||||
A run action class is instantiated both thread-local
|
||||
and global that's why its instance is created also in the method
|
||||
TSActionInitialization::BuildForMaster()
|
||||
TSActionInitialization::BuildForMaster()
|
||||
which is invoked only in multi-threading mode.
|
||||
|
||||
|
||||
5- PRIMARY GENERATOR
|
||||
|
||||
|
||||
The primary generator is defined in the TSPrimaryGeneratorAction class.
|
||||
The default kinematics is a 1 MeV neutron, randomly distributed in front
|
||||
of the target across 100% of the transverse (X,Y) target size.
|
||||
This default setting can be changed via the Geant4 built-in commands
|
||||
This default setting can be changed via the Geant4 built-in commands
|
||||
of the G4ParticleGun class.
|
||||
|
||||
|
||||
6- DETECTOR RESPONSE
|
||||
|
||||
This example demonstrates a scoring implemented
|
||||
in the user action classes and TSRun object.
|
||||
|
||||
|
||||
The energy deposited is collected per event in the PrimitiveScorer
|
||||
G4PSEnergyDeposit (as part of a MultiFunctionalDetector)
|
||||
and the thread-local version are merged at the end of the run.
|
||||
|
||||
|
||||
The number of steps is collected per event in the PrimativeScorer
|
||||
G4PSNoOfSteps and the thread-local version are merged at the end of the run.
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
and type in the commands from run.mac line by line:
|
||||
Idle> /control/verbose 2
|
||||
Idle> /tracking/verbose 1
|
||||
Idle> /run/beamOn 10
|
||||
Idle> /run/beamOn 10
|
||||
Idle> ...
|
||||
Idle> exit
|
||||
or
|
||||
@@ -177,14 +177,12 @@
|
||||
|
||||
8- TIMEMORY USAGE
|
||||
|
||||
This example demonstrates timing and memory analysis with TiMemory
|
||||
(https://github.com/jrmadsen/TiMemory).
|
||||
This example demonstrates profiling analysis with timemory
|
||||
(https://github.com/NERSC/timemory).
|
||||
|
||||
- Compile Geant4 with TiMemory (-DGEANT4_USE_TIMEMORY=ON)
|
||||
- TiMemory auto-timer provide timing within the Geant4 source code
|
||||
- Compile Geant4 with timemory (-DGEANT4_USE_TIMEMORY=ON)
|
||||
- timemory provide timing within the Geant4 source code
|
||||
and within the example (TSRun::RecordEvent)
|
||||
- Analysis is echoed to stdout, recorded in ts_scorers.out, and
|
||||
serialized in ts_scorers.json
|
||||
- Generates plots:
|
||||
"timemory-plotter -f ts_scorers.json -t "ThreadSafe Scorers" -o plots -e"
|
||||
- Uploads plots to CDash if enabled
|
||||
- Analysis is echoed to stdout and generates several output
|
||||
files in a folder based on the name of the executable. In
|
||||
general that folder will be "timemory-{name of executable}-output"
|
||||
|
||||
Reference in New Issue
Block a user