Cuba.jl
Cuba.jl copied to clipboard
Support parallelization
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.
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.
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.
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.
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.
For now there's a pure Julia vegas method here which supports parallelization: https://github.com/ranjanan/MonteCarloIntegration.jl
Instead of parallelizing on the binary side, could it instead have a batch interface to let the user parallelize over the evaluation points?
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