Thank you very much for your help!
Even better, your solution also works within functions.
I am with Seth with his question. 
Could you explain the significance of $ in front of "local_var" ?

On Tuesday, October 6, 2015 at 1:04:13 AM UTC+2, Jameson wrote:
>
> despite your naming convention, it looks like "local_var" was a global. 
> try wrapping it in a let block:
>
> let local_var=123
> @everywhere var=$local_var
> end
>
> On Mon, Oct 5, 2015 at 6:22 PM Gabor <[email protected] <javascript:>> wrote:
>
>> I would like to copy a local variable to all parallel workers.
>>
>> I thought that the following code would do the job:
>> local_var=123
>> @everywhere var=local_var
>>
>>
>> But I get the following error:
>>
>> ERROR: On worker 2:
>> UndefVarError: local_var not defined
>>  in eval at sysimg.jl:14
>>  in anonymous at multi.jl:1350
>>  in anonymous at multi.jl:892
>>  in run_work_thunk at multi.jl:645
>>  [inlined code] from multi.jl:892
>>  in anonymous at task.jl:63
>>  in remotecall_fetch at multi.jl:731
>>
>> ...and 2 other exceptions.
>>
>>  in sync_end at task.jl:413
>>  in anonymous at multi.jl:1361
>>
>>
>> I ask for your help.
>> What is the simplest solution for this simple problem?
>>
>

Reply via email to