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

AbstractSSAJumpAggregator interface #20

Merged
merged 12 commits into from
Apr 4, 2018

Conversation

alanderos91
Copy link
Contributor

I think everything we discussed is in place. Please feel free to suggest alternative names for the various functions and fields added.

This couples everything to an aggregator. One can overload these if desired.
Default to xorshifts to make simulation multithreading-safe.
The template can be re-used by other aggregators. Someday we should be able to use the generic routines pending: JuliaLang/julia#14919
@ChrisRackauckas
Copy link
Member

@isaacsas wanna take a look?

@@ -19,15 +19,16 @@ JumpProblem(prob,aggregator::AbstractAggregatorAlgorithm,jumps::AbstractJump...;
JumpProblem(prob,jumps::JumpSet;kwargs...) = JumpProblem(prob,NullAggregator(),jumps;kwargs...)

function JumpProblem(prob,aggregator::AbstractAggregatorAlgorithm,jumps::JumpSet;
save_positions = typeof(prob) <: AbstractDiscreteProblem ? (false,true) : (true,true))
save_positions = typeof(prob) <: AbstractDiscreteProblem ? (false,true) : (true,true),
rng = Xorshifts.Xoroshiro128Star(rand(UInt64)))
Copy link
Member

Choose a reason for hiding this comment

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

Let's use Xoroshiro128Plus. See the end of the chat which states it's not the same as the one in the post.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought Xoroshiro128Plus is claimed to fail particular test battery? I'm using Xoroshiro128Star.

Copy link
Member

Choose a reason for hiding this comment

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

No, XorShift128Plus, not Xoroshiro128Plus.

Copy link
Member

Choose a reason for hiding this comment

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

Just to clarify. The blog post found issues with Xoroshiro128Plus. It recommended as fine XorShift* 128/64. I haven't found any info about Xoroshiro128star.

Copy link
Member

Choose a reason for hiding this comment

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

Oh really? But then it passed all of the tests of the repo?

Copy link
Member

@isaacsas isaacsas Apr 4, 2018

Choose a reason for hiding this comment

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

It failed a different series of tests (newer I think) called PractRand, and another series called TestU01. These are different from the Big Crush tests (which are the most popular I think). I'm not an expert on these tests, so don't know the significance, but at least some people seem to feel that there are good generators that don't fail these tests that should be preferred. You can see the details on the blog post I linked back in the issue thread.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know enough to comment on this but can change as needed.

@ChrisRackauckas
Copy link
Member

Forgot to define the abstract type

rates = p.rates

@inbounds fill_cur_rates(u, params, t, cur_rates, 1, rates...)
@inbounds cur_rates[1] = cur_rates[1]
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary?

@codecov
Copy link

codecov bot commented Apr 4, 2018

Codecov Report

Merging #20 into master will decrease coverage by 0.34%.
The diff coverage is 97.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #20      +/-   ##
==========================================
- Coverage   78.73%   78.39%   -0.35%     
==========================================
  Files          13       14       +1     
  Lines         428      435       +7     
==========================================
+ Hits          337      341       +4     
- Misses         91       94       +3
Impacted Files Coverage Δ
src/DiffEqJump.jl 100% <ø> (ø) ⬆️
src/aggregators/direct.jl 100% <100%> (ø) ⬆️
src/aggregators/ssajump.jl 100% <100%> (ø)
src/problem.jl 68.57% <50%> (ø) ⬆️
src/coupling.jl 73.62% <0%> (-3.3%) ⬇️

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 cd4479e...0003134. Read the comment docs.

############################# Required Functions #############################

# creating the JumpAggregation structure
@inline function aggregate(aggregator::Direct, u, p, t, end_time, constant_jumps, save_positions, rng)
Copy link
Member

Choose a reason for hiding this comment

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

The inline here also seems unnecessary (it was present before but I don't see what good it can do here).

Copy link
Member

Choose a reason for hiding this comment

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

Yeah it's probably unnecessary.

@coveralls
Copy link

coveralls commented Apr 4, 2018

Coverage Status

Coverage decreased (-0.3%) to 78.391% when pulling 0003134 on alanderos91:master into cd4479e on JuliaDiffEq:master.

@isaacsas
Copy link
Member

isaacsas commented Apr 4, 2018

It looks good to me modulo the issue about Float64's in aggregate. This is the basic interface we discussed in the issue thread. I'll send through the mass action updates once this is in. Thanks @alanderos91!

function aggregate(aggregator::Direct, u, p, t, end_time, constant_jumps, save_positions, rng)
rates = ((c.rate for c in constant_jumps)...)
affects! = ((c.affect! for c in constant_jumps)...)
cur_rates = Vector{Float64}(length(rates))
Copy link
Member

Choose a reason for hiding this comment

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

Maybe instead of using Float64's here you should use typeof(t)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I'll hold off on pushing so I don't trigger so many builds...

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, sorry for the intermittent stream of comments there. I'm still getting used to looking at PRs on Github... That should be it from me -- I've gone through everything now.

Copy link
Member

Choose a reason for hiding this comment

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

Don't worry about triggering builds. It'll queue.

Copy link
Member

Choose a reason for hiding this comment

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

Note you can also add [ci-skip] to make it not queue a build for a commit.

@alanderos91
Copy link
Contributor Author

Fantastic. Many thanks to both you for all the help! 🎉

@ChrisRackauckas ChrisRackauckas merged commit 13df478 into SciML:master Apr 4, 2018
@ChrisRackauckas
Copy link
Member

Many thanks to you!

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