# Differences between @spawnat, remotecall\_wait, remotecall\_fetch

**URL:** <https://discourse.julialang.org/t/differences-between-spawnat-remotecall-wait-remotecall-fetch/75649>\
**Category:** Julia at Scale\
**Tags:** parallel, distributed\
**Created:** [February 2, 2022, 12:46pm UTC](https://discourse.julialang.org/t/differences-between-spawnat-remotecall-wait-remotecall-fetch/75649 "2022-02-02T12:46:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shce](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@shce](https://discourse.julialang.org/u/shce)\
**Post date:** [February 2, 2022, 12:46pm UTC](https://discourse.julialang.org/t/differences-between-spawnat-remotecall-wait-remotecall-fetch/75649/1 "2022-02-02T12:46:53Z")

</div>

Hello!

I was wondering what is the difference between `@spawn`, `remotecall_wait` and `remotecall_fetch`. For instance, consider the following MWE:

```julia
using Distributed
@everywhere using DistributedArrays

@everywhere function foo(v::Array)
    v .= myid()
    return
end

@everywhere function foo(v::DArray)
    return foo(localpart(v))
end

function main()
    v = dzeros((10,), workers(), nworkers())
    @time @sync begin
        for p in procs(v)
            # @async remotecall_wait(foo, p, v)
            # @async remotecall_fetch(foo, p, v)
            @spawnat p foo(v)
        end
    end
    println(v)
    return
end

main()

```

I run the script saved in the file `testDistributedArrays.jl` with: `julia -p 4 testDistributedArrays.jl`

All the three commands return the same vector. What is the difference between them? What am I missing?

Thank you very much
