Skip to content
Snippets Groups Projects

[ATR-28716] Refactor Calo GPU flags

Merged [ATR-28716] Refactor Calo GPU flags
All threads resolved!
Merged Tim Martin requested to merge tamartin/athena:gpuFlagRefactor into main
All threads resolved!

Hello @damazio, @dossantn

Please could you check this proposed refactor of the Calo GPU flags.

  • Moved these to be a standard lazy-loaded flag subcategory.
  • Added an explicit "doGPU" subflag which defaults to False. Code which is configuring based on the flag container should check this instead of doing a hasFlag check (as flags should always be available in builds which include the package which supplies the module which defines the flags, in this case it is just the Athena build I think which builds the Calorimeter/CaloRecGPU package)
  • Moved non-trivial flag defaults to be computed via lambda functions, these will resolve when the flag is queried on the locked collection.
  • Checked that flags are not used before the container is locked.

If there are additional tests I can run beyond ctest without a GPU, let me know what these are too!

Merge request reports

Pipeline #6890353 passed

Pipeline passed for e0928057 on tamartin:gpuFlagRefactor

Approval is optional

Merged by Vakhtang TsulaiaVakhtang Tsulaia 1 year ago (Feb 14, 2024 7:20pm UTC)

Merge details

  • Changes merged into main with d510efc6 (commits were squashed).
  • Did not delete the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Tim Martin added 2 commits

    added 2 commits

    • 5e91bd65 - add flag subdomains
    • 205d30bc - Allow the path to be passed down to the generator function

    Compare with previous version

    • Author Developer
      Resolved by Tim Martin

      Hello @damazio & @dossantn

      Please find the MR updated following Denis' comments.

      In createFlagsCaloRecGPU you will now find that you can specify different named subdomains of flags, produced by a generator function

          flags.addFlagsCategory('CaloRecGPU.Default', _createSubFlagsCaloRecGPU, prefix=True)
          flags.addFlagsCategory('CaloRecGPU.LocalCalibration', _createSubFlagsCaloRecGPU, prefix=True)

      etc.

      You can also customise the default properties of the flags in the generator based on subdomain, e.g.

          defaultClusterOut = ''
          if path == 'CaloRecGPU.Default':
              defaultClusterOut = "CaloCalTopoClusters"
          elif path == 'CaloRecGPU.LocalCalibration':
              defaultClusterOut = "CaloTopoClusters"
      
          flags.addFlag('ClustersOutputName', defaultClusterOut)

      All of this remains lazy-loaded, if you put a print in the _createSubFlagsCaloRecGPU function you will see when it gets called if something needs to resolve a flag post-locking

      athena> from AthenaConfiguration.AllConfigFlags import initConfigFlags; flags = initConfigFlags()
      athena> flags.lock()
      athena> print(flags.CaloRecGPU.Default.ClustersOutputName)
      TimM: Lazy loading CaloRecGPU.Default
      CaloTopoClusters
      athena> print(flags.CaloRecGPU.LocalCalibration.ClustersOutputName)
      TimM: Lazy loading CaloRecGPU.LocalCalibration
      CaloCalTopoClusters

      Here we see the two flag subdomains being created only when we needed to read them, we see that they have different default values for ClustersOutputName

      They can still be set to explicit values pre-locking, and this will behave as expected too - with us only creating the subdomains which other code interacts with

      athena> from AthenaConfiguration.AllConfigFlags import initConfigFlags; flags = initConfigFlags()
      athena> flags.CaloRecGPU.Default.ClustersOutputName = "A"
      TimM: Lazy loading CaloRecGPU.Default
      athena> flags.CaloRecGPU.LocalCalibration.ClustersOutputName = "B"
      TimM: Lazy loading CaloRecGPU.LocalCalibration
      athena> flags.lock()
      athena> print(flags.CaloRecGPU.Default.ClustersOutputName)
      A
      athena> print(flags.CaloRecGPU.LocalCalibration.ClustersOutputName)
      B

      To ensure that some code up the call-stack has made an active decision as to which subdomain of flags should be used to configure a particular component, I suggest we copy the Trig ID domain and have everything read from an ActiveConfig subdomain.

      This doesn't exist by default, so the caller must call (for example) flagsActive = flags.cloneAndReplace("CaloRecGPU.ActiveConfig", "CaloRecGPU.Default") and then pass down flagsActive if the CA function being called is supposed to configure using the Default flag subdomain.

      How is this looking?

  • Tim Martin added 1 commit

    added 1 commit

    Compare with previous version

  • Tim Martin added 1 commit

    added 1 commit

    • 7380aa00 - reformulate how flag defaults are set

    Compare with previous version

  • Tim Martin added 1 commit

    added 1 commit

    • e0928057 - undo changes to AthConfigFlags

    Compare with previous version

  • Tim Martin marked this merge request as ready

    marked this merge request as ready

  • Author Developer

    Jenkins please retry a build

  • This merge request affects 3 packages:

    • Calorimeter/CaloRecGPU
    • Control/AthenaConfiguration
    • Trigger/TrigAlgorithms/TrigCaloRec

    Affected files list will not be printed in this case

    Adding @damazio ,@pavol ,@maszyman ,@dossantn ,@ssnyder ,@gemmeren as watchers

  • Tim Martin resolved all threads

    resolved all threads

  • This MR affects calorimeter reconstruction, not analysis model, so I am approving from AR side

    Giovanni (AR)

  • :white_check_mark: CI Result SUCCESS (hash e0928057)

    Athena AthSimulation AthGeneration AnalysisBase AthAnalysis
    externals :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
    cmake :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
    make :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
    tests :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:

    Full details available on this CI monitor view. Check the JIRA CI status board for known problems
    :white_check_mark: Athena: number of compilation errors 0, warnings 0
    :white_check_mark: AthSimulation: number of compilation errors 0, warnings 0
    :white_check_mark: AthGeneration: number of compilation errors 0, warnings 0
    :white_check_mark: AnalysisBase: number of compilation errors 0, warnings 0
    :white_check_mark: AthAnalysis: number of compilation errors 0, warnings 0
    :pencil: For experts only: Jenkins output [CI-MERGE-REQUEST-EL9 4544]

  • Lucy Lewitt
  • Lucy Lewitt
  • Mostly looks good, just a couple of comments to address. L1

  • Lucy Lewitt resolved all threads

    resolved all threads

  • Looks good to me. L1

    • Resolved by Denis Oliveira Damazio

      @tamartin, looking at your latest version, I realized that I do not understand what ActiveConfig really means. See, I thought it was something like a name that you used just to explain the exemples above to me, but I am not sure I get it in this context, in the middle of the name of a hierarchy tree and some of the flags themselves...

  • Denis Oliveira Damazio resolved all threads

    resolved all threads

  • Vakhtang Tsulaia mentioned in commit d510efc6

    mentioned in commit d510efc6

  • mentioned in merge request !69434 (merged)

  • Please register or sign in to reply
    Loading