giordano / Cuba.jl

Library for multidimensional numerical integration with four independent algorithms: Vegas, Suave, Divonne, and Cuhre.
https://giordano.github.io/Cuba.jl/stable
MIT License
75 stars 9 forks source link

Support parallelization #1

Open giordano opened 8 years ago

giordano commented 8 years ago

I'm not sure it's actually feasible, but it would be great if Cuba.jl could take advantage of parallelization capability of Cuba Library. Concurrency is achieved using fork and wait, but trying to increase the number of Cuba cores in Cuba.jl, after having increased the number of Julia processes with addprocs (without this, Cuba will spawn useless Julia processes), results in an undefined reference to fork function.

tshort commented 8 years ago

Following up on your comment to https://github.com/JuliaLang/julia/issues/8295, Stefan once suggested one could use ccall to call fork. Maybe that would work for you.

giordano commented 8 years ago

Thanks for your comment, but I don't think your suggestion is feasible in this case as I never call directly fork, but functions that internally spawn slave processes.

amitmurthy commented 8 years ago

A hack using fork with Julia is https://github.com/amitmurthy/PTools.jl#pfork - though I don't see how this will be useful in your scenario with fork being called from within the library.

giordano commented 8 years ago

Thanks to you as well. As I said in the Julia issue, I'm not sure that supporting fork in Julia would solve this problem, but what I'm experiencing is that if Cuba.jl tries to use fork new processes it crashes due to undefined reference to fork function.

ChrisRackauckas commented 5 years ago

For now there's a pure Julia vegas method here which supports parallelization: https://github.com/ranjanan/MonteCarloIntegration.jl

ChrisRackauckas commented 5 years ago

Instead of parallelizing on the binary side, could it instead have a batch interface to let the user parallelize over the evaluation points?

giordano commented 5 years ago

It does already support vectorisation: https://giordano.github.io/Cuba.jl/stable/#Vectorization-1. Example here: https://giordano.github.io/Cuba.jl/stable/#Vectorized-Function-1