In the pmap case,  [(x, y) for x=1:5, y=1:5]  is an array of tuples, so f2
defined as below would work.

@everywhere function f2 (v)
         x,y=v
         return x + 1 + y
end

For the darray, push! is not implemented for a darray - a darray cannot be
grown once instantiated.




On Wed, Jun 11, 2014 at 5:18 AM, Zahirul ALAM <[email protected]>
wrote:

> I need help in understanding what am I doing wrong in each of the
> following cases:
>
> @everywhere function f2 (x, y)
>   return x + 1 + y
> end
> dArray = dzeros(5)
>
> @parallel for i=1:5
>   b= map(f2, [x, x])
>   push!(dArray, b)
> end
>
> dArray returns are still zero and the dimensions have not changed
>
> --------------------------------------------------------------------------------------------------------------------
>
> pmap(f2, [(x, y) for x=1:5, y=1:5] )
>
> returns 4-element Array{Any,1}:
>
>  MethodError(f2,((1,1),))
>  MethodError(f2,((2,2),))
>  MethodError(f2,((3,3),))
>  MethodError(f2,((4,4),))
>
>
> Please help me understand what are the things I am doing wrong?
>
>

Reply via email to