Standard g4 uboone - LArSoft/larsoft_docs GitHub Wiki
Purpose: standard Geant4 simulation of a MC event
Package: ubfcl
Full path: g4/standard_g4_uboone.fcl (as seen in: v2_0_1)
Input: any generated event (single particle, Genie, CRYβ¦) [TBC]
In larsoft version v1_00_03 (before fixing the photon table memory leak), the most demanding parts (tested on 36 events), using callgrind:
-
deflatealgorithm (libz.so): [ 11.5%, ~10 calls/event] used when writing ROOT branches; the only way to speed it up is to have a fasterlibz.so(and one might pay in disk space) -
malloc(libc) [ 6.0%, 4G calls, vianew]: about 80% of them come fromstd::stringand/or the message facility -
free(libc) [ 2.5%, 4G calls, viadelete]: mirror ofmalloc
All this fuss about the message facility hints to a non-optimized version of that library.
There is /some/ impact from the unnecessary use of new in larsim/LArg4/OpFastScintillator.cc.
The access to G4MaterialPropertiesTable also takes some toll. Maybe it can be optimized by not using string indices.
Some other timing information:
| function | calls | time (%) |
|---|---|---|
larg4::LArG4::produce |
36 | 70.7% |
mf::LogDebug::LogDebug |
110M | 40.7% |
I think this is enough alreadyβ¦
Resolution: disabled the debugging messages dispatch when in production builds, by defining ML_NDEBUG symbol (see issue #5589).
Specific input files cause the standard G4 job to be killed in the grid.
The memory limit is 4GB (2GB of real memory + 2GB of swap).
Some peaks of memory have been identified and flattened by using prehemptive vector memory allocation (std::vector::reserve).
The memory footprint remains very large. The following table mixes results with different runs, most based on prodgenie_bnb_nue_cosmic_3window_uboone_15313320_49_gen.root, an input file whose grid job crashed at
| Requester | amount | source of this information |
|---|---|---|
| total | ~3.5 GB | O.S. VSIZE, sampled 0.1Hz |
| total heap | ~2.5 GB | massif peak (complete heap) |
| * dynamic library loading? | 640 MB | massif peak (complete heap) |
β art::RootDictionaryManager |
185 MB | massif peak (complete heap) |
β art::ServicesManager |
159 MB | massif peak (complete heap) |
| β untrackable | 226 MB | massif peak (complete heap) |
| β untrackable | 226 MB | massif peak (complete heap) |
* mmap |
1.7 GB | massif peak (complete heap) |
| 1.7 GB | massif peak |
|
β TBuffer::Expand |
540 GB | massif peak (complete heap) |
| 700 GB | massif peak |
|
β larg4::OpFastScintillation::RecordPhotonsProduced |
220 GB | massif peak (complete heap) |
| 325 GB | massif peak |
|
β larg4::LArG4:produce and SimPhotons.h |
150 GB | massif peak (complete heap) |
| 235 GB | massif peak |
|
β phot::PhotonLibrary::LoadLibraryFromFile |
325 GB | massif peak (complete heap) |
| 300 GB | massif peak |
|
β strings from larg4::ParticleListAction::PreTrackingAction |
35 GB | massif peak (complete heap) |
β larg4::ParticleListAction::SteppingAction |
25 GB | massif peak (complete heap) |
β binary trees (std::map?) |
85 GB | massif peak (complete heap) |
β larg4::LArG4:produce (simb::MCParticle vector) |
67 GB | massif peak |
β ROOT (via TStorage::ObjectAlloc) |
25 GB | massif peak |
| * stack(s) | <1 MB | massif |