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

PowerSeriesProfile and JAX #1040

Open
tmqian opened this issue May 31, 2024 · 5 comments
Open

PowerSeriesProfile and JAX #1040

tmqian opened this issue May 31, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@tmqian
Copy link
Collaborator

tmqian commented May 31, 2024

Eq.h5 files with pressure saved as a PowerSeriesProfile crash when running eq.solve()

Attaching error report. This issue can be circumvented by switching to SplineProfile. Dario has also seen it and suspects it is related to a recent jax update.

@tmqian
Copy link
Collaborator Author

tmqian commented May 31, 2024

Building objective: force
Precomputing transforms
Timer: Precomputing transforms = 2.39 sec
Timer: Objective build = 5.94 sec
Building objective: lcfs R
Building objective: lcfs Z
Building objective: fixed Psi
Building objective: fixed pressure
Building objective: fixed iota
Building objective: fixed sheet current
Building objective: self_consistency R
Building objective: self_consistency Z
Building objective: lambda gauge
Building objective: axis R self consistency
Building objective: axis Z self consistency
Timer: Objective build = 2.74 sec
Timer: Linear constraint projection build = 9.10 sec
Number of parameters: 2347
Number of objectives: 14112
Starting optimization
Using method: lsq-exact
Traceback (most recent call last):
  File "/pscratch/sd/t/tqian/t3d-test/wgi-desc/desc-driver.py", line 18, in <module>
    eq.solve(verbose=3)
  File "/global/u2/t/tqian/CODE/DESC/desc/equilibrium/equilibrium.py", line 1894, in solve
    things, result = optimizer.optimize(
                     ^^^^^^^^^^^^^^^^^^^
  File "/global/u2/t/tqian/CODE/DESC/desc/optimize/optimizer.py", line 305, in optimize
    result = optimizers[method]["fun"](
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u2/t/tqian/CODE/DESC/desc/optimize/_desc_wrappers.py", line 270, in _optimize_desc_least_squares
    result = lsqtr(
             ^^^^^^
  File "/global/u2/t/tqian/CODE/DESC/desc/optimize/least_squares.py", line 173, in lsqtr
    f = fun(x, *args)
        ^^^^^^^^^^^^^
  File "/global/u2/t/tqian/CODE/DESC/desc/optimize/_constraint_wrappers.py", line 224, in compute_scaled_error
    f = self._objective.compute_scaled_error(x, constants)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u2/t/tqian/CODE/DESC/desc/objectives/objective_funs.py", line 312, in compute_scaled_error
    [
  File "/global/u2/t/tqian/CODE/DESC/desc/objectives/objective_funs.py", line 313, in <listcomp>
    obj.compute_scaled_error(*par, constants=const)
  File "/global/u2/t/tqian/CODE/DESC/desc/objectives/objective_funs.py", line 952, in compute_scaled_error
    f = self.compute(*args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u2/t/tqian/CODE/DESC/desc/objectives/_equilibrium.py", line 177, in compute
    data = compute_fun(
           ^^^^^^^^^^^^
  File "/global/u2/t/tqian/CODE/DESC/desc/compute/utils.py", line 118, in _compute
    data = _compute(
           ^^^^^^^^^
  File "/global/u2/t/tqian/CODE/DESC/desc/compute/utils.py", line 140, in _compute
    data = data_index[parameterization][name]["fun"](
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u2/t/tqian/CODE/DESC/desc/compute/_profiles.py", line 442, in _p_r
    data["p_r"] = profiles["pressure"].compute(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u2/t/tqian/CODE/DESC/desc/profiles.py", line 651, in compute
    if self.sym:
  File "/global/homes/t/tqian/.conda/envs/t3d-dev/lib/python3.11/site-packages/jax/_src/errors.py", line 522, in __init__
    f"{tracer._origin_msg()}")
       ^^^^^^^^^^^^^^^^^^^^
IndexError: list index out of range
--------------------
For simplicity, JAX has removed its internal frames from the traceback of the following exception. Set JAX_TRACEBACK_FILTERING=off to include these.

@f0uriest
Copy link
Member

f0uriest commented Jun 1, 2024

I think this might be related to the python bool vs bumpy bool think Daniel was working on in #1030

@unalmis unalmis mentioned this issue Jun 18, 2024
@dpanici
Copy link
Collaborator

dpanici commented Jun 25, 2024

@tmqian Is this resolved now that #1030 is merged into master?

@dpanici dpanici added the bug Something isn't working label Jun 25, 2024
@dpanici
Copy link
Collaborator

dpanici commented Jul 23, 2024

@tmqian is this resolved now? If not, can you send a MWE where you save an eq and then find that loading and resolving causes an issue?

@dpanici
Copy link
Collaborator

dpanici commented Aug 20, 2024

@tmqian bump on this, is it resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants