Skip to content

BatchIntegralFunction: VEGAS in-place crashes with default max_batch; HCubatureJL gives bare AssertionError #377

Closed

Description

@ChrisRackauckas-Claude

Two failures with BatchIntegralFunction on master (63b17e8, v5.5.2, Julia 1.12.4):

using Integrals
f_iip!(y, x, p) = (y .= vec(sum(abs2, x; dims = 1)); nothing)
bf = BatchIntegralFunction(f_iip!, zeros(0))
try
    sol = solve(IntegralProblem(bf, ([0.0, 0.0], [1.0, 1.0])), VEGAS(); abstol = 1e-3, reltol = 1e-3)
    println("V1 default max_batch: ok ", sol.u)
catch e
    println("V1 default max_batch: ", first(split(sprint(showerror, e), '\n')))
end
sol = solve(IntegralProblem(BatchIntegralFunction(f_iip!, zeros(0); max_batch = 1000), ([0.0, 0.0], [1.0, 1.0])), VEGAS(); abstol = 1e-3, reltol = 1e-3)
println("V1 max_batch=1000: ", sol.u)
g(x, p) = sum(abs2, x; dims = 1) |> vec
try
    sol = solve(IntegralProblem(BatchIntegralFunction(g), ([0.0, 0.0], [1.0, 1.0])), HCubatureJL())
    println("G3: ok ", sol.u)
catch e
    println("G3: ", typeof(e), " ", first(split(sprint(showerror, e), '\n')))
end
V1 default max_batch: ArgumentError: invalid GenericMemory size: the number of elements is either negative or too large for system address width
V1 max_batch=1000: 0.6670047238153245
G3: AssertionError AssertionError: f isa IntegralFunction
  1. VEGAS with an in-place BatchIntegralFunction and the default max_batch (typemax(Int)) crashes. The buffer is allocated with similar(prototype, …, max_batch) (src/Integrals.jl:431-435). It should be sized by the batch size VEGAS actually requests, or by min(max_batch, <VEGAS batch size>).
  2. HCubatureJL with a batched integrand fails with a bare @assert f isa IntegralFunction (src/Integrals.jl:366). If batching isn't supported for HCubatureJL, this should be an ArgumentError that says so and names the algorithms that do support batching (QuadGKJL, VEGAS, …).

Found during the SciML performance/genericity audit.

🤖 Filed by an AI agent with Claude Code (model: claude-opus-5-5[1m]), session https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv

Activity

  1. ChrisRackauckas-Claude commented on Nov 10, 2026

    @ChrisRackauckas-Claude
    MemberAuthor

    🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

    Taking this — Muse CLI Code, model muse-ember-1.0 (job 377-muse).


    🤖 Posted by an AI agent — harness: Muse CLI Code · model: muse-ember-1.0
    Conversation: local job 377-muse (no session URL)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions