There seems to be a significant difference in runtime when the noise process is specified. In the simple case of:
using DifferentialEquations
using BenchmarkTools
global T = 10.0::Float64
f(du, u, p, t) = du .= 0.0+0.0im
g(du, u, p, t) = du .= 1.0+0.0im
prob = SDEProblem(f, g, zeros(ComplexF64,5), (0.0, T))
function func(prob)
return solve(prob, EM(), dt = 1e-4, saveat = 1e-3)
end
We have a 5D stochastic function that only depends on the noise term. Benchmarking the function, we see that:
@benchmark func(p) setup=(p=$prob) seconds=20.0 samples=20000 evals=1
BenchmarkTools.Trial: 1568 samples with 1 evaluation.
Range (min … max): 12.135 ms … 18.741 ms ┊ GC (min … max): 0.00% … 31.25%
Time (median): 12.658 ms ┊ GC (median): 0.00%
Time (mean ± σ): 12.727 ms ± 378.553 μs ┊ GC (mean ± σ): 0.35% ± 1.73%
Then, changing the code by adding the following line and changing the defined SDE problem via:
W = WienerProcess(0.0,zeros(ComplexF64,5))
prob = SDEProblem(f, g, zeros(ComplexF64,5), (0.0, T), noise = W)
My understanding is that the Wiener process defined here ought to be the same as the automatically selected one. (I have checked and the automatically selected noise is complex as well.) However, benchmarking this function gives:
@benchmark func(p) setup=(p=$prob) seconds=20.0 samples=20000 evals=1
BenchmarkTools.Trial: 148 samples with 1 evaluation.
Range (min … max): 61.358 ms … 350.173 ms ┊ GC (min … max): 15.66% … 82.36%
Time (median): 84.430 ms ┊ GC (median): 42.11%
Time (mean ± σ): 134.533 ms ± 95.967 ms ┊ GC (mean ± σ): 60.11% ± 22.32%
Here, the runtime is more than 10 times longer. As such, I was wondering if anyone had any insight into where this difference in runtime comes from, and if it is possible to bring specified noise processes in line with automatically selected noises.