Giter VIP home page Giter VIP logo

Comments (2)

tomchor avatar tomchor commented on July 25, 2024

It seems that this issue didn't attention from the devs. @weiyuanlou were you able to make this work?

from quadgk.jl.

lxvm avatar lxvm commented on July 25, 2024

Hi,
I don't think f_int.(Zcu), which is solving multiple integrals in parallel, can be currently solved with QuadGK.jl. The adaptation logic in the code will not port well to the GPU.

You could attempt using quadgk! to evaluate an inplace integrand that evaluates all of your different integrands on the GPU in an embarrasingly parallel fashion.

using CUDA
using QuadGK

Z = Array([z for z in 1:1:4]);
Zcu = CuArray([z for z in 1:1:4]);

function f_int(z_ob) 

    iii(z) =  z_ob - z  
    
    return quadgk(z -> iii(z), 0, 1, rtol=1e-4)[1]
    
end

f_int.(Z)  # This works 

quadgk!((y, z) -> y .= Zcu .- z, similar(Zcu), 0, 1, rtol=1e-4) # try this

I haven't tested this (I don't have a gpu), and I think it should parallelize well for large Zcu.

Now, with version 2.9 you will be able to use a BatchIntegrand to parallelize the evaluation of a single integral. That pr (#80) should allow, for example BatchIntegrand((y, x) -> y .= f.(x), CuArray{Float64}(undef, 1000), CuVector{Float64}(undef, 1000); max_batch=1000). This is not embarrasingly parallel since it only parallelizes within each adaptive step

QuadGK.jl is missing support for batched+inplace integrands, which would allow for more parallelism, but it would be worth trying to see how much mileage you can get out of either of the above approaches first.

from quadgk.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.