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

ImplictiEulerExtrapolation parallel #872

Merged
merged 2 commits into from
Aug 16, 2019

Conversation

saurabhkgp21
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Aug 14, 2019

Codecov Report

Merging #872 into master will decrease coverage by 0.02%.
The diff coverage is 61.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #872      +/-   ##
==========================================
- Coverage   80.16%   80.13%   -0.03%     
==========================================
  Files          92       92              
  Lines       30269    30289      +20     
==========================================
+ Hits        24265    24272       +7     
- Misses       6004     6017      +13
Impacted Files Coverage Δ
src/algorithms.jl 95% <100%> (ø) ⬆️
src/perform_step/extrapolation_perform_step.jl 76.14% <60%> (-0.86%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cd45039...a2695f5. Read the comment docs.

@codecov
Copy link

codecov bot commented Aug 14, 2019

Codecov Report

Merging #872 into master will decrease coverage by 0.04%.
The diff coverage is 72.34%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #872      +/-   ##
==========================================
- Coverage   80.16%   80.12%   -0.05%     
==========================================
  Files          92       92              
  Lines       30269    30328      +59     
==========================================
+ Hits        24265    24300      +35     
- Misses       6004     6028      +24
Impacted Files Coverage Δ
src/algorithms.jl 95% <100%> (ø) ⬆️
src/derivative_utils.jl 71.47% <35.29%> (-4.43%) ⬇️
src/caches/extrapolation_caches.jl 89.71% <89.47%> (+0.16%) ⬆️
src/perform_step/extrapolation_perform_step.jl 77.15% <95%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cd45039...62195d2. Read the comment docs.

@saurabhkgp21 saurabhkgp21 changed the title [WIP]: ImplictiEulerExtrapolation parallel ImplictiEulerExtrapolation parallel Aug 15, 2019
@@ -392,6 +392,57 @@ function calc_W!(integrator, cache::OrdinaryDiffEqMutableCache, dtgamma, repeat_
return nothing
end

function calc_W!(integrator, cache::OrdinaryDiffEqMutableCache, dtgamma, repeat_step, W_index::Int, W_transform=false)
@unpack t,dt,uprev,u,f,p = integrator
@unpack J,W = cache
Copy link
Member

Choose a reason for hiding this comment

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

this is just silly. Why not just pass in W into these routines? It would fix these problems.

Copy link
Member

Choose a reason for hiding this comment

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

@kanav99 @huanglangwen this is something we should follow up on. It's because our original calc_W! was never intended for thread-safety, and so to make it thread-safe there is this code duplication. We should assume this case can happen in the next refactor.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it mean calc_W! should have an additional parameter of readonly W ?

Copy link
Member

@ChrisRackauckas ChrisRackauckas Aug 16, 2019

Choose a reason for hiding this comment

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

it should have J and W I think, where it writes into W for a given J, instead of pulling them from the cache (since there may be more than 1)

Copy link
Contributor

Choose a reason for hiding this comment

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

But it won't work on OOP.

Copy link
Member

Choose a reason for hiding this comment

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

For OOP it will need to return W.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should have a pseudo-nlsolver kind of thing for algorithms which don't have an actual nlsolver like Rosenbrocks, the struct should have aliases to the J and W and similar stuff, should be <: NLSolver so that we have a common implementation of the functions. This way it won't make us change the original derivative utilities everytime we make a new algorithm just for an overload.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that algorithms with nlsolver struct are already well handled for parallel applications.

@ChrisRackauckas
Copy link
Member

I'll merge because this is correct, but it should become a lot cleaner. However, @kanav99 is going through the W calculations right now for DAEs, so he might want to handle that transition to passing in W instead of indexing it from a cache.

@ChrisRackauckas ChrisRackauckas merged commit 280bddd into SciML:master Aug 16, 2019
startIndex = (i==1) ? 1 : max_order
endIndex = (i==1) ? max_order-1 : max_order
for index in startIndex:endIndex
dt_temp = dt/(2^(index-1)) # Romberg sequence
Copy link
Member

Choose a reason for hiding this comment

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

why Romberg?

u_tmps = Array{typeof(u_tmp),1}(undef, Threads.nthreads())

for i=1:Threads.nthreads()
u_tmps[i] = zero(u_tmp)
Copy link
Member

Choose a reason for hiding this comment

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

one improvement that here is just to make the first ones in the arrays equal, i.e. u_tmps[1] = u_tmp. Then the algorithm would be fine. Right now you have an extra thing for each one, so you have an extra Jacobian, and that's really bad memory-wise.

@ChrisRackauckas
Copy link
Member

#875 explains the cache cleanup I was mentioning with some code.

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.

4 participants