Returning Multiple RemoteRefs Error #9457 Closed JaredCrean2 opened this Issue on Dec 24, 2014 · 3 comments Projects None yet Labels doc error handling parallel Milestone No milestone Assignees No one assigned 4 participants @JaredCrean2 @vtjnash @malmaud @jakebolewski Notifications You’re not receiving notifications from this thread. @JaredCrean2 JaredCrean2 commented on Dec 24, 2014 I found that returning multiple values using remotecall produces a (rather strange) error. Does anyone know why this would fail in parallel? Although there are a few workaround (using arrays and cell arrays), it would be very useful to be able to directly reuse functions that work in serial for parallel codes. Here is the script file Script1.jl that triggers the error: # script to be executed on process 1 # run with julia -p 1 ./Script1.jl @everywhere include("funcs.jl") a = 1 b = 2 ret1 = remotecall(2, func1, a, b) wait(ret1) ret2, ret3 = remotecall(2, func2, a, b) # error wait(ret2) and here is the function file funcs.jl: function func1(c, d) println("c = ", c) println("d = ", d) return c end function func2(c, d) println("c = ", c) println("d = ", d) return c, d end Here is the error info: ERROR: start has no method matching start(::RemoteRef) in include at ./boot.jl:245 in include_from_node1 at loading.jl:128 in process_options at ./client.jl:285 in _start at ./client.jl:354 in _start_3B_1720 at /usr/bin/../lib/x86_64-linux-gnu/julia/sys.so while loading /home/dev1/julia_tests/ret_values/Script1.jl, in expression starting on line 12 Julia version info Julia Version 0.3.3 Commit 21d5433* (2014-10-21 20:18 UTC) Platform Info: System: Linux (x86_64-linux-gnu) CPU: Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz WORD_SIZE: 64 BLAS: libopenblas (NO_LAPACK NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Nehalem) LAPACK: liblapack.so.3 LIBM: libopenlibm LLVM: libLLVM-3.3 @vtjnash The Julia Language member vtjnash commented on Dec 25, 2014 remotecall always returns a single RemoteRef help?> remotecall Base.remotecall(id, func, args...) Call a function asynchronously on the given arguments on the specified process. Returns a "RemoteRef". the error message could perhaps be improved. it happens because of: a, b = RemoteRef() gets translated into an iterator over the right hand side @vtjnash vtjnash added error handling doc labels on Dec 25, 2014 @jakebolewski jakebolewski added the parallel label on Jun 2, 2015 @malmaud malmaud commented on Oct 14, 2015 This is kinda tricky. The docs for remotecall seems pretty clear and the very first section in the parallel computing manual chapter explains that remotecall returns a RemoteReference. But you do have to understand that returning multiple values just means returning a single tuple whose elements are the individual return values. @JaredCrean2, I'd be interesting in hearing your thoughts on what could make the documentation clearer. @JaredCrean2 JaredCrean2 commented on Oct 14, 2015 I didn't realize this issue was still open. I just tested with a more recent version of Julia and found if I change the script to: # script to be executed on process 1 # run with julia -p 1 ./Script1.jl @everywhere include("funcs.jl") a = 1 b = 2 ret1 = remotecall(2, func1, a, b) wait(ret1) ret2 = remotecall(2, func2, a, b) wait(ret2) a1,b2 = fetch(ret2) # unpack the tuple here println("a1, b1 = ", a1, ", ", b2) then everything works as expected. Returning a single RemoteRef pointing to a tuple seems like a reasonable way to of doing things combined with the documentation, so I'll close. @JaredCrean2 JaredCrean2 closed this on Oct 14, 2015