I am trying to implement code in parallel using Julia. I'm using the @everywhere macro in order to make all processes fetch data from a RemoteRef.
Is it possible to use a variable name thats only defined on the first process in the @everywhere expression and somehow specify that I want it to send the value of that variable, and not the variable name, to all processes?
Example:
r = RemoteRef()
put(r, data)
@everywhere data = fetch(r)
This returns an error because r
is not defined on all processes.
How should I move data to all processes?
Also, can I tell Julia to put the value instead of the variable name in the expression?
Something akin to how name = "John"; println("Hello, $name")
will print "Hello, John"