SMM.jl icon indicating copy to clipboard operation
SMM.jl copied to clipboard

change to pmap step in computeNextIteration

Open gregobad opened this issue 6 years ago • 5 comments

Hi -

I modified the pmap step in computeNextIteration! to only parallellize the objective function evaluation step (not the accept / reject or proposal steps). This avoids having to pass the entire chain to the workers. I was running into problems where the evaluation slowed down over time and eventually failed with a bus error because the chain objects get very large. I think this should solve that problem.

Greg

gregobad avatar Dec 06 '19 00:12 gregobad

sounds like a good idea! thanks!

floswald avatar Dec 09 '19 16:12 floswald

This actually doesn't go far enough. pmap still gets passed a reference to the chain object, which is growing over time. Will update shortly to fix that.

gregobad avatar Dec 10 '19 17:12 gregobad

hey how are we doing with this? good to merge?

floswald avatar Jan 02 '20 20:01 floswald

This change by itself doesn't give much of a memory improvement. To get any improvement it's necessary to use CachingPool. I couldn't figure out a way to do this cleanly. My current version of the code defines a global pool wp which gets passed to pmap in computeNextIteration!:

evs = pmap(x -> evaluateObjective(algo.m, x), wp, pps)

But this solution doesn't make a lot of sense for library use.

gregobad avatar Jan 02 '20 21:01 gregobad

I've added an option to AlgoBGP.opts, "worker_pool", that allows the user to specify a worker pool to use for distributed computation. This gets passed to the pmap step in computeNextIteration!. This branch also has a few other additions, like the possibility of passing additional arguments to the objective function as keyword options.

gregobad avatar Oct 26 '20 17:10 gregobad