Hi Paul,
If D is allocated on the master, then Julia will need to pass D from the
master to the workers. I'm guessing that this communication might be more
expensive than the compute in your loops. It may be useful to take a look
at distributed arrays in the parallel section of the Julia docs.
Hope it helps.
Sam
On Saturday, January 31, 2015 at 7:38:22 AM UTC-6, paul analyst wrote:
>
>
> Parallel loop, what wroong ? Parallel is slower then normal
>
> julia> @time for i=1:l
> w[i]=var(D[:,i])
> end
> elapsed time: 4.443197509 seconds (14074576 bytes allocated)
>
>
> julia> @time ww=@parallel (hcat) for i=1:l
> var(D[:,i])
> end
> elapsed time: 5.287007403 seconds (435449580 bytes allocated, 5.00% gc
> time)
> 1x10000 Array{Float64,2}:
>
> Paul
>
> julia> @time for i=1:l
> w[i]=var(D[:,i])
> end
> elapsed time: 4.331569152 seconds (8637464 bytes allocated)
>
> julia> @time ww=@parallel (hcat) for i=1:l
> var(D[:,i])
> end
> elapsed time: 4.908234336 seconds (422121448 bytes allocated, 4.85% gc
> time)
> 1x10000 Array{Float64,2}:
> 0.000703737 0.000731674 0.000582672 0.00080388 0.000759479
> 0.000402509 0.0007118 0.000989408
>
> julia> size(D)
> (10000,10000)
>