EDIT4: The problem seems to be much larger and I will be refraining from further investigating this type of EnsembleProblem on GPU. Below is the last working code (that has nothing to do anymore with the actual problem I want to solve) and what to do to lock up the GPU at 100% (it can be reset though), even after 10 minutes it has not finished a simple batch of 1000 solutions. The actual issue stays unsolved but I will pivot to my mulithreaded CPU solution, takes a bit longer for the values I need but at least I know how I can debug it.
using DiffEqGPU, DifferentialEquations, StaticArrays
function sys_gpu!(u, params, t)
du1 = params[1]
du2 = params[2]
return SVector{2}(du1,du2)
end
function plateu_cycle_study_gpu()
plateu_cycle::Float32 = 8.0f0
w::Float32 = 0.34888f0
tstart::Float32 = 0.0f0
tend::Float32 = 2.0f0pi/w * (plateu_cycle+1.0f0)+1.0f0
tspan = (tstart, tend)
params= @SVector [w, plateu_cycle]
f0=1.0f0
g0=1.0f0
init_cond = SVector{2,Float32}(f0, g0)
prob = ODEProblem(sys_gpu!,init_cond,tspan, params)
plateu_cycle_end = 10.0f0
amount = 1000
plateu_cycle_study_values = collect(range(zero(Float32), plateu_cycle_end, length=amount))
new_tend = @. 2.0f0pi/w * (plateu_cycle_study_values+1.0f0)+1.0f0
new_tstart = zeros(Float32, size(new_tend))
function prob_func(prob, i, repeat)
remake(prob, p=SVector{2}(prob.p[1], plateu_cycle_study_values[i]))
end
plateu_cycle_study_problem = EnsembleProblem(prob, prob_func=prob_func)
@time sim = solve(plateu_cycle_study_problem, GPUTsit5(), EnsembleGPUKernel(0), trajectories=amount)
end
plateu_cycle_study_gpu()
After letting Julia completely recompile the code one can rewrite the remake line into
remake(prob, tspan=(new_tstart[i],new_tend[i]), p=SVector{2}(prob.p[1], plateu_cycle_study_values[i]))
results in locking up a 1080 strix according to the GPU Tweak III software. EDIT3: Versions of currently used packages are:
[f68482b8] Cthulhu v2.8.5
[071ae1c0] DiffEqGPU v1.26.0
[0c46a032] DifferentialEquations v7.7.0
[5ad8b20f] PhysicalConstants v0.2.3
[91a5bcdd] Plots v1.38.8
[90137ffa] StaticArrays v1.5.17
One can produce a dynamic function invocation error by changing the inital conditions into complex numbers easily (f0, g0 and init_cond declerations need to be changed). Which might have been one clue to the actual issue.