-
Notifications
You must be signed in to change notification settings - Fork 2
Accelerate by 36,000x and organize #24
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This accelerates the test case by 36,000x and organizes it. The high level scripts are pulled out of `src` and coexist is made into a proper package (note: the name of the module should change because Julia module conventions have a capital in the front!). Then, a code generation scheme via ModelingToolkit is setup as the `dydt_generator.jl`, which results in a 36,000x acceleration of the ODE solve. To demonstrate caching I show that the generated code can be saved to a file and then is benchmarked in `pyjulia_benchmark.jl`. However, note that saving to a file isn't required (as the `dydt_generator.jl` doesn't use the file generated version at all), so generated fast forms can be used on the fly if needed. Note that ModelingToolkit doesn't seem to be totally needed here, you can get a good portion (but not all) of the speedup by preallocating buffers and rewriting the einsum expressions. However, this just demonstrates a way to use the code generators such that 0 work is required to get the optimal expressions. The function that is generated is in a sparse form so as the networks get larger the amount of acceleration should keep increasing as well. Note that the only "glut" in the system here is that the symbolic simplification for generating the fastest form of the function takes around 80 seconds. But this is unnecessary since most of the values are zeros. We should open an issue about this an invite @YingboMa and @shashi to the repo to take a look at some accelerated simplification tools for this case.
Collaborator
|
Thank you very much! 😄 |
Collaborator
Author
|
No, it's from generating a non-allocating dydt. |
YingboMa
reviewed
Jun 8, 2020
YingboMa
reviewed
Jun 8, 2020
YingboMa
reviewed
Jun 8, 2020
Contributor
YingboMa
left a comment
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.
Just a few stylistic comments.
Co-authored-by: Yingbo Ma <mayingbo5@gmail.com>
Co-authored-by: Yingbo Ma <mayingbo5@gmail.com>
ChrisRackauckas
commented
Jun 8, 2020
11 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This accelerates the test case by 36,000x and organizes it. The high level scripts are pulled out of
srcand coexist is made into a proper package (note: the name of the module should change because Julia module conventions have a capital in the front!). Then, a code generation scheme via ModelingToolkit is setup as thedydt_generator.jl, which results in a 36,000x acceleration of the ODE solve. To demonstrate caching I show that the generated code can be saved to a file and then is benchmarked inpyjulia_benchmark.jl. However, note that saving to a file isn't required (as thedydt_generator.jldoesn't use the file generated version at all), so generated fast forms can be used on the fly if needed.Note that ModelingToolkit doesn't seem to be totally needed here, you can get a good portion (but not all) of the speedup by preallocating buffers and rewriting the einsum expressions. However, this just demonstrates a way to use the code generators such that 0 work is required to get the optimal expressions. The function that is generated is in a sparse form so as the networks get larger the amount of acceleration should keep increasing as well.
Note that the only "glut" in the system here is that the symbolic simplification for generating the fastest form of the function takes around 80 seconds. But this is unnecessary since most of the values are zeros. We should open an issue about this an invite @YingboMa and @shashi to the repo to take a look at some accelerated simplification tools for this case.