Skip to content

Improving NSW MM Simulation speed

Francesco Giuseppe Gravili requested to merge fgravili/athena:nswSimSpeed into master

Another MR tackling the issue more effectively! As discussed in ATR-25528, the computation performed in MMT_Road::containsNeighbors function is the culprit.

As the calculation involves some hit properties and constants only, it was entirely moved to the MMT_Hit constructor. Then, the final value is retrieved in the aforementioned method, in order to avoid repeating the same thing over and over again.

Once that piece of code is removed, a few additional changes were done:

  • A MMT_Road unused private member was removed, as not needed anymore
  • Quantities are retrieved directly, instead of creating a temporary variable
  • Improved return statements in case of boolean functions

The following file was used for testing, 20 events in total to keep the processing fast:

/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data22_13p6TeV.00431885.physics_EnhancedBias.merge.RAW._lb0545._SFO-15._0001.1

The CPU time gain seems to be around 50% and it follows up the improvements from !59094 (merged). The comparison is shown below, before and after the changes:

-------- BEFORE
      flat  flat%   sum%        cum   cum%
    17.09s 33.47% 33.47%     22.22s 43.52%  MMT_Road::containsNeighbors
     3.04s  5.95% 39.42%      3.04s  5.95%  __libm_round_y8
     2.42s  4.74% 44.16%      2.43s  4.76%  MMT_Road::incrementAge
     2.21s  4.33% 48.49%      2.79s  5.46%  std::_Sp_counted_base::_M_release
     1.84s  3.60% 52.10%      1.84s  3.60%  MMT_Hit::isX
     1.58s  3.09% 55.19%      1.58s  3.09%  _init
     1.31s  2.57% 57.76%      1.31s  2.57%  diamond_t::diamond_t
     1.15s  2.25% 60.01%     23.42s 45.87%  MMT_Road::addHits
-------- AFTER
      flat  flat%   sum%        cum   cum%
     8.85s 25.37% 25.37%     11.59s 33.23%  MMT_Road::containsNeighbors
     1.72s  4.93% 30.30%      1.72s  4.93%  MMT_Hit::isX
     1.70s  4.87% 35.18%      1.70s  4.87%  _init
     1.59s  4.56% 39.74%      1.61s  4.62%  MMT_Road::incrementAge
     1.34s  3.84% 43.58%      2.72s  7.80%  MMT_Road::checkCoincidences
     1.28s  3.67% 47.25%     13.01s 37.30%  MMT_Road::addHits

A diff-root check was done on the output RDO files and no differences were found

./cc @vadamico

Edited by Francesco Giuseppe Gravili

Merge request reports