Please guide in defining remote call function:
log:
[root@srvr0 ~]# julia -p 4
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.4 (2021-11-19)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia>
julia> using Distributed;
julia> r = remotecall(2, ones, 2, 2)
ERROR: MethodError: no method matching remotecall(::Int64, ::typeof(ones), ::Int64, ::Int64)
Closest candidates are:
remotecall(::Any, ::Distributed.LocalProcess, ::Any...; kwargs...) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/remotecall.jl:357
remotecall(::Any, ::Distributed.Worker, ::Any...; kwargs...) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/remotecall.jl:363
remotecall(::Any, ::Integer, ::Any...; kwargs...) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/remotecall.jl:376
...
Stacktrace:
[1] top-level scope
@ REPL[2]:1
julia> fetch(r)
ERROR: UndefVarError: r not defined
Stacktrace:
[1] top-level scope
@ REPL[3]:1
As the type signature in the error message ("Closest candidates") indicates, the worker process must be the second argument to the call. So the function you're calling, ones
in this case, is the first argument instead.
julia> using Distributed
julia> r = remotecall(ones, 2, 2, 2)
Future(2, 1, 5, nothing)
julia> fetch(r)
2×2 Matrix{Float64}:
1.0 1.0
1.0 1.0