Project

General

Profile

Geant4 EM Physics Code Review Weekly Phone Meeting

Meeting

Date: December 13, 2013 at 10.00 AM US CDT (Fermilab local time)
Place: 1-866-740-1260 (ReadyTalk line) (Host : Krzysztof)

Participants:

Krzysztof Genser
Soon Yung Jun

Discussion

(Summary by Krzysztof)

Soon has profiled Geant4 10, here is the link to the top page:
https://oink.fnal.gov/perfanalysis/g4p

(the csv files are "siblings" to the "leaf count" pages: prof_big_functions_leaf_count_list_01.html pages)

Krzysztof and Soon looked at the G4UrbanMscModel code and some simple profiler call
graphs related to 50 GeV electrons trying to understand where the cache misses may
occur and where the CPU may be consumed the most.
The top functions are:

G4UrbanMscModel::SampleCosineTheta(double, double) 0.0158996
G4UrbanMscModel::ComputeTruePathLengthLimit(G4Track const&, double&) 0.0110354
G4UrbanMscModel::ComputeGeomPathLength(double) 0.008404
G4UrbanMscModel::SampleDisplacement() 0.0052334
G4UrbanMscModel::SampleScattering(CLHEP::Hep3Vector const&, double) 0.0044305
G4UrbanMscModel::StartTracking(G4Track*) 0.0036511
G4UrbanMscModel::ComputeTheta0(double, double) 0.0025610
G4UrbanMscModel::LatCorrelation() 0.0019105
G4UrbanMscModel::SimpleScattering(double, double) 0.0015296
G4UrbanMscModel::ComputeTrueStepLength(double) 0.0004688

G4PhysicsVector::Value() is called quite often according to the call graphs
although not present in the class code itself.
(G4UrbanMscModel inherits from G4VMscModel which is a G4VEmModel)
G4UrbanMscModel::ComputeTruePathLengthLimit with called by it ComputeGeomPathLength contribute
about 20% of time spent in G4PhysicsVector::Value()
We also noted calls to CLHEP::MTwistEngine::flat()

Several smaller functions
void G4UrbanMscModel::StartTracking(G4Track* track)
G4double G4UrbanMscModel::SimpleScattering(G4double xmeanth,G4double x2meanth)
G4double G4UrbanMscModel::SampleDisplacement()
G4double G4UrbanMscModel::LatCorrelation()
may be candidates for inlining

(a side comment: given the large fraction of time spent in G4PhysicsVector::Value() of 6-9%
it may be worth revisiting the helper class G4xyd mentioned at
this meeting)

Krzysztof will continue to look at G4UrbanMscModel and related classes.
Soon will look at G4VMultipleScatteringProcess classes.

Next meeting: December 20th