Skip to content
Snippets Groups Projects

Optimization of the Trigger menu generation in CA

Merged Francesca Pastore requested to merge fpastore/athena:CAoptim into 24.0

One more step of optimization of the menu generation with CA. The menu sequence creation is postponed during the Dataflow creation only when a new Step is found, so that their CAs are build only once. To allow this, the strategy is as follow:

  • in createDataflow() the step is stored in a CFGroup object, which also accumulates the information of all the chains that use that step, and build the CA only the first time it is found in the loop of chains (this happens in the CFGroup constructor). Any new chain that uses the same step just updates the chain information in the CFgroup (using addStepLeg()). This requires some changes in the order in which the dataflow connections and the hypo tools are made. There are possible optimisations in merging some of the classes (for example CFSequence and CFGroup), but this will happen in a second step. In this MR I tried to separate the responsibilities of the different classes
  • in addChainsToDataFlow() hypo tools of all the CFGroups are created
  • createControlFlow() remains unchanged
  • the ChainConfigs produced by the signatures are now “empty", because they contain ChanSteps that do not have CAs inside, just functions. For this reason they cannot be used in a later step, where the CFGroups are used instead (this is the reason of the change in getChainsForPrefetching )
  • This latter behaviour can be changed by replacing the steps in the ChainConfigs with reference to the corresponding step object on the CFGroup, which contains the sequences. But this is another possible optimization (not clear if this makes things more complex), also related to other changes in the ChainStep class for example.

Detailed changes:

  • Trigger/TrigAlgorithms/TrigGenericAlgs/python/TrigGenericAlgsConfig.py: changed due to the use of the CFSequence list instead of the Chain list. No change of behaviour
  • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/ControlFlow/HLTCFComponents.py:
    • removal of aliases in the CFSequence class and change of name Filter to FilterNode;
    • new class CFGroup to collect Filter+Step + list of chains/dictionaries linked to the step;
    • for each chain, CFGroup.addStepLeg() adds the chain legs to the list;
    • move some functionalities from CFSequence to CFGroup (for example createHypoTools and the connection between the filter and the step)
  • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/ControlFlow/HLTCFConfig.py:
    • remove obsolete createStepRecoNode and createCFTree;
    • new function addChainsToDataFlow() to handle the setting of the chains into the CF algorithms (no change of behaviour, only made it modular); for this reason createDataFlow() does not need dictionaries anymore;
    • in createDataFlow() the sequence CAs are created (chainStep.createSequences()) differently for the ‘fast’ and ‘slow’ menu generation: for each chain (slow) and only for the first chain (fast); no need to flag CA as merged (wasMerged()) for the fast generation
    • decisionTreeFromChains() now returns the CFGroup list (CF_list) which is used in other places;
    • createControlFlow() now uses CFGroups instead of CFSequences
  • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/ControlFlow/HLTCFDot.py: changes needed because or removal of aliases in the component classes
  • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/Utility/ChainMerging.py: remove obsolete noPrecedingStepsPreMerge and noPrecedingStepsPostMerge;
  • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/GenerateMenuMT.py: makeHLTTree now returning the CF_list to be passed to prefetchingInitialRoIConfig();
  • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/MenuComponents.py: clean-up of multiple createHypoTools() functions

With these changes:

Fast:menu generation of Dev_pp_run3_v1
real	5m14.445s
user	4m59.170s
sys	0m7.416s

Slow menu generation of Dev_pp_run3_v1

real	11m5.134s
user	10m41.054s
sys	0m14.160s

The confToo.py --diff of the HLTJobptions.json shows only two differences in the order of the chains included in the Prefetching, which is unavoidable because they are set based on a different filling. As far as I know, this is not critical in the algorithm, so I would accept it, but need experts to confirm ( @tamartin please can you confirm). Please see file attached diff

Edited by Francesca Pastore

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • This is an attempt (in old release, before the cleanup) to avoid running the sequences multiple times. My tests at that time didn’t show any time gain, but the code can be optimized now that the cleanup is completed. What it does:

    • the steps contain functools.partial(sequenceCfg), instead of the sequence, saved in step.sequenceFunctions, so when a step is created it does not create any CA
    • createDF: make a loop over chains to group the chains per same-step-sequence, so we can run each step only once
    • createDF: a second loop over the step-sequences to build the connections (DF)
    • createCF: create the steps CAs to be attached to the CF tree, through the new ChainStep.create() @classmethod to run the sequence functions

    Tagging @tbold and @fwinkl

  • That should have worked I would say. Maybe it needs to be retried now in cleaned up code? BTW. The changes here are too extensive to judge if there is some issue by chance that could have spoiled the benefit. I am a big fan of functional code but is has one drawback. When an error occurs we are usually missing the context and things are harder to debug. Maybe we could avoid that?

  • closed

  • yes, I did it first with muons only, but in order to check the full benefit you need a lot of different chains, so that's why I also modified the other signatures. This is just an example to check the functionalities. In any case it cannot be done ‘simply’ because the classes must change the behaviour, and even in this example I didn’t get rid of all cases. I don’t want this MR to go through, but just showing you what I tried in January

  • reopened

  • Francesca Pastore changed target branch from main to 24.0

    changed target branch from main to 24.0

  • Francesca Pastore added 1336 commits

    added 1336 commits

    Compare with previous version

  • Jenkins, please retry a build

  • Jenkins, please retry a build

  • Francesca Pastore resolved all threads

    resolved all threads

  • Francesca Pastore added 202 commits

    added 202 commits

    Compare with previous version

  • Jenkins please retry a build

  • This merge request affects 1 package:

    • Trigger/TriggerCommon/TriggerMenuMT

    This merge request affects 17 files:

    • Trigger/TriggerCommon/TriggerMenuMT/python/CFtest/EmuStepProcessingConfig.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/CFtest/generateCFChains.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/EventBuildingSequences.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/TLABuildingSequences.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/ChainConfigurationBase.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/ControlFlow/HLTCFComponents.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/ControlFlow/HLTCFConfig.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/GenerateMenuMT.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/GenerateMenuMT_newJO.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/MenuComponents.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/Utility/ChainMerging.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Jet/ExoticJetSequencesConfig.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Jet/JetMenuSequencesConfig.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Jet/JetTLASequenceConfig.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/MET/ConfigHelpers.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Muon/MuonMenuSequences.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Muon/MuonRecoSequences.py

    Adding @sutt ,@hrussell ,@cantel ,@lidiaz ,@fpastore ,@shanisch ,@jburr ,@khamano ,@miochoa ,@bcarlson as watchers

  • :x: CI Result FAILURE (hash 1aec0cc9)

    Athena
    externals :white_check_mark:
    cmake :white_check_mark:
    make :warning:
    tests :o:

    Full details available on this CI monitor view. Check the JIRA CI status board for known problems
    :warning: Athena: number of compilation errors 0, warnings 1
    :pencil: For experts only: Jenkins output [CI-MERGE-REQUEST-EL9 6087] (remote access info)

  • added 1 commit

    • 2d35ecc3 - more cleaning and fix merging

    Compare with previous version

  • Jenkins please retry a build

  • This merge request affects 1 package:

    • Trigger/TriggerCommon/TriggerMenuMT

    This merge request affects 15 files:

    • Trigger/TriggerCommon/TriggerMenuMT/python/CFtest/EmuStepProcessingConfig.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/CFtest/generateCFChains.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/EventBuildingSequences.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/TLABuildingSequences.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/ChainConfigurationBase.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/ControlFlow/HLTCFComponents.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/ControlFlow/HLTCFConfig.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/GenerateMenuMT.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/MenuComponents.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Config/Utility/ChainMerging.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Jet/ExoticJetSequencesConfig.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Jet/JetMenuSequencesConfig.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/MET/ConfigHelpers.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Muon/MuonMenuSequences.py
    • Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Muon/MuonRecoSequences.py

    Adding @shanisch ,@sutt ,@khamano ,@bcarlson ,@miochoa ,@jburr ,@hrussell ,@lidiaz ,@fpastore ,@cantel as watchers

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading