-
-
Notifications
You must be signed in to change notification settings - Fork 283
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1250 +/- ##
==========================================
+ Coverage 91.27% 91.29% +0.01%
==========================================
Files 79 79
Lines 4127 4135 +8
Branches 360 360
==========================================
+ Hits 3767 3775 +8
Misses 270 270
Partials 90 90
Continue to review full report at Codecov.
|
Aw yeah, these are the speed improvements I wanted to see! 😀 Thanks @jtegedor ! Reviewing right now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with just one question 🚀
@@ -42,6 +43,7 @@ def change_a_inc(k, a_0, a_f, inc_0, inc_f, f): | |||
|
|||
V_0, beta_0_, _ = compute_parameters(k, a_0, a_f, inc_0, inc_f) | |||
|
|||
@jit(forceobj=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What error were you getting without forceobj=True
? I'm open to merge this as is and investigate later, but asking in case it's an easy fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the Numbat warning that appears without forceobj=True
:
/workspaces/poliastro/src/poliastro/twobody/thrust/change_a_inc.py:46: NumbaWarning:
Compilation is falling back to object mode WITH looplifting enabled because Function "a_d" failed type inference due to: Internal error at <numba.core.typeinfer.CallConstraint object at 0x7fc12d092280>.
tuple index out of range
During: resolving callee type: type(CPUDispatcher(<function beta at 0x7fc12df97550>))
During: typing of call at /workspaces/poliastro/src/poliastro/twobody/thrust/change_a_inc.py (52)
Enable logging at debug level for details.
File "src/poliastro/twobody/thrust/change_a_inc.py", line 52:
def a_d(t0, u_, k):
<source elided>
# Change sign of beta with the out-of-plane velocity
beta_ = beta(t0, V_0=V_0, f=f, beta_0=beta_0_) * np.sign(r[0] * (inc_f - inc_0))
^
@jit
tests/tests_twobody/test_thrust.py::test_leo_geo_numerical[0.49741883681838395]
/usr/local/lib/python3.8/site-packages/numba/core/object_mode_passes.py:151: NumbaWarning: Function "a_d" was compiled in object mode without forceobj=True.
File "src/poliastro/twobody/thrust/change_a_inc.py", line 47:
@jit
def a_d(t0, u_, k):
^
warnings.warn(errors.NumbaWarning(warn_msg,
tests/tests_twobody/test_thrust.py::test_leo_geo_numerical[0.49741883681838395]
/usr/local/lib/python3.8/site-packages/numba/core/object_mode_passes.py:161: NumbaDeprecationWarning:
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.
For more information visit https://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit
File "src/poliastro/twobody/thrust/change_a_inc.py", line 47:
@jit
def a_d(t0, u_, k):
^
I did not investigate further, any suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that's super weird.
It will take me some time to get to debugging this, but I don't want to block the pull request because of that. Let's merge it - it will save us a lot of testing time, and we can look at the numba error later.
This implements a recommendation from @astrojuanlu in #1076 to jit some functions on
trust.py
, which makes a significant speed improvement.Execution times of
test_thrust.py
test:Current (without jit):
New (with jit):