Hi again,

I found a workaround by transforming the images into an array before (with 
separate(data(img))). However I still don't understand why I can't 
parallelize directly using the image.

Any idea why?

Thanks in advance :)

On Wednesday, 25 March 2015 19:33:02 UTC+1, Archibald Pontier wrote:
>
> Hi everyone,
>
> I recently started using Julia for my projects and I'm currently quite 
> stuck by how to parallelize things. 
>
> I've got the two following functions:
>
> @everywhere pixel(p) = [p.r, p.g, p.b];
>
> which takes a RGB pixel (as defined in the Images module) and converts it 
> into a vector of its RGB components (in my case always Float64), and
>
> @everywhere function p_theta(pixel, mu, Sigma)
>   Sigma = inv(Sigma);
>   d = size(mu, 1);
>   temp = dot(-(pixel - mu), Sigma * (pixel - mu)) / 2;
>   result = (sqrt(det(Sigma)) * exp(temp) / sqrt((2*pi)^2))
>   return result;
> end
>
> which calculates the probability for a given pixel, given a 3 components 
> vector mu and a 3x3 covariance matrix Sigma.
>
> Now, when I use them without parallelizing, there is no problem. However, 
> as soon as I use them in parallel, for example, given an image img
>
> s = size(img, 1) * size(img, 2);
> t_img = reshape(img, s)
>
> s_D = @parallel (vcat) for i in 1:s
>   p = pixel(t_img[i]);
>   d = p_theta(p, mu, Sigma);
>   d
> end
>
> it crashes with the following error: 
> ERROR: result shape not specified in _reinterpret_cvarray at 
> ~/.julia/v0.3/Images/src/core.jl:140
> all the child processes terminate, and I end up with only 1 julia process 
> left.
>
> I tried various things, including pmap, without success.
>
> Any idea why that happens?
>
> Thanks in advance!
>
>

Reply via email to