Should we control/optimize communications in Julia?

That’s not what’s happening. The remotecall creates the matrix on process 2, as the second argument specifies:

  remotecall(f, id::Integer, args...; kwargs...) -> Future

  Call a function f asynchronously on the given arguments on the specified process. Return a Future.
  Keyword arguments, if any, are passed through to f.

So the matrix already lives on process 2.

Similarly, @spawnat 2 ... results in the remainder of the code to be executed on process 2, which fetches the result from itself (which should be fast).

Only fetch(s) then sends the result of s back to process 1.

No, it’s a regular julia process, visible in e.g. top, just as its workers are.

Indeed it will, but only because you specify the slicing to happen on the remote processes.

It should be noted that regular julia arrays always only live on the process they were created at - they are not the same as MPI arrays. You may want to use DistributedArrays.jl or a similar package for having worker-local slices abstracted as one global array.

In particular, the Distributed stdlib is not a julia equivalent of MPI. It’s more like the necessary glue to have worker processes to run code on in the first place. You may be interested in MPI.jl instead.

1 Like