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

Scalar indexing in continuous callbacks with EnsembleGPUArray #27

Open
ChrisRackauckas opened this issue Nov 19, 2019 · 2 comments
Open

Comments

@ChrisRackauckas
Copy link
Member

29d90b2

is marks continuous callback usage broken because of scalar indexing in https://github.com/JuliaDiffEq/DiffEqBase.jl/blob/master/src/init.jl#L150 . @maleadt I thought this was fixed on CuArrays.jl?

@maleadt
Copy link
Contributor

maleadt commented Nov 19, 2019

Yes, findall is in CuArrays 1.4.0 JuliaGPU/CuArrays.jl#446
Using old package? Working with an array wrapper?

@ChrisRackauckas
Copy link
Member Author

Interesting....

using DiffEqGPU, CuArrays, OrdinaryDiffEq, Test

function lorenz(du,u,p,t)
 @inbounds begin
     du[1] = p[1]*(u[2]-u[1])
     du[2] = u[1]*(p[2]-u[3]) - u[2]
     du[3] = u[1]*u[2] - p[3]*u[3]
 end
 nothing
end

CuArrays.allowscalar(false)
u0 = Float32[1.0;0.0;0.0]
tspan = (0.0f0,100.0f0)
p = (10.0f0,28.0f0,8/3f0)
prob = ODEProblem(lorenz,u0,tspan,p)
const pre_p = [rand(Float32,3) for i in 1:10]
prob_func = (prob,i,repeat) -> remake(prob,p=pre_p[i].*p)

c_condition = function (u,t,integrator)
    @inbounds u[1] - 3
end

c_affect! = function (integrator)
    @inbounds integrator.u[1] += 20
end

callback_prob = ODEProblem(lorenz,u0,tspan,p,callback=ContinuousCallback(c_condition,c_affect!,save_positions=(false,false)))
callback_monteprob = EnsembleProblem(callback_prob, prob_func = prob_func)
solve(callback_monteprob,Tsit5(),EnsembleGPUArray(),trajectories=2,saveat=1.0f0)

The MWE works on my laptop but not my desktop

@ChrisRackauckas ChrisRackauckas changed the title Scalar indexing in continuous callbacks Scalar indexing in continuous callbacks with EnsembleGPUArray Dec 20, 2022
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

No branches or pull requests

2 participants