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

Properly optimize Julia code #68

Open
JordiBolibar opened this issue Oct 10, 2022 · 3 comments
Open

Properly optimize Julia code #68

JordiBolibar opened this issue Oct 10, 2022 · 3 comments
Assignees
Labels
performance Improve code performance

Comments

@JordiBolibar
Copy link
Member

JordiBolibar commented Oct 10, 2022

After some discussions in the Julia Discourse regarding Float64 vs Float32, some adjustments should be made to the code in order to avoid some performance pitfalls. Those are:

  • Move all code back to Float64. Apparently, unless one is using GPUs, there's no benefit on that for CPUs.
  • Use Int in exponents (e.g. in the flow law). See explanations in Discourse.
  • Avoid memory allocation in util functions following example in iceflow_sandbox model.
@JordiBolibar
Copy link
Member Author

Partially implemented in SIA!. There are still some operations remaining for which the pre-initialized size of the matrices needs to be adjusted. This is not urgent for the scientific applications, so to be updated later on.

This could be a good task for Lucille in her internship to optimize the SIA in a forward model.

@JordiBolibar
Copy link
Member Author

More optimizations have been implemented. There are still quite a lot of memory allocations, though. Removing almost all of them would results in a relatively unreadable code, and it would imply passing even more initialized context matrices to SIA!().

To be discussed if it's worth it.

@JordiBolibar
Copy link
Member Author

JordiBolibar commented Jun 7, 2023

This still requires a bit more work. Once we have some time, we should perform a proper code optimization following this: https://viralinstruction.com/posts/optimise/.

Another really important optimization will come from making all parameters local, following #36

@JordiBolibar JordiBolibar changed the title Move back to Float64 and other performance tricks Properly optimize Julia code Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Improve code performance
Projects
None yet
Development

No branches or pull requests

1 participant