Dp/requested changes sparse - #2291
Conversation
Memory benchmark result| Test Name | %Δ | Master (MB) | PR (MB) | Δ (MB) | Time PR (s) | Time Master (s) |
| -------------------------------------- | ------------ | ------------------ | ------------------ | ------------ | ------------------ | ------------------ |
test_objective_jac_w7x | 0.04 % | 4.240e+03 | 4.242e+03 | 1.68 | 25.58 | 23.17 |
test_proximal_jac_w7x_with_eq_update | -0.86 % | 6.879e+03 | 6.819e+03 | -59.41 | 110.29 | 111.34 |
test_proximal_freeb_jac | -0.04 % | 1.354e+04 | 1.354e+04 | -4.91 | 71.49 | 69.57 |
test_proximal_freeb_jac_blocked | 0.43 % | 7.861e+03 | 7.896e+03 | 34.11 | 63.66 | 64.21 |
test_proximal_freeb_jac_batched | 0.24 % | 7.849e+03 | 7.867e+03 | 18.45 | 62.42 | 62.19 |
test_proximal_jac_ripple | 0.21 % | 3.773e+03 | 3.781e+03 | 7.98 | 41.33 | 40.46 |
test_proximal_jac_ripple_bounce1d | 0.56 % | 3.785e+02 | 3.806e+02 | 2.11 | 2.56 | 2.56 |
test_eq_solve | -1.48 % | 1.840e+03 | 1.813e+03 | -27.33 | 36.45 | 36.78 |
test_objective_quadratic_flux_jac | -0.41 % | 2.715e+03 | 2.704e+03 | -11.07 | 41.88 | 43.03 |For the memory plots, go to the summary of |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## ku/sparse_pullback #2291 +/- ##
======================================================
- Coverage 94.37% 94.35% -0.02%
======================================================
Files 101 101
Lines 28944 28953 +9
======================================================
+ Hits 27315 27319 +4
- Misses 1629 1634 +5
🚀 New features to boost your workflow:
|
|
|
|
|
||
| @staticmethod | ||
| def pitch_quad(min_B, max_B, num_pitch, **kwargs): | ||
| def get_pitch_inv_quad(min_B, max_B, num_pitch, simp=True): |
There was a problem hiding this comment.
@unalmis Was there a compelling reason to change the name to pitch_quad? If so, I can revert this and replace it with an alias to throw a deprecation warning about the new function name, like I did for regular_points -> bounce_points. But the original name get_pitch_inv_quad sounds more descriptive so I prefer keeping it.
There was a problem hiding this comment.
pitch_quad is shorter. get_pitch_inv_quad still works so there is no need to remove pitch_quad. What do you mean like you did for regular to bounce points? Those were private functions so you don't need deprecation
There was a problem hiding this comment.
OK I will keep it as get_pitch_inv_quad if you don't mind.
I mean like this change to throw a warning if you call the old function name. I know we don't really intend for users to call this directly, but it's still good practice and only a few lines of extra code that we can remove after a couple of releases have passed.
There was a problem hiding this comment.
Okay on the regular points thing but fyi the whole file is an underscore and there is a docstring at top of file that warns every method here is private and may change without notice.
There was a problem hiding this comment.
Just to clarify, in original PR get_pitch_inv_quad still works. Just pitch_quad is added as an option.
There was a problem hiding this comment.
Looks like there is some confusion that is causing some unnecessary deprecation warnings. Have marked those that should be reverted or excluded.
Also the two line change I added in downstream PR to not include a dummy argument in the docstring should be kept to avoid polluting an already complicated objective. As just a practical example of why that is also useful for developers, observe this PR reverts that change has introduced an inefficiency of allowing jac_chunk_size to be modified by the user. That will result in poor performance at no improvement. I recall I cached the Jacobin so doesn't matter.
|
|
||
| @staticmethod | ||
| def pitch_quad(min_B, max_B, num_pitch, **kwargs): | ||
| def get_pitch_inv_quad(min_B, max_B, num_pitch, simp=True): |
There was a problem hiding this comment.
simp is a private kwarg that should not be documented.
There was a problem hiding this comment.
We want to document all arguments, since the documentation is not just for users but also helpful for us developers to remember what things do.
There was a problem hiding this comment.
The intention is to always use simp unless user supplies their own quadrature in future. DESC has plenty of methods where some features are buried into kwargs to avoid polluting the signature, especially when those kwargs are unchaged in almost all cases.
There was a problem hiding this comment.
revert get_pitch_inv_quad to pitch_quad
| ) | ||
| bounce = Bounce1D(grid, data, check=True) | ||
| pitch_inv, _ = bounce.pitch_quad( | ||
| pitch_inv, _ = bounce.get_pitch_inv_quad( |
| # Exclude singularity not captured by analytic approximation for pitch near | ||
| # the maximum |B|. (This is captured by the numerical integration). | ||
| pitch_inv = Bounce1D.pitch_quad(np.min(B), np.max(B), 100, simp=False)[0][:-1] | ||
| pitch_inv = Bounce1D.get_pitch_inv_quad(np.min(B), np.max(B), 100, simp=False)[ |
| quad=chebgauss1(16), # this is our own custom chebgauss1 | ||
| ) | ||
| pitch_inv, _ = bounce.pitch_quad( | ||
| pitch_inv, _ = bounce.get_pitch_inv_quad( |
…o nufft_eps description
Yes I had misunderstood some things, thanks for the clarification. I now get that you were not introducing any breaking changes to the public API, but those changes should still be documented. Let's try to make some compromises to get this finished. I reverted my edits to the private functions and I'm fine with those changing. But we still want users to be warned about changes to the public API and those warnings can be removed later. Once you merge this PR we will merge #2170. |
|
These are not resolved and break code.
Please see second point on why the edits made here are counter to above statement. There is still incorrect understanding that those comments correct. |
@unalmis I put my requested changes in this PR pointing to yours, tests locally pass for test_integrals, test_objective_funs and test_compute_everything (paths where I thought warnings might pop up potentially), feel free to merge if you accept these change requests