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

Spatial ssa support #663

Closed
wants to merge 138 commits into from
Closed
Changes from 40 commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
0d32835
Begin tests
TorkelE May 4, 2023
8256e21
Reupload everything
TorkelE May 4, 2023
2355316
add graph imports
TorkelE May 4, 2023
ef14e79
Start preparing tests
TorkelE May 4, 2023
5f34876
test updates
TorkelE May 5, 2023
e64f67f
update tests
TorkelE May 5, 2023
d91ee2b
test fix
TorkelE May 5, 2023
0d58d6c
update
TorkelE Jun 28, 2023
99273d0
test update
TorkelE Jun 29, 2023
63cfb97
formating
TorkelE Jun 29, 2023
7db52c4
change time requirements
TorkelE Jun 29, 2023
9594396
use SIR test
TorkelE Jun 29, 2023
573791c
update
TorkelE Jun 29, 2023
22436ca
update
TorkelE Jun 30, 2023
e42f131
More tests
TorkelE Jun 30, 2023
be32b6c
test improvement
TorkelE Jul 2, 2023
305dcf2
add a test
TorkelE Jul 2, 2023
a08b3b3
update and more tests
TorkelE Jul 2, 2023
9764b2a
format
TorkelE Jul 2, 2023
3ac33cc
internal test update
TorkelE Jul 2, 2023
22e2164
fix
TorkelE Jul 2, 2023
435bbd6
updaye
TorkelE Jul 3, 2023
0b6c577
add test and fixes
TorkelE Jul 3, 2023
6878684
format
TorkelE Jul 3, 2023
40ef2d9
remove old file
TorkelE Jul 4, 2023
c12ed86
Comment out timing tests
TorkelE Jul 6, 2023
62956d6
Enable symbolics in diffusion reactions
TorkelE Jul 6, 2023
10e1e17
format
TorkelE Jul 6, 2023
11e4e5e
small fix
TorkelE Jul 6, 2023
cca2b4e
remove BenchmarkTools test dependency
TorkelE Jul 13, 2023
0df5cee
use Num's everywhere
TorkelE Aug 1, 2023
845d5b6
update
TorkelE Aug 1, 2023
5e9c2dc
use sym properly
TorkelE Aug 2, 2023
e30e768
add test
TorkelE Aug 2, 2023
59f92b4
another update
TorkelE Aug 2, 2023
587d00e
update
TorkelE Aug 2, 2023
aaf3559
Internal revamp and spatial jump support
TorkelE Aug 12, 2023
c672cef
Add spatial tests.
TorkelE Aug 12, 2023
3e50e74
format
TorkelE Aug 12, 2023
74f4042
format
TorkelE Aug 12, 2023
dbded65
test fix
TorkelE Aug 12, 2023
74cf628
Remove Jump Stuff
TorkelE Aug 13, 2023
3bfb270
fix
TorkelE Aug 13, 2023
a502fee
fix
TorkelE Aug 13, 2023
a8b5580
test update
TorkelE Aug 13, 2023
8e768dc
Merge branch 'master' of https://github.com/SciML/Catalyst.jl into la…
TorkelE Aug 14, 2023
83808fb
Spatial Jump Implementation
TorkelE Aug 27, 2023
cddc9fb
test update
TorkelE Aug 27, 2023
3bb908e
test update
TorkelE Aug 27, 2023
a5f58bf
Spatial tests file reordering
TorkelE Aug 27, 2023
3ac5d38
testupdate
TorkelE Aug 27, 2023
0891dc1
testupdate
TorkelE Aug 27, 2023
5d9e129
Fix stableRNG usage
TorkelE Sep 2, 2023
cefc59e
Update src/lattice_reaction_system_diffusion.jl
TorkelE Sep 2, 2023
5a3c09c
add ABC test and reset make_majumps
TorkelE Sep 2, 2023
e0d7f3f
remove tests for future functionality
TorkelE Sep 2, 2023
fa91011
explanatory note
TorkelE Sep 3, 2023
fb5977f
Drop formatting changes in `compound.jl`.
Vilin97 Sep 3, 2023
f00289c
use functors
TorkelE Sep 3, 2023
7a60c19
functor update
TorkelE Sep 3, 2023
8fb32c7
Fix test.
Vilin97 Sep 3, 2023
1cdd23f
Construct massaction jumps without building a `JumpProblem`.
Vilin97 Sep 4, 2023
cbb2dbd
Fix comment.
Vilin97 Sep 4, 2023
f910f92
revamp test and start SplitApplyCombine removal
TorkelE Sep 11, 2023
7eafc0d
fix broadcasting issue
TorkelE Sep 11, 2023
66408ec
reorder files.
TorkelE Sep 11, 2023
eb79f66
Move spatial reactions to separate file
TorkelE Sep 11, 2023
11507b5
wip
TorkelE Sep 11, 2023
0b7a426
updates
TorkelE Sep 12, 2023
e5ef053
Finish LatticeReactionSystem revamp
TorkelE Sep 12, 2023
e46e1ad
redo test networks
TorkelE Sep 12, 2023
ee755a2
LatticeReactionSystem revamp
TorkelE Sep 12, 2023
3bc52f7
test updates
TorkelE Sep 13, 2023
f9607c2
More tests
TorkelE Sep 13, 2023
19c9a67
Remove SplitApplyCombine dependency
TorkelE Sep 13, 2023
146d90a
More tests
TorkelE Sep 13, 2023
2219ece
fix
TorkelE Sep 13, 2023
b7831fb
Additional tests
TorkelE Sep 15, 2023
09a8584
Update performance benchmarks (not run, by saved in repo)
TorkelE Sep 15, 2023
a2f8088
Spatial Jump Implementation
TorkelE Aug 27, 2023
1d187db
Spatial tests file reordering
TorkelE Aug 27, 2023
11734ef
testupdate
TorkelE Aug 27, 2023
cc370ea
testupdate
TorkelE Aug 27, 2023
bcee84e
Fix stableRNG usage
TorkelE Sep 2, 2023
4558d0d
Update src/lattice_reaction_system_diffusion.jl
TorkelE Sep 2, 2023
cfe5f88
add ABC test and reset make_majumps
TorkelE Sep 2, 2023
e1cd568
remove tests for future functionality
TorkelE Sep 2, 2023
c6776fc
explanatory note
TorkelE Sep 3, 2023
abc2b7d
Drop formatting changes in `compound.jl`.
Vilin97 Sep 3, 2023
3af9d6f
Fix test.
Vilin97 Sep 3, 2023
7aee979
Construct massaction jumps without building a `JumpProblem`.
Vilin97 Sep 4, 2023
0109d62
Fix comment.
Vilin97 Sep 4, 2023
dc983bb
Make spatial SSA part up to date.
TorkelE Sep 15, 2023
ab75e6f
Merge remote-tracking branch 'origin/spatial_SSA_support' into spatia…
TorkelE Sep 15, 2023
5e6191a
update
TorkelE Sep 16, 2023
dde4ee9
update
TorkelE Sep 16, 2023
27daaf9
up
TorkelE Sep 16, 2023
c43e2c1
test testing
TorkelE Sep 16, 2023
7cccf7b
test test
TorkelE Sep 16, 2023
bbcb06d
test update
TorkelE Sep 16, 2023
ea24729
test testing
TorkelE Sep 16, 2023
0d4da1a
fix
TorkelE Sep 16, 2023
83e1f27
test update
TorkelE Sep 16, 2023
89965e2
Split of utility function and handle un-directed graph input properly
TorkelE Sep 17, 2023
619589f
Test fix
TorkelE Sep 17, 2023
6550e97
fix
TorkelE Sep 17, 2023
03f7f20
update history file.
TorkelE Sep 17, 2023
60794af
Spatial Jump Implementation
TorkelE Aug 27, 2023
bc6952f
Spatial tests file reordering
TorkelE Aug 27, 2023
2c4efc0
testupdate
TorkelE Aug 27, 2023
1758ae3
testupdate
TorkelE Aug 27, 2023
7cbbcf7
Fix stableRNG usage
TorkelE Sep 2, 2023
724136d
add ABC test and reset make_majumps
TorkelE Sep 2, 2023
3ec45e5
remove tests for future functionality
TorkelE Sep 2, 2023
57a5028
Drop formatting changes in `compound.jl`.
Vilin97 Sep 3, 2023
dae6e04
Fix test.
Vilin97 Sep 3, 2023
9928608
Spatial Jump Implementation
TorkelE Aug 27, 2023
9da5f31
Fix stableRNG usage
TorkelE Sep 2, 2023
fb52503
Update src/lattice_reaction_system_diffusion.jl
TorkelE Sep 2, 2023
2ade53f
add ABC test and reset make_majumps
TorkelE Sep 2, 2023
9a0d403
explanatory note
TorkelE Sep 3, 2023
381262f
Drop formatting changes in `compound.jl`.
Vilin97 Sep 3, 2023
024fd0d
Construct massaction jumps without building a `JumpProblem`.
Vilin97 Sep 4, 2023
0f865ed
Fix comment.
Vilin97 Sep 4, 2023
b2a5732
Make spatial SSA part up to date.
TorkelE Sep 15, 2023
abd7bf4
update
TorkelE Sep 16, 2023
00d917e
update
TorkelE Sep 16, 2023
2831fd3
up
TorkelE Sep 16, 2023
197cd23
test testing
TorkelE Sep 16, 2023
5f01557
test test
TorkelE Sep 16, 2023
76fd25c
test update
TorkelE Sep 16, 2023
2454f48
test testing
TorkelE Sep 16, 2023
89c1e0e
fix
TorkelE Sep 16, 2023
87f7ccc
test update
TorkelE Sep 16, 2023
fa50613
Merge remote-tracking branch 'origin/spatial_SSA_support' into spatia…
TorkelE Sep 20, 2023
b282002
mereg
TorkelE Sep 20, 2023
8f5b10f
fix merge
TorkelE Sep 20, 2023
92cdc84
update history file
TorkelE Sep 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
# Not actually run in CI, but useful for reference of ODE simulation performance across updates.

### Preparations ###

# Fetch packages.
using OrdinaryDiffEq
using Random, Statistics, SparseArrays, Test

# Fetch test networks.
include("../spatial_test_networks.jl")

### Runtime Checks ###
# Current timings are taken from the SciML CI server.
# Current not used, simply here for reference.
# Useful when attempting to optimise workflow.

# using BenchmarkTools
# runtime_reduction_margin = 10.0

# Small grid, small, non-stiff, system.
let
lrs = LatticeReactionSystem(SIR_system, SIR_srs_2, small_2d_grid)
u0 = [:S => 990.0, :I => 20.0 * rand_v_vals(lrs.lattice), :R => 0.0]
pV = SIR_p
pE = [:dS => 0.01, :dI => 0.01, :dR => 0.01]
oprob = ODEProblem(lrs, u0, (0.0, 500.0), (pV, pE); jac = false)
@test SciMLBase.successful_retcode(solve(oprob, Tsit5()))

runtime_target = 0.00060
runtime = minimum((@benchmark solve($oprob, Tsit5())).times) / 1000000000
println("Small grid, small, non-stiff, system. Runtime: $(runtime), previous standard: $(runtime_target)")
@test runtime < runtime_reduction_margin * runtime_target
end

# Large grid, small, non-stiff, system.
let
lrs = LatticeReactionSystem(SIR_system, SIR_srs_2, large_2d_grid)
u0 = [:S => 990.0, :I => 20.0 * rand_v_vals(lrs.lattice), :R => 0.0]
pV = SIR_p
pE = [:dS => 0.01, :dI => 0.01, :dR => 0.01]
oprob = ODEProblem(lrs, u0, (0.0, 500.0), (pV, pE); jac = false)
@test SciMLBase.successful_retcode(solve(oprob, Tsit5()))

runtime_target = 0.26
runtime = minimum((@benchmark solve($oprob, Tsit5())).times) / 1000000000
println("Large grid, small, non-stiff, system. Runtime: $(runtime), previous standard: $(runtime_target)")
@test runtime < runtime_reduction_margin * runtime_target
end

# Small grid, small, stiff, system.

let
lrs = LatticeReactionSystem(brusselator_system, brusselator_srs_1, small_2d_grid)
u0 = [:X => rand_v_vals(lrs.lattice, 10), :Y => rand_v_vals(lrs.lattice, 10)]
pV = brusselator_p
pE = [:dX => 0.2]
oprob = ODEProblem(lrs, u0, (0.0, 100.0), (pV, pE))
@test SciMLBase.successful_retcode(solve(oprob, QNDF()))

runtime_target = 0.17
runtime = minimum((@benchmark solve($oprob, QNDF())).times) / 1000000000
println("Small grid, small, stiff, system. Runtime: $(runtime), previous standard: $(runtime_target)")
@test runtime < runtime_reduction_margin * runtime_target
end

# Medium grid, small, stiff, system.
let
lrs = LatticeReactionSystem(brusselator_system, brusselator_srs_1, medium_2d_grid)
u0 = [:X => rand_v_vals(lrs.lattice, 10), :Y => rand_v_vals(lrs.lattice, 10)]
pV = brusselator_p
pE = [:dX => 0.2]
oprob = ODEProblem(lrs, u0, (0.0, 100.0), (pV, pE))
@test SciMLBase.successful_retcode(solve(oprob, QNDF()))

runtime_target = 2.3
runtime = minimum((@benchmark solve($oprob, QNDF())).times) / 1000000000
println("Medium grid, small, stiff, system. Runtime: $(runtime), previous standard: $(runtime_target)")
@test runtime < runtime_reduction_margin * runtime_target
end

# Large grid, small, stiff, system.
let
lrs = LatticeReactionSystem(brusselator_system, brusselator_srs_1, large_2d_grid)
u0 = [:X => rand_v_vals(lrs.lattice, 10), :Y => rand_v_vals(lrs.lattice, 10)]
pV = brusselator_p
pE = [:dX => 0.2]
oprob = ODEProblem(lrs, u0, (0.0, 100.0), (pV, pE))
@test SciMLBase.successful_retcode(solve(oprob, QNDF()))

runtime_target = 170.0
runtime = minimum((@benchmark solve($oprob, QNDF())).times) / 1000000000
println("Large grid, small, stiff, system. Runtime: $(runtime), previous standard: $(runtime_target)")
@test runtime < runtime_reduction_margin * runtime_target
end

# Small grid, mid-sized, non-stiff, system.
let
lrs = LatticeReactionSystem(CuH_Amination_system, CuH_Amination_srs_2,
small_2d_grid)
u0 = [
:CuoAc => 0.005 .+ rand_v_vals(lrs.lattice, 0.005),
:Ligand => 0.005 .+ rand_v_vals(lrs.lattice, 0.005),
:CuoAcLigand => 0.0,
:Silane => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:CuHLigand => 0.0,
:SilaneOAc => 0.0,
:Styrene => 0.16,
:AlkylCuLigand => 0.0,
:Amine_E => 0.39,
:AlkylAmine => 0.0,
:Cu_ELigand => 0.0,
:E_Silane => 0.0,
:Amine => 0.0,
:Decomposition => 0.0,
]
pV = CuH_Amination_p
pE = [:D1 => 0.1, :D2 => 0.1, :D3 => 0.1, :D4 => 0.1, :D5 => 0.1]
oprob = ODEProblem(lrs, u0, (0.0, 10.0), (pV, pE); jac = false)
@test SciMLBase.successful_retcode(solve(oprob, Tsit5()))

runtime_target = 0.0016
runtime = minimum((@benchmark solve($oprob, Tsit5())).times) / 1000000000
println("Small grid, mid-sized, non-stiff, system. Runtime: $(runtime), previous standard: $(runtime_target)")
@test runtime < runtime_reduction_margin * runtime_target
end

# Large grid, mid-sized, non-stiff, system.
let
lrs = LatticeReactionSystem(CuH_Amination_system, CuH_Amination_srs_2,
large_2d_grid)
u0 = [
:CuoAc => 0.005 .+ rand_v_vals(lrs.lattice, 0.005),
:Ligand => 0.005 .+ rand_v_vals(lrs.lattice, 0.005),
:CuoAcLigand => 0.0,
:Silane => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:CuHLigand => 0.0,
:SilaneOAc => 0.0,
:Styrene => 0.16,
:AlkylCuLigand => 0.0,
:Amine_E => 0.39,
:AlkylAmine => 0.0,
:Cu_ELigand => 0.0,
:E_Silane => 0.0,
:Amine => 0.0,
:Decomposition => 0.0,
]
pV = CuH_Amination_p
pE = [:D1 => 0.1, :D2 => 0.1, :D3 => 0.1, :D4 => 0.1, :D5 => 0.1]
oprob = ODEProblem(lrs, u0, (0.0, 10.0), (pV, pE); jac = false)
@test SciMLBase.successful_retcode(solve(oprob, Tsit5()))

runtime_target = 0.67
runtime = minimum((@benchmark solve($oprob, Tsit5())).times) / 1000000000
println("Large grid, mid-sized, non-stiff, system. Runtime: $(runtime), previous standard: $(runtime_target)")
@test runtime < runtime_reduction_margin * runtime_target
end

# Small grid, mid-sized, stiff, system.
let
lrs = LatticeReactionSystem(sigmaB_system, sigmaB_srs_2, small_2d_grid)
u0 = [
:w => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:w2 => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:w2v => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:v => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:w2v2 => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:vP => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:σB => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:w2σB => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:vPp => 0.0,
:phos => 0.4,
]
pV = sigmaB_p
pE = [:DσB => 0.1, :Dw => 0.1, :Dv => 0.1]
oprob = ODEProblem(lrs, u0, (0.0, 10.0), (pV, pE))
@test SciMLBase.successful_retcode(solve(oprob, QNDF()))

runtime_target = 0.019
runtime = minimum((@benchmark solve($oprob, QNDF())).times) / 1000000000
println("Small grid, mid-sized, stiff, system. Runtime: $(runtime), previous standard: $(runtime_target)")
@test runtime < runtime_reduction_margin * runtime_target
end

# Large grid, mid-sized, stiff, system.
let
lrs = LatticeReactionSystem(sigmaB_system, sigmaB_srs_2, large_2d_grid)
u0 = [
:w => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:w2 => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:w2v => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:v => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:w2v2 => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:vP => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:σB => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:w2σB => 0.5 .+ rand_v_vals(lrs.lattice, 0.5),
:vPp => 0.0,
:phos => 0.4,
]
pV = sigmaB_p
pE = [:DσB => 0.1, :Dw => 0.1, :Dv => 0.1]
oprob = ODEProblem(lrs, u0, (0.0, 10.0), (pV, pE))
@test SciMLBase.successful_retcode(solve(oprob, QNDF()))

runtime_target = 35.0
runtime = minimum((@benchmark solve($oprob, QNDF())).times) / 1000000000
println("Large grid, mid-sized, stiff, system. Runtime: $(runtime), previous standard: $(runtime_target)")
@test runtime < runtime_reduction_margin * runtime_target
end