Enumerate is an iterator, you need to collect the items first:

julia> @parallel for i in collect(enumerate(list))
           println(i)
       end

julia>  From worker 2:  (1,"a")
    From worker 2:  (2,"b")
    From worker 3:  (3,"c")


El miércoles, 19 de agosto de 2015, 12:17:35 (UTC-5), Nils Gudat escribió:
>
> I just rewrote one of my parallel loops and was surprised by this:
>
> > list = ["a", "b", "c"]
>
> > for i in enumerate(list)
> >   println(i)
> > end
>
> (1,"a") 
> (2,"b") 
> (3,"c")
>
> > addprocs(2)
>
> > @sync @parallel for i in enumerate(list)
> >   println(i)
> > end
>
> ERROR: `getindex` has no method matching 
> getindex(::Enumerate{Array{ASCIIString,1}}, ::UnitRange{Int64})
>
> Am I doing something wrong here? Is this expected behaviour?
>

Reply via email to