acts icon indicating copy to clipboard operation
acts copied to clipboard

refactor!: Decouple navigation and stepping

Open andiwand opened this issue 1 year ago • 3 comments

This is a proposal to decouple navigation from stepping by

  • changing the navigator interface to only consume its state and not the propagation state
  • providing position and direction as an input to the navigation
  • putting the Propagator in charge of communicating the target and estimated distance to the stepper

Originally I wanted the navigator to return the next step size but that clashes with the multi stepper. The current solution allows the stepper to judge on the step size given a surface. This allows the stepper to tweak the step size or to just take what the navigator proposed. In case of the multi stepper we will still just run intersections with the individual components.

The navigator is reduced to providing surface candidates and the surface status will be purely determined by the stepper. The propagator passes the information so the navigator knows when to switch surface / layer / volume.

Ultimately this removes all the templating from the navigator and the interface captures well what the navigator is supposed to do by having dedicated and visible I/O paths.

I only did this for Navigator, VoidNavigator, DirectNavigator for now to show case the changes and to see how this performs.

In case this is where we want to go I would like to do something similar to the steppers.

andiwand avatar Jul 27 '24 20:07 andiwand

📊: Physics performance monitoring for 1288d9ff725d1a71d345066eb3d1a5cd6e3356ef

Full contents

physmon summary

github-actions[bot] avatar Jul 28 '24 11:07 github-actions[bot]

The current version avoids double intersection while approaching the target which result in CPU performance improvements. Interestingly this is only pronounced for Fatras and quite suppressed for the CKF

image

image

andiwand avatar Aug 21 '24 14:08 andiwand

Walkthrough

Significant changes to navigation and propagation systems in ACTS, there are. Restructuring of navigator classes, method signatures, and state management, we observe. Removal of redundant variables, addition of new methods for target resolution, and streamlining of initialization processes, the modifications encompass. A comprehensive refactoring of navigation logic across multiple components, this represents.

Changes

File Change Summary
Core/include/Acts/Navigation/... Navigator classes updated with new initialization, state management, and target resolution methods
Core/include/Acts/Propagator/... Stepper and navigator interfaces modified, new NavigationTarget struct introduced
Core/src/Propagator/... Error handling and category updates to reflect new navigation logic
Tests/... Test cases adjusted to align with new navigation and propagation interfaces

Possibly related PRs

  • #3986: The changes in this PR involve modifications to the DetectorNavigator class, specifically in the handling of step sizes and surface status updates, which are relevant to the changes made in the DetectorNavigator class in the main PR.
  • #3987: This PR refactors the AtlasStepper class, including changes to the State struct and its initialization, which aligns with the modifications made to the State struct in the main PR.
  • #3984: The removal of the NavigationBreakAborter and its associated functionality in this PR simplifies the actor list, which may relate to the overall navigation logic being streamlined in the main PR.

Suggested Labels

automerge

Suggested Reviewers

  • paulgessinger

Poem

Navigators dance, steppers glide,
Through volumes vast, with physics pride.
Targets found, paths refined,
ACTS refactors, code intertwined! 🚀🧭

Finishing Touches

  • [ ] 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Nov 16 '24 10:11 coderabbitai[bot]

Probably makes my life easier implementing a Gen3 navigator

paulgessinger avatar Nov 16 '24 11:11 paulgessinger

:white_check_mark: Athena integration test results [f060123b034411791d6c94a419acb2799f85297a]

:white_check_mark: All tests successful

status job report
:green_circle: report_pull_request
:green_circle: run_workflow_tests_run4_mc
:green_circle: run_workflow_tests_run2_mc
:green_circle: run_workflow_tests_run2_data
:green_circle: run_workflow_tests_run3_mc
:green_circle: run_workflow_tests_run3_data
:green_circle: test_ActsDumpGeometryIdentifiers
:green_circle: test_ActsCheckObjectCountsWorkflowHgtd
:green_circle: test_ActsCheckObjectCountsCachedWorkflow
:green_circle: test_ActsCheckObjectCountsWorkflow
:green_circle: test_ActsEFTrackFit
:green_circle: test_ActsPersistifySeeds
:green_circle: test_ActsBenchmarkWithSpot
:green_circle: test_ActsAnalogueClustering
:green_circle: test_ActsWorkflowHeavyIons
:green_circle: test_ActsWorkflowFastTracking
:green_circle: test_ActsWorkflowCached
:green_circle: test_ActsWorkflow
:green_circle: test_ActsValidateAmbiguityResolution
:green_circle: test_ActsValidateResolvedTracks
:green_circle: test_ActsValidateTracks
:green_circle: test_ActsValidateActsCoreSpacePoints
:green_circle: test_ActsValidateActsSpacePoints
:green_circle: test_ActsValidateSeeds
:green_circle: test_ActsValidateOrthogonalSeeds
:green_circle: test_ActsValidateClusters
:green_circle: test_ActsPersistifyEDM
:green_circle: test_ActsGx2fRefitting
:green_circle: test_ActsGSFRefitting
:green_circle: test_ActsKfRefitting
:green_circle: test_ActsExtrapolationAlgTest
:green_circle: test_ActsITkTest

acts-project-service avatar Nov 25 '24 20:11 acts-project-service

After discussion with @andiwand:

  • Change the -1 sentinel int to an std::optional<std::size_t>
  • Stage::noTarget -> Stage::initial
  • Disambiguate NavigationTarget::invalid and checkTargetValid: valid does not mean the same thing currently.

paulgessinger avatar Dec 13 '24 09:12 paulgessinger

The stepper options changes escalated a bit and I failed to put this in a different commit. The changes could be factorized into the following

  • [x] GSF actor / aborter https://github.com/acts-project/acts/pull/3984
  • [x] Stepper update signature and constrained step rename https://github.com/acts-project/acts/pull/3986
  • [x] Stepper option handling https://github.com/acts-project/acts/pull/3987
  • [x] CKF / KF path length aborter https://github.com/acts-project/acts/pull/3985
  • [x] Actual navigator refactor https://github.com/acts-project/acts/pull/3449

andiwand avatar Dec 13 '24 14:12 andiwand

Add navigator concept

andiwand avatar Dec 14 '24 14:12 andiwand

GSF is producing some new errors after this change https://github.com/acts-project/acts/actions/runs/12711434053/job/35435102207?pr=3449

needs some investigation

andiwand avatar Jan 10 '25 15:01 andiwand

With https://github.com/acts-project/acts/pull/3449/commits/cf2b28aa8f0cec124833d3b2184cca6fe367fd22 I am trying to work around an FPE that popped up in the GSF.

We already checked for std::isfinite which might come from a previous treatment of the FPE without monitoring. So I thought I can just prevent it by checking directly on detR.

What do you think about that handling @benjaminhuth @paulgessinger?

andiwand avatar Jan 15 '25 11:01 andiwand

Let's go 🚀

paulgessinger avatar Jan 15 '25 12:01 paulgessinger