# How to avoid repeated data movement between processes?

**URL:** <https://discourse.julialang.org/t/how-to-avoid-repeated-data-movement-between-processes/9835>\
**Category:** General Usage\
**Tags:** question\
**Created:** [March 20, 2018, 1:06pm UTC](https://discourse.julialang.org/t/how-to-avoid-repeated-data-movement-between-processes/9835 "2018-03-20T13:06:25Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Michael\_Eastwood](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michael_eastwood/32/669_2.png) [@Michael\_Eastwood](https://discourse.julialang.org/u/Michael_Eastwood)\
**Post date:** [March 22, 2018, 4:17pm UTC](https://discourse.julialang.org/t/how-to-avoid-repeated-data-movement-between-processes/9835/11 "2018-03-22T16:17:25Z")

</div>

Being more explicit about the data movement is generally my preference as well, but it sounds like you might be able to get away with the `CachingPool` here.

Something like this might work for you:

```julia
foo(k) = bar(nm, k) # capture nm in a closure
pool = CachingPool(workers())
@sync for worker in workers()
    @async while length(queue) > 0
        idx = pop!(queue)
        results[idx] = remotecall_fetch(foo, pool, ks[idx])
    end
end

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-avoid-repeated-data-movement-between-processes/9835)._
