SciML / Integrals.jl

A common interface for quadrature and numerical integration for the SciML scientific machine learning organization
https://docs.sciml.ai/Integrals/stable/
MIT License
226 stars 30 forks source link

Specifying maxiters and CubaSUAVE in solve causes julia to crash (segmentation fault) #91

Open evrenmturan opened 2 years ago

evrenmturan commented 2 years ago

Specifying maxiters with CubaSUAVE() causes julia to crash, e.g.

using Integrals, IntegralsCuba
f(x,p) = sum(sin.(x))
prob = IntegralProblem(f,ones(2),3ones(2))
sol = solve(prob,CubaSUAVE(),reltol=1e-3,abstol=1e-3, maxiters=10)

Also I'd like to check - is maxiters meant to be a hard limit for the number of function calls? I would have expected the below to have very different results, but they give the exact same value.

using Integrals
f(x,p) = sum(sin.(x))
prob = IntegralProblem(f,ones(2),3ones(2))
sol1 = solve(prob,HCubatureJL(),reltol=1e-8,abstol=1e-8, maxiters=1).u
sol2 = solve(prob,HCubatureJL(),reltol=1e-8,abstol=1e-8, maxiters=10).u
sol1 == sol2
ChrisRackauckas commented 2 years ago

The exact interpretation of maxiters can depend on the integrator. Some can only do iterations in odd increments. For example, Gauss-Kronrad works in 15 function evaluation increments, so anything less than that would just be hard capped to not do the next 15.

ArnoStrouwen commented 1 year ago

If you change maxiters to a larger number, e.g. 1000, it does not crash. I think these Cuba methods are not meant for low evaluation numbers. You might want to report this issue to Cuba.jl .

@ChrisRackauckas return an error for maxiters<1000 for AbstractCubaAlgorithm?

ChrisRackauckas commented 1 year ago

I guess so? It seems odd that it just crash though. But yeah that's an upstream issue.