I would like to use julia's pmap
to do something like this:
pmap( f, v, inits[i])
where f
is the function I want to call in parallel on v
which is some array. I also want to pass some parameters to f
(inits
), but inits
itself is an array, and I want ith parameter to be passed along to the correct process. Does this make sense?
I could do this by sorting of 'rolling my own' version of pmap, since it can be easily done with remotecall_fetch
. Here is that implementation if the above was confusing:
i=1
nextidx() = (idx=i; i+=1; idx)
@sync begin
for k in 1:np
if k != myid() || np == 1
@async begin
while true
idx = nextidx()
if idx > chains
break
end
result[idx] = remotecall_fetch(k, mcmc_sub, m, iters, burnin,
thin, idx, ps[idx], p)
end
end
end
end
end