-
Notifications
You must be signed in to change notification settings - Fork 10
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
Performance of (+,-,*,/)(::TaylorScalar,::Number)
: easy short path ?
#25
Conversation
Codecov ReportBase: 86.44% // Head: 86.81% // Increases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #25 +/- ##
==========================================
+ Coverage 86.44% 86.81% +0.36%
==========================================
Files 5 5
Lines 214 220 +6
==========================================
+ Hits 185 191 +6
Misses 29 29
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Thanks for your contribution. Yes I agree this will be a lot more efficient, I just haven't got a chance to address that. If you take a look at our continuous benchmark page (on the page, navigate to your branch first), you will notice that the performance for single variable Taylor expansion case improved a lot. There is a caveat, though: the performance for PINN regressed. That's because Zygote is too weak to infer type through your |
I'm sorry i cleaned up the work and forced-pushed onto my branch, so if you want to pickup from there you can of course. Edit : Yes indeed your benchmarks shows a nice improvement ! This is super cool stuff you got there with these benchmarks btw, having them real time on PRs and brnahces is neat ! |
Yeah that is build up on PkgBenchmark.jl and my own little frontend, still WIP and buggy but feel free to take a look and play around |
Hey I added convenience functions to be able to multiply and/or divide TaylorScalar{T,N}'s with different Ts. This was missing and is very helpfull for me. Indeed, I need to derivate through TaylorScalar's machinery: So I end up with types of the form Btw, is there a |
Instead of tuple slicing, you can use |
Thanks @ToucheSir , that sounds like a quick fix, maybe @lrnv try that? |
And regarding your
|
BTW, you can use |
Changing slicing to tail didn't fix the problem... I need to take a closer look next week |
Hey sorry i did not catch up on your responses, i did not see them... |
I will be working on this during the summer, however with a different approach. I am currently adding chunking support to this package like ForwardDiff.jl, something like this struct TaylorScalar{V, N, K}
primal::V
partials::NTuple{K, NTuple{N, V}}
end where K is the order, and N is the chunk size as in ForwardDiff.jl. Based on this, we have easy access to the primal value via |
Thanks for feedback @tansongchen. For me the real issue is #61 and until this is dealt with I cannot switch from TaylorSeries.jl to TaylorDiff.jl to benefit from the (already better) performance, let alone think of even better perf from this PR.. |
closed in favor of #81 |
Hey,
The current implementation of
*(::TaylorScalar,::Number)
in your package promotes the scalar to a TaylorScalar as so :and then uses the full blown multiplication of taylorScalars:
Although very general and elegant, this seems super wasteful as a bunch of multiplications by 0 will occur and still take runtime.
and so a specific function would be nice. Same thing occurs for +,-,/ if i read your code correclty.
As i am not well versed in the @eval shananigans, the code I produced is quite ugly and has non-ncessary loops, but I could not fix that myself ;)
Please tell me what you think, I got a 40% speedup in my application with this.