Add eq_fixed option to BoundaryError - #2264
Conversation
Memory benchmark result| Test Name | %Δ | Master (MB) | PR (MB) | Δ (MB) | Time PR (s) | Time Master (s) |
| -------------------------------------- | ------------ | ------------------ | ------------------ | ------------ | ------------------ | ------------------ |
test_objective_jac_w7x | -2.08 % | 4.052e+03 | 3.968e+03 | -84.45 | 34.51 | 29.69 |
test_proximal_jac_w7x_with_eq_update | 1.11 % | 6.557e+03 | 6.630e+03 | 72.59 | 148.60 | 149.87 |
test_proximal_freeb_jac | 0.62 % | 1.335e+04 | 1.344e+04 | 82.69 | 86.16 | 85.60 |
test_proximal_freeb_jac_blocked | 0.08 % | 7.694e+03 | 7.700e+03 | 5.88 | 77.78 | 75.91 |
test_proximal_freeb_jac_batched | -0.18 % | 7.654e+03 | 7.640e+03 | -14.07 | 77.30 | 75.74 |
test_proximal_jac_ripple | -0.16 % | 3.562e+03 | 3.557e+03 | -5.64 | 52.49 | 52.28 |
test_proximal_jac_ripple_bounce1d | -1.25 % | 3.716e+03 | 3.670e+03 | -46.60 | 66.28 | 65.29 |
test_eq_solve | -0.84 % | 2.087e+03 | 2.070e+03 | -17.61 | 53.00 | 52.75 |
test_objective_quadratic_flux_jac | -0.35 % | 2.514e+03 | 2.506e+03 | -8.72 | 55.83 | 55.58 |For the memory plots, go to the summary of |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2264 +/- ##
=======================================
Coverage 94.35% 94.36%
=======================================
Files 101 101
Lines 28897 28930 +33
=======================================
+ Hits 27266 27300 +34
+ Misses 1631 1630 -1
🚀 New features to boost your workflow:
|
YigitElma
left a comment
There was a problem hiding this comment.
You can also add a test like test_toroidal_flux to check all paths run fine.
|
I think the reason tests are failing is that constants["field"] is a SumMagneticField and it expects a list for the params. So, the parameter assignment needs a bit more care. For this objective, field can be something like [MixedCoilSet(), ToroidalMagneticField()]. |
…it test accordingly.
…Control/DESC into ia/BoundaryError-eq_fixed to sync with master
YigitElma
left a comment
There was a problem hiding this comment.
About the formatting and linting check, if you run the following, they will happen automatically everytime you commit something.
pip install pre-commit
pre-commit install
These and some other useful instructions can be found on the Contributing Guide.
YigitElma
left a comment
There was a problem hiding this comment.
Note to other devs: The failing test is related to jax-finufft version 1.2.0 and not caused by this PR. We should solve that problem separetaly or wait CI to run that test on a different python version (which doesn't install jax-finufft 1.2.0)
Co-authored-by: Yigit Gunsur Elmacioglu <102380275+YigitElma@users.noreply.github.com>
…Control/DESC into ia/BoundaryError-eq_fixed
ddudt
left a comment
There was a problem hiding this comment.
I fixed the failing test, simplified the new tests, and edited some of the docstrings. This approval doesn't really count.
YigitElma
left a comment
There was a problem hiding this comment.
Other than the order of the operations, it looks good to me.
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_lowres | -1.73 +/- 4.40 | -1.51e-02 +/- 3.84e-02 | 8.59e-01 +/- 2.1e-02 | 8.74e-01 +/- 3.2e-02 |
test_equilibrium_init_lowres | -2.48 +/- 3.46 | -1.69e-01 +/- 2.35e-01 | 6.62e+00 +/- 1.3e-01 | 6.79e+00 +/- 2.0e-01 |
test_objective_compile_atf | -1.60 +/- 3.61 | -1.01e-01 +/- 2.27e-01 | 6.20e+00 +/- 1.7e-01 | 6.30e+00 +/- 1.5e-01 |
test_objective_compute_atf | -1.28 +/- 14.66 | -2.87e-05 +/- 3.29e-04 | 2.22e-03 +/- 2.3e-04 | 2.25e-03 +/- 2.4e-04 |
test_objective_jac_atf | -1.88 +/- 5.02 | -3.04e-02 +/- 8.15e-02 | 1.59e+00 +/- 6.8e-02 | 1.62e+00 +/- 4.5e-02 |
test_perturb_1 | -1.60 +/- 1.74 | -2.00e-01 +/- 2.17e-01 | 1.23e+01 +/- 1.6e-01 | 1.25e+01 +/- 1.5e-01 |
test_proximal_jac_atf | +0.02 +/- 2.30 | +1.25e-03 +/- 1.24e-01 | 5.39e+00 +/- 9.5e-02 | 5.39e+00 +/- 8.0e-02 |
test_proximal_freeb_compute | +1.28 +/- 2.73 | +2.12e-03 +/- 4.52e-03 | 1.68e-01 +/- 3.5e-03 | 1.66e-01 +/- 2.8e-03 |
test_solve_fixed_iter | +1.92 +/- 2.36 | +4.81e-01 +/- 5.91e-01 | 2.55e+01 +/- 4.9e-01 | 2.51e+01 +/- 3.4e-01 |
test_LinearConstraintProjection_build | +2.80 +/- 4.39 | +1.98e-01 +/- 3.10e-01 | 7.27e+00 +/- 2.0e-01 | 7.07e+00 +/- 2.4e-01 |
test_objective_compute_ripple | -0.82 +/- 4.42 | -1.97e-03 +/- 1.06e-02 | 2.39e-01 +/- 6.2e-03 | 2.41e-01 +/- 8.6e-03 |
test_objective_grad_ripple | -2.51 +/- 3.34 | -2.30e-02 +/- 3.07e-02 | 8.94e-01 +/- 2.8e-02 | 9.17e-01 +/- 1.2e-02 |
test_objective_quadratic_flux_compute | -1.57 +/- 10.95 | -8.19e-04 +/- 5.71e-03 | 5.13e-02 +/- 1.9e-03 | 5.21e-02 +/- 5.4e-03 |
test_build_transform_fft_midres | -1.85 +/- 5.70 | -1.31e-02 +/- 4.03e-02 | 6.95e-01 +/- 2.4e-02 | 7.08e-01 +/- 3.2e-02 |
test_build_transform_fft_highres | -1.38 +/- 3.25 | -1.29e-02 +/- 3.03e-02 | 9.19e-01 +/- 2.0e-02 | 9.32e-01 +/- 2.2e-02 |
test_equilibrium_init_medres | +4.51 +/- 3.99 | +2.55e-01 +/- 2.25e-01 | 5.90e+00 +/- 1.4e-01 | 5.65e+00 +/- 1.8e-01 |
test_objective_compile_dshape_current | +2.43 +/- 2.85 | +7.62e-02 +/- 8.97e-02 | 3.22e+00 +/- 5.7e-02 | 3.14e+00 +/- 6.9e-02 |
test_objective_compute_dshape_current | +15.60 +/- 6.56 | +7.24e-05 +/- 3.05e-05 | 5.37e-04 +/- 2.2e-05 | 4.64e-04 +/- 2.1e-05 |
test_objective_jac_dshape_current | +18.04 +/- 28.34 | +3.62e-03 +/- 5.68e-03 | 2.37e-02 +/- 4.6e-03 | 2.01e-02 +/- 3.3e-03 |
test_perturb_2 | +4.18 +/- 3.70 | +5.02e-01 +/- 4.45e-01 | 1.25e+01 +/- 4.4e-01 | 1.20e+01 +/- 6.9e-02 |
test_proximal_jac_atf_with_eq_update | -0.49 +/- 1.50 | -4.87e-02 +/- 1.50e-01 | 9.91e+00 +/- 1.1e-01 | 9.96e+00 +/- 1.0e-01 |
test_proximal_freeb_jac | +1.38 +/- 5.35 | +5.32e-02 +/- 2.07e-01 | 3.92e+00 +/- 2.0e-01 | 3.86e+00 +/- 5.5e-02 |
test_solve_fixed_iter_compiled | +0.91 +/- 2.17 | +4.46e-02 +/- 1.07e-01 | 4.96e+00 +/- 9.5e-02 | 4.92e+00 +/- 4.9e-02 |
test_objective_compute_ripple_bounce1d | +1.15 +/- 5.08 | +2.63e-03 +/- 1.16e-02 | 2.30e-01 +/- 6.8e-03 | 2.28e-01 +/- 9.4e-03 |
test_objective_grad_ripple_bounce1d | +1.36 +/- 2.63 | +1.06e-02 +/- 2.05e-02 | 7.89e-01 +/- 1.7e-02 | 7.79e-01 +/- 1.1e-02 |
test_objective_quadratic_flux_jac | -0.53 +/- 1.05 | -4.17e-02 +/- 8.28e-02 | 7.81e+00 +/- 3.9e-02 | 7.86e+00 +/- 7.3e-02 |Github CI performance can be noisy. When evaluating the benchmarks, developers should take this into account. |
YigitElma
left a comment
There was a problem hiding this comment.
There was just a merge conflict in CHANGELOG
…rrent calculation.
An option to remove the equilibrium as an optimizable DOF when computing BoundaryError is included.