-
Notifications
You must be signed in to change notification settings - Fork 40
New inverse stream map to accelerate convergence #1919
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
base: master
Are you sure you want to change the base?
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Memory benchmark result| Test Name | %Δ | Master (MB) | PR (MB) | Δ (MB) | Time PR (s) | Time Master (s) |
| -------------------------------------- | ------------ | ------------------ | ------------------ | ------------ | ------------------ | ------------------ |
test_objective_jac_w7x | 6.51 % | 3.800e+03 | 4.047e+03 | 247.31 | 38.06 | 36.25 |
test_proximal_jac_w7x_with_eq_update | -1.44 % | 6.580e+03 | 6.485e+03 | -94.96 | 161.29 | 161.18 |
test_proximal_freeb_jac | -0.16 % | 1.319e+04 | 1.317e+04 | -20.81 | 85.46 | 86.87 |
test_proximal_freeb_jac_blocked | -0.28 % | 7.488e+03 | 7.467e+03 | -20.79 | 74.62 | 72.81 |
test_proximal_freeb_jac_batched | -0.20 % | 7.456e+03 | 7.441e+03 | -14.63 | 73.70 | 73.32 |
test_proximal_jac_ripple | -3.65 % | 3.596e+03 | 3.465e+03 | -131.35 | 65.10 | 65.80 |
test_proximal_jac_ripple_bounce1d | -2.47 % | 3.615e+03 | 3.526e+03 | -89.21 | 79.18 | 76.65 |
test_eq_solve | -0.58 % | 2.007e+03 | 1.995e+03 | -11.73 | 94.18 | 94.70 |For the memory plots, go to the summary of |
a6d949b to
d685405
Compare
| """ | ||
| in_axes, argnums = _parse_in_axes(in_axes) | ||
| if isinstance(argnums, int): |
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.
duplicate code
| @register_compute_fun( | ||
| name="(J^theta_PEST_p)|PEST", | ||
| label="\\partial_{\\phi}|_{\\rho, \\vartheta} J^{\\theta_{PEST}}", | ||
| label="\\partial_{\\phi}|_{\\rho, \\vartheta} J^{\\vartheta}", |
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.
the latex label used to have both vartheta and theta pest which is confusing in plots.
| @register_compute_fun( | ||
| name="(J^theta_PEST_v)|PEST", | ||
| label="\\partial_{\\vartheta} J^{\\theta_{PEST}}", | ||
| label="\\partial_{\\vartheta}|_{\\rho, \\phi} J^{\\vartheta}", |
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.
see above
| @partial(jit, static_argnames=["tol", "maxiter"]) | ||
| def _map_clebsch_coordinates( | ||
| @partial(jit, static_argnames=["inbasis", "outbasis", "tol", "maxiter"]) | ||
| def _map_poloidal_coordinates( |
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 a private method so we are free to make changes as we please. slowly pushing it to be more like eq.map_coordinates but it's not quite the same because it takes advantage of the 1D mesh grid nature of problem
Inverse stream maps
Yparameter for Heliotron (NFP=19) in effective ripple tutorial #1928 and increases default objective resolution forY_B.Other performance improvements
low_rammode which is same speed and less memory forobjective.compute, but slower forobjective.gradsince JAX is poor at iterative algorithms.Gamma_cetc. switched from second to third order method (becomes fourth order if sufficiently smooth). The idea is even though it is not smooth in the pitch angle in the continuous limit at the bifurcations, the way we discretize the bounce integrals should smooth these bifurcations to some extent, so use of a third order method will not be damaging.Usability
kwargsas was needed for my article.interpax#1388.Bugs
test_compute_everything.interp_to_argminfor Bounce1D if grid had negative zeta values.Benchmarks
Just go to #2026 and run
effective_ripple_profile.py. You will see the large performance improvement frommaster. The CI benchmarks do not reveal this because those benchmarks are essentially just noise. Note that, using the same parameter inputs, the resolution of this branch is also higher thanmasterdue to the faster convergence.use_bounce1d=Trueon that script, you will run out of memory as expected since it is an inferior approach (as expected, you get the OOM in the jacobian before you compute a single bounce integral).nufft_eps=0, you need 175 GB to run that script onmaster(you'll get an OOM and JAX will tell you it needs 175GB), but only 35 GB on this branch.Examples
HELIOTRON
MasterbranchThis branch
W7-X
MasterbranchThis branch
NCSX
MasterbranchThis branch
Removal of spectral aliasing