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

Towards Common Perform step #717

Closed
wants to merge 6 commits into from
Closed

Towards Common Perform step #717

wants to merge 6 commits into from

Conversation

kanav99
Copy link
Contributor

@kanav99 kanav99 commented Apr 13, 2019

This is a very rough implementation for common perform step for SSPRK22 and SSPRK33, which I am expanding to more algorithms.
This implementation is not at all feasible to be merged as it allocates in constant cache. I am learning the metaprogramming in Julia to know what all is possible for us.
Ideas I am thinking:

  1. Make a custom @unpack which if an entry is not found in the object, assigns some specific default value. Like if c0 doesn't exist in cache, it should be set to 1.0.

@@ -34,7 +51,28 @@ alg_cache(alg::SSPRK22,u,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTyp
step_limiter!::StepLimiter
end

struct SSPRK33ConstantCache <: OrdinaryDiffEqConstantCache end
Copy link
Member

Choose a reason for hiding this comment

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

you can probably make this cache and the previous the same?

Copy link
Member

Choose a reason for hiding this comment

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

we need to be careful about the ones that have a different interpolation though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah we can have same caches but different constructors (I mean using inheritence).

@kanav99
Copy link
Contributor Author

kanav99 commented Apr 13, 2019

Shifting to SArrays makes us very close to our previous performance stats, atleast for this small script:

using BenchmarkTools, OrdinaryDiffEq
f(u,p,t) = 1.01*u
u0=1/2
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)
@btime sol = solve(prob,SSPRK33(),reltol=1e-8,abstol=1e-8,dt=0.01)

Master:

  15.479 μs (170 allocations: 15.48 KiB)

PR:

  15.690 μs (171 allocations: 15.75 KiB)

@ChrisRackauckas
Copy link
Member

ChrisRackauckas commented Apr 13, 2019

Switch broadcasts to @.. #716

@ChrisRackauckas
Copy link
Member

Ref: #233

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.

2 participants