Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Remove quick math helpers #3701

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

andiwand
Copy link
Contributor

@andiwand andiwand commented Oct 9, 2024

This has proven not to be useful as std math functions are not really a bottleneck in our current code. I propose to remove them here. If they become useful in the future we can just bring them back from here.

@andiwand andiwand added this to the next milestone Oct 9, 2024
@github-actions github-actions bot added the Component - Core Affects the Core module label Oct 9, 2024
Copy link

github-actions bot commented Oct 9, 2024

📊: Physics performance monitoring for 79c853f

Full contents

physmon summary

Copy link

sonarcloud bot commented Oct 9, 2024

@kodiakhq kodiakhq bot merged commit e6400b6 into acts-project:main Oct 9, 2024
46 checks passed
@github-actions github-actions bot removed the automerge label Oct 9, 2024
@andiwand andiwand deleted the remove-quick-math branch October 9, 2024 08:08
@acts-project-service acts-project-service added the Fails Athena tests This PR causes a failure in the Athena tests label Oct 9, 2024
kodiakhq bot pushed a commit that referenced this pull request Oct 10, 2024
Replace `std::hypot` with `std::sqrt` in a couple of occasions in Core. This is numerically less accurate but much faster which is preferable for seeding and propagation.

blocked by
- #3701

---

This pull request focuses on optimizing mathematical calculations by replacing `std::hypot` with more efficient alternatives like `std::sqrt` and `Eigen`'s `norm` method. These changes aim to improve performance and maintain code consistency across various files.

Mathematical Optimization:

* [`Core/include/Acts/EventData/GenericFreeTrackParameters.hpp`](diffhunk://#diff-35a3d07a1eb05110c620e3cdbc38968456e66270c9f9460472f49e65d8b43acdL157-R162): Replaced `std::hypot` with `std::sqrt` for calculating `transverseMagnitude` and `magnitude`.
* [`Core/include/Acts/Propagator/EigenStepperDenseExtension.hpp`](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL111-R111): Replaced multiple instances of `std::hypot` with `std::sqrt` for various calculations, including `tKi`, `dtp1dl`, `dtp2dl`, `dtp3dl`, `dtp4dl`, and `energy`. [[1]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL111-R111) [[2]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL125-R125) [[3]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL170-R179) [[4]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL335-R359) [[5]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL379-R385) [[6]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL433-R439)
* [`Core/include/Acts/Propagator/StraightLineStepper.hpp`](diffhunk://#diff-15c3275a0d5f03483637d29160965a5e05496a788223d9e20f8b3ef225617c8aL338-R341): Replaced `std::hypot` with `std::sqrt` for calculating `dtds` and `prop_state.stepping.derivative`. [[1]](diffhunk://#diff-15c3275a0d5f03483637d29160965a5e05496a788223d9e20f8b3ef225617c8aL338-R341) [[2]](diffhunk://#diff-15c3275a0d5f03483637d29160965a5e05496a788223d9e20f8b3ef225617c8aL427-R428)
* [`Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp`](diffhunk://#diff-1d63df6364bcd57d6eae717e4c8dea355f07a36f5fca41b0e9fefdbf3224c0a0L245-R249): Replaced `std::hypot` with `std::sqrt` for calculating `invTanTheta` and `qOverPt`. [[1]](diffhunk://#diff-1d63df6364bcd57d6eae717e4c8dea355f07a36f5fca41b0e9fefdbf3224c0a0L245-R249) [[2]](diffhunk://#diff-1d63df6364bcd57d6eae717e4c8dea355f07a36f5fca41b0e9fefdbf3224c0a0L280-R279)
* [`Core/include/Acts/Utilities/VectorHelpers.hpp`](diffhunk://#diff-451e964d88f3d2d27ff239dade951924824ee73f885ef4044b5cea0861bfba40L76-R76): Replaced `std::hypot` with `Eigen`'s `norm` method for calculating the perpendicular distance.

Additional changes include similar optimizations in other files to ensure consistency and performance improvements across the codebase.
@paulgessinger paulgessinger modified the milestones: next, v37.1.0 Oct 16, 2024
Rosie-Hasan pushed a commit to Rosie-Hasan/acts that referenced this pull request Nov 13, 2024
This has proven not to be useful as `std` math functions are not really a bottleneck in our current code. I propose to remove them here. If they become useful in the future we can just bring them back from here.
Rosie-Hasan pushed a commit to Rosie-Hasan/acts that referenced this pull request Nov 13, 2024
Replace `std::hypot` with `std::sqrt` in a couple of occasions in Core. This is numerically less accurate but much faster which is preferable for seeding and propagation.

blocked by
- acts-project#3701

---

This pull request focuses on optimizing mathematical calculations by replacing `std::hypot` with more efficient alternatives like `std::sqrt` and `Eigen`'s `norm` method. These changes aim to improve performance and maintain code consistency across various files.

Mathematical Optimization:

* [`Core/include/Acts/EventData/GenericFreeTrackParameters.hpp`](diffhunk://#diff-35a3d07a1eb05110c620e3cdbc38968456e66270c9f9460472f49e65d8b43acdL157-R162): Replaced `std::hypot` with `std::sqrt` for calculating `transverseMagnitude` and `magnitude`.
* [`Core/include/Acts/Propagator/EigenStepperDenseExtension.hpp`](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL111-R111): Replaced multiple instances of `std::hypot` with `std::sqrt` for various calculations, including `tKi`, `dtp1dl`, `dtp2dl`, `dtp3dl`, `dtp4dl`, and `energy`. [[1]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL111-R111) [[2]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL125-R125) [[3]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL170-R179) [[4]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL335-R359) [[5]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL379-R385) [[6]](diffhunk://#diff-3f30fd6031431b17dcd4e580cd73c202210417e80738cbcc76003b413be13c8dL433-R439)
* [`Core/include/Acts/Propagator/StraightLineStepper.hpp`](diffhunk://#diff-15c3275a0d5f03483637d29160965a5e05496a788223d9e20f8b3ef225617c8aL338-R341): Replaced `std::hypot` with `std::sqrt` for calculating `dtds` and `prop_state.stepping.derivative`. [[1]](diffhunk://#diff-15c3275a0d5f03483637d29160965a5e05496a788223d9e20f8b3ef225617c8aL338-R341) [[2]](diffhunk://#diff-15c3275a0d5f03483637d29160965a5e05496a788223d9e20f8b3ef225617c8aL427-R428)
* [`Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp`](diffhunk://#diff-1d63df6364bcd57d6eae717e4c8dea355f07a36f5fca41b0e9fefdbf3224c0a0L245-R249): Replaced `std::hypot` with `std::sqrt` for calculating `invTanTheta` and `qOverPt`. [[1]](diffhunk://#diff-1d63df6364bcd57d6eae717e4c8dea355f07a36f5fca41b0e9fefdbf3224c0a0L245-R249) [[2]](diffhunk://#diff-1d63df6364bcd57d6eae717e4c8dea355f07a36f5fca41b0e9fefdbf3224c0a0L280-R279)
* [`Core/include/Acts/Utilities/VectorHelpers.hpp`](diffhunk://#diff-451e964d88f3d2d27ff239dade951924824ee73f885ef4044b5cea0861bfba40L76-R76): Replaced `std::hypot` with `Eigen`'s `norm` method for calculating the perpendicular distance.

Additional changes include similar optimizations in other files to ensure consistency and performance improvements across the codebase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Core Affects the Core module Fails Athena tests This PR causes a failure in the Athena tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants