For now I have following code which does the job outside module:
module MyModule
function parallel_inside(a::Array{Float64,1})
    s = @parallel (+) for i in 1:1000000
        sum(a)
    end
end
end

function notparallel(a::Array{Float64,1})
    s = 0
    for i in 1:1000000
        s += sum(a)
    end
end

function parallel_outside(a::Array{Float64,1})
    s = @parallel (+) for i in 1:1000000
        sum(a)
    end
end

a = randn(10000)

@time notparallel(a)
@time parallel_outside(a)
#@time MyModule.parallel_inside(a)

Where parallel version works for me if I run it with
julia -p 2 ./mycode.jl

I want to store paralized function in module. How can I call it?

If I uncomment the last line and call it with:
julia -p 2 ./mycode.jl
I get a long error message. Althought without "-p 2" it works, but without 
performance gain.

Reply via email to