Something like this?

addprocs(2)


foogen =  (x,y) -> begin
         (I) -> (println(I); fill!(Array(Int, map(length, I)), x+y))
       end


d=DArray(foogen(2,2), (10,))
        From worker 3:  (6:10,)
        From worker 2:  (1:5,)
10-element DArray{Int64,1,Array{Int64,1}}:
 4
 4
 4
 4
 4
 4
 4
 4
 4
 4


julia> d=DArray(foogen(1,2), (10,))
        From worker 3:  (6:10,)
        From worker 2:  (1:5,)
10-element DArray{Int64,1,Array{Int64,1}}:
 3
 3
 3
 3
 3
 3
 3
 3
 3
 3




On Tuesday, 7 October 2014 02:31:07 UTC+5:30, Andre Bieler wrote:
>
> with the syntax defined in the user manual for distributed arrays:
>
> DArray(init, dims[, procs, dist])
>
> is there a way to have the init function accept additional parameters?
> so instead of having
>
>
> function init(I)
>  #do something
> end
>
> but
>
> function init(I, a, b)
>  #do something
> end
>
>
> or should I simply go with the @everywhere macro?
>
>

Reply via email to