Functions in @distributed for do not work


I use Julia 1.0.2 on Atom. I’m trying to parallel my loop and there is a problem which I don’t understand. Parallel loops work great without functions inside. Also program work great on 1 worker with functions. And completely failed with functions. My test example:


As result I get LoadError: On worker 2:
UndefVarError: #fparall not defined:

It work on 1 worker or works in parallel without function. How should I define it?

I found similar problem here Julia 1.0 Example of @distributed and pmap but solution didn’t work.


Try @everywhere include("funkparallel.jl") to make the function definition (which I presume is in that file?) available on all worker processes.

Relevant docs for the Distributed stdlib are here


Thanks, work! Sorry for such stupid questions, but sometimes documentation is as russians say: “one need half litre of vodka to understand”.
I hope that I find more relevant examples soon =)


Glad it worked, I’ll be sure to try the half liter vodka approach next time I’m unsure about the docs!

Be sure to mark the topic as solved (you should see a little tick-mark button) to save others the time of checking on this thread!