DistributedObjects.DistributedObject
— TypeDistributedObject{T}() where T
Create an empty DistributedObject
which will reference objects of type <:T
stored on remote processes.
For example, DistributedObject{Int64}()
, will return a distributed object capable of referencing Int64
objects.
DistributedObject{T}(f::Function; pids=workers()::Vector{Int64})
Make a reference to objects of type <:T
stored on processes pids
. f
is a function that when executed on a pid
in pids
must return an implementation of an object of type <:T
. The default pids
are the worker processes.
For example, DistributedObject((pid)->pid * ones(2); pids=[2,3])
, will return a distributed object referencing a vector [2,2]
and [3,3]
stored on workers 2 and 3 respectively.
DistributedObject{T}(f::Function, pid::Int64)
Make a reference to an object of type <:T
stored on process pid
. f
is a function that when executed on pid
must return an implementation of an object of type <:T
.
For example, DistributedObject(()->ones(2), 4)
, will return a distributed object referencing a vector [1,1]
stored on workers 4.
Base.close
— MethodBase.close(d::DistributedObject)
Remove all the remote objects.
Base.delete!
— MethodBase.delete!(d::DistributedObject, pid::Int64)
Remove the remote object stored on process pid
.
Base.getindex
— MethodBase.getindex(d::DistributedObject{T}) where T
Retrieve the object stored by the current process.
Base.getindex
— MethodBase.getindex(d::DistributedObject{T}, pid::Int64) where T
Retrieve the remote object stored at process pid
.
Base.getindex
— MethodBase.getindex(d::DistributedObject{T}, pids::Int64...) where T
Retrieve the remote object(s) stored at process(es) pids
if they exist. If no pids
is given, the object stored by the current process is returned. Warning: retrieving remote objects will create communication costs.
Base.setindex!
— MethodBase.setindex!(d::DistributedObject{T}, f::Function, pid::Int64) where T
Store the object of type T
returned by f
evaluated on process pid
. f
should take no argument.
Base.setindex!
— MethodBase.setindex!(d::DistributedObject{T}, f::Function, pids::Int64...) where T
Store the objects of type T
returned by f
evaluated on each process of pids
. f
should take a pid::Int64
as an argument.
Base.setindex!
— MethodBase.setindex!(d::DistributedObject{T}, f::Function) where T
Store the object of type T
returned by f
on the current process. f
should take no argument.
Base.setindex!
— MethodBase.setindex!(d::DistributedObject{T}, o::T, pid::Int64) where T
Store the object o
on process pid
.
Base.setindex!
— MethodBase.setindex!(d::DistributedObject{T}, o::T) where T
Store the object o
on the current process.
Base.setindex!
— MethodBase.setindex!(d::DistributedObject{T}, os::Vector{T}, pids::Int64...) where T
Store the objects os
on the process of pids
.