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

Update rules for chunking jacobian #1283

Merged
merged 10 commits into from
Oct 8, 2024
Merged

Update rules for chunking jacobian #1283

merged 10 commits into from
Oct 8, 2024

Conversation

f0uriest
Copy link
Member

Resolves #1276

Copy link
Contributor

github-actions bot commented Oct 1, 2024

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_lowres         |     -6.71 +/- 9.21     | -3.89e-02 +/- 5.33e-02 |  5.40e-01 +/- 5.0e-02  |  5.79e-01 +/- 2.0e-02  |
 test_equilibrium_init_medres            |     -5.99 +/- 6.32     | -2.72e-01 +/- 2.87e-01 |  4.27e+00 +/- 2.5e-01  |  4.54e+00 +/- 1.4e-01  |
 test_equilibrium_init_highres           |     +2.35 +/- 6.90     | +1.33e-01 +/- 3.88e-01 |  5.76e+00 +/- 3.5e-01  |  5.63e+00 +/- 1.8e-01  |
 test_objective_compile_dshape_current   |     +0.25 +/- 3.23     | +9.99e-03 +/- 1.28e-01 |  3.95e+00 +/- 1.1e-01  |  3.94e+00 +/- 7.2e-02  |
 test_objective_compute_dshape_current   |     -6.47 +/- 5.27     | -2.53e-04 +/- 2.06e-04 |  3.66e-03 +/- 7.4e-05  |  3.91e-03 +/- 1.9e-04  |
 test_objective_jac_dshape_current       |     +0.17 +/- 5.77     | +7.48e-05 +/- 2.47e-03 |  4.29e-02 +/- 2.0e-03  |  4.28e-02 +/- 1.4e-03  |
 test_perturb_2                          |     -2.39 +/- 8.42     | -4.56e-01 +/- 1.61e+00 |  1.86e+01 +/- 1.6e+00  |  1.91e+01 +/- 2.9e-01  |
 test_proximal_freeb_jac                 |     -0.80 +/- 2.60     | -6.18e-02 +/- 2.00e-01 |  7.63e+00 +/- 9.5e-02  |  7.70e+00 +/- 1.8e-01  |
 test_solve_fixed_iter                   |     -0.31 +/- 59.29    | -1.59e-02 +/- 3.08e+00 |  5.17e+00 +/- 2.2e+00  |  5.19e+00 +/- 2.2e+00  |
 test_build_transform_fft_midres         |     -0.18 +/- 2.24     | -1.09e-03 +/- 1.38e-02 |  6.15e-01 +/- 8.9e-03  |  6.16e-01 +/- 1.1e-02  |
 test_build_transform_fft_highres        |     +0.67 +/- 3.24     | +6.78e-03 +/- 3.28e-02 |  1.02e+00 +/- 3.2e-02  |  1.01e+00 +/- 8.1e-03  |
 test_equilibrium_init_lowres            |     +0.52 +/- 2.34     | +1.99e-02 +/- 9.01e-02 |  3.87e+00 +/- 8.7e-02  |  3.85e+00 +/- 2.2e-02  |
 test_objective_compile_atf              |     +1.52 +/- 3.80     | +1.19e-01 +/- 2.99e-01 |  7.97e+00 +/- 1.9e-01  |  7.85e+00 +/- 2.3e-01  |
 test_objective_compute_atf              |     -0.28 +/- 3.26     | -2.99e-05 +/- 3.46e-04 |  1.06e-02 +/- 2.0e-04  |  1.06e-02 +/- 2.8e-04  |
 test_objective_jac_atf                  |     -0.62 +/- 3.01     | -1.21e-02 +/- 5.86e-02 |  1.94e+00 +/- 3.9e-02  |  1.95e+00 +/- 4.4e-02  |
 test_perturb_1                          |     +0.94 +/- 2.00     | +1.19e-01 +/- 2.53e-01 |  1.28e+01 +/- 1.6e-01  |  1.27e+01 +/- 2.0e-01  |
 test_proximal_jac_atf                   |     +0.08 +/- 0.66     | +6.64e-03 +/- 5.37e-02 |  8.17e+00 +/- 3.8e-02  |  8.16e+00 +/- 3.8e-02  |
 test_proximal_freeb_compute             |     -0.51 +/- 1.29     | -9.46e-04 +/- 2.37e-03 |  1.83e-01 +/- 1.2e-03  |  1.84e-01 +/- 2.0e-03  |

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.47%. Comparing base (f0bf028) to head (5ab0a7c).
Report is 1874 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1283   +/-   ##
=======================================
  Coverage   95.47%   95.47%           
=======================================
  Files          96       96           
  Lines       23896    23899    +3     
=======================================
+ Hits        22814    22817    +3     
  Misses       1082     1082           
Files with missing lines Coverage Δ
desc/objectives/getters.py 95.12% <100.00%> (+0.06%) ⬆️
desc/objectives/objective_funs.py 94.75% <100.00%> (+0.01%) ⬆️

@f0uriest f0uriest requested review from a team, rahulgaur104, ddudt, dpanici, kianorr, sinaatalay, unalmis and YigitElma and removed request for a team October 2, 2024 01:39
Copy link
Collaborator

@dpanici dpanici left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should put a note in the docstring of _Objective of what "auto" for jac_chunk_size does now (uses a conservative heuristic estimate based on problem size)

@f0uriest
Copy link
Member Author

f0uriest commented Oct 3, 2024

Should put a note in the docstring of _Objective of what "auto" for jac_chunk_size does now (uses a conservative heuristic estimate based on problem size)

"auto" is still only an option for ObjectiveFunction, not _Objective so I don't think it makes sense to describe it there.

sub_obj_jac_chunk_sizes_are_ints = [
isposint(obj._jac_chunk_size) for obj in self.objectives
]
errorif(
any(sub_obj_jac_chunk_sizes_are_ints) and self._deriv_mode != "blocked",
any(sub_obj_jac_chunk_sizes_are_ints) and self._deriv_mode == "batched",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is again a design choice but let's say I have a single objective,

objective = ObjectiveFunction(ForceBalance(eq, jac_chunk_size))

This may complicate the logic but could we add something like errorif( ..... and not len(self._objectives) == 1) ?

Some other edge case could be giving same jac_chunk_size to each objective, which should be allowed but I don't think anyone wanna use it that way, it is more laborious...

@f0uriest f0uriest merged commit 62e82f4 into master Oct 8, 2024
24 checks passed
@dpanici dpanici deleted the rc/chunking branch October 8, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Objective deriv_mode using thing.dim_x results in different Jacobian size
3 participants