JuliaMath / HCubature.jl

pure-Julia multidimensional h-adaptive integration
Other
153 stars 25 forks source link

GPU support #52

Open Vilin97 opened 1 year ago

Vilin97 commented 1 year ago

What would it take to make hcubature GPU-friendly? In the sense that there is no scalar indexing. Is that even possible?

MWE:

using HCubature, CUDA
CUDA.allowscalar(false)
hcubature(x -> sum(abs2, x), CuArray(fill(-3, 3)), CuArray(fill(3, 3))) # ERROR: Scalar indexing is disallowed.
stevengj commented 1 year ago

Why do you need to store the integrand bounds as CuArrays? In costly multidimensional integration, isn't the cost of evaluating the integrand usually the dominant factor (in which case you could evaluate the integrand on the GPU).

Vilin97 commented 1 year ago

@stevengj , how do I tell Julia to evaluate the integrand on the GPU though? I thought that by passing CuArray for the bounds it would dispatch to the GPU. Could you use my MWE to demonstrate how to do the integration on the GPU?

Thank you!