Skip to content

Commit 208f1e9

Browse files
Merge pull request #355 from ChrisRackauckas/fix-formatting
Apply JuliaFormatter to fix code formatting
2 parents 12579a4 + 2f8b6a6 commit 208f1e9

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

docs/src/tutorials/modelingtoolkit.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ by hand. Those exact features are also potentially useful for GPU computing, and
88
tutorial showcases how to effectively use MTK with DiffEqGPU.jl.
99

1010
!!! warn
11+
1112
This tutorial currently only works for ODEs defined by ModelingToolkit. More work
1213
will be required to support DAEs in full. This is work that is ongoing and expected
1314
to be completed by the summer of 2025.
@@ -29,16 +30,16 @@ eqs = [D(D(x)) ~ σ * (y - x),
2930
D(z) ~ x * y - β * z]
3031
3132
@mtkbuild sys = ODESystem(eqs, t)
32-
u0 = SA[D(x) => 2f0,
33-
x => 1f0,
34-
y => 0f0,
35-
z => 0f0]
33+
u0 = SA[D(x) => 2.0f0,
34+
x => 1.0f0,
35+
y => 0.0f0,
36+
z => 0.0f0]
3637
37-
p = SA[σ => 28f0,
38-
ρ => 10f0,
39-
β => 8f0 / 3f0]
38+
p = SA[σ => 28.0f0,
39+
ρ => 10.0f0,
40+
β => 8.0f0 / 3.0f0]
4041
41-
tspan = (0f0, 100f0)
42+
tspan = (0.0f0, 100.0f0)
4243
prob = ODEProblem{false}(sys, u0, tspan, p)
4344
sol = solve(prob, Tsit5())
4445
```
@@ -64,7 +65,7 @@ sym_setter = setsym_oop(sys, [σ, ρ, β])
6465
The return `sym_setter` is our optimized function, let's see it in action:
6566

6667
```@example mtk
67-
u0, p = sym_setter(prob,@SVector(rand(Float32,3)))
68+
u0, p = sym_setter(prob, @SVector(rand(Float32, 3)))
6869
```
6970

7071
Notice it takes in the vector of values for `[σ, ρ, β]` and spits out the new `u0, p`. So
@@ -73,7 +74,7 @@ we can build and solve an MTK generated ODE on the GPU using the following:
7374
```@example mtk
7475
using DiffEqGPU, CUDA
7576
function prob_func2(prob, i, repeat)
76-
u0, p = sym_setter(prob,@SVector(rand(Float32,3)))
77+
u0, p = sym_setter(prob, @SVector(rand(Float32, 3)))
7778
remake(prob, u0 = u0, p = p)
7879
end
7980

src/DiffEqGPU.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ include("ensemblegpukernel/tableaus/verner_tableaus.jl")
6868
include("ensemblegpukernel/tableaus/rodas_tableaus.jl")
6969
include("ensemblegpukernel/tableaus/kvaerno_tableaus.jl")
7070

71-
72-
7371
include("utils.jl")
7472
include("algorithms.jl")
7573
include("solve.jl")

src/ensemblegpuarray/problem_generation.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ function generate_problem(prob::SciMLBase.AbstractODEProblem,
5858
_tgrad = nothing
5959
end
6060

61-
6261
f_func = ODEFunction(_f, Wfact = _Wfact!,
6362
Wfact_t = _Wfact!_t,
6463
#colorvec=colorvec,

src/solve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function batch_solve_up_kernel(ensembleprob, probs, alg, ensemblealg, I, adaptiv
273273
_callback.continuous_callbacks)...)
274274

275275
dev = ensemblealg.dev
276-
probs = adapt(dev,adapt.((dev,), probs))
276+
probs = adapt(dev, adapt.((dev,), probs))
277277

278278
#Adaptive version only works with saveat
279279
if adaptive

test/ensemblegpuarray_sde.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ NRate[2, 2] = 1
5050
u0 = ComplexF32[1.0; 0.0; 0.0; 0.0]
5151
tspan = (0.0f0, 10.0f0)
5252
p = (10.0f0, 28.0f0, 8 / 3.0f0)
53-
prob = SDEProblem(lorenz, multiplicative_noise, u0, tspan, p, noise_rate_prototype=NRate)
53+
prob = SDEProblem(lorenz, multiplicative_noise, u0, tspan, p, noise_rate_prototype = NRate)
5454

55-
prob_func = (prob, i, repeat) -> remake(prob, p=p)
56-
monteprob = EnsembleProblem(prob, prob_func=prob_func)
55+
prob_func = (prob, i, repeat) -> remake(prob, p = p)
56+
monteprob = EnsembleProblem(prob, prob_func = prob_func)
5757

58-
@test_throws "Incompatible problem detected. EnsembleGPUArray currently requires `prob.noise_rate_prototype === nothing`, i.e. only diagonal noise is currently supported. Track https://github.com/SciML/DiffEqGPU.jl/issues/331 for more information." sol = solve(monteprob, SRA1(), EnsembleCPUArray(), trajectories=10_000, saveat=1.0f0)
58+
@test_throws "Incompatible problem detected. EnsembleGPUArray currently requires `prob.noise_rate_prototype === nothing`, i.e. only diagonal noise is currently supported. Track https://github.com/SciML/DiffEqGPU.jl/issues/331 for more information." sol=solve(
59+
monteprob, SRA1(), EnsembleCPUArray(), trajectories = 10_000, saveat = 1.0f0)

0 commit comments

Comments
 (0)