This was cross-posted on Stack Overflow and answered there: http://stackoverflow.com/questions/34755454/how-to-run-a-function-in-parallel-with-julia-language/34772735
Charles, I believe the community preference is that you choose one medium or the other, and do not cross post questions like this. Cheers, Dan On Tuesday, 12 January 2016 18:03:18 UTC-4, Charles Santana wrote: > > Hi, > > I am trying to figure out how to work with parallel computing with Julia. > The documentation looks great, even for someone that has never worked with > Parallel Computing (and that does not understand most of the concepts > behind the documentation ;)). > > Just to mention: I am working in a PC with Ubuntu. It has a 4-core > processor. > > To run the code I describe below I am calling the julia terminal as: > > $ julia -p 4 > > I am following the documentation here: > http://docs.julialang.org/en/latest/manual/parallel-computing/ > > For one example, specifically, I am facing some problems. > > In this section: > http://docs.julialang.org/en/latest/manual/parallel-computing/#id2 > > I am trying to run the following piece of code: > > @everywhere advection_shared_chunk!(q, u) = advection_chunk!(q, u, > myrange(q)..., 1:size(q,3)-1) > > function advection_shared!(q, u) > @sync begin > for p in procs(q) > @async remotecall_wait(advection_shared_chunk!, p, q, u) > end > end > q > end > > q = SharedArray(Float64, (500,500,500)) > u = SharedArray(Float64, (500,500,500)) > > #Run once to JIT-compile > advection_shared!(q,u) > > But I am facing the following error: > > ERROR: MethodError: `remotecall_wait` has no method matching > remotecall_wait(::Function, ::Int64, ::SharedArray{Float64,3}, > ::SharedArray{Float64,3}) > Closest candidates are: > remotecall_wait(::LocalProcess, ::Any, ::Any...) > remotecall_wait(::Base.Worker, ::Any, ::Any...) > remotecall_wait(::Integer, ::Any, ::Any...) > in anonymous at task.jl:447 > > ...and 3 other exceptions. > > in sync_end at ./task.jl:413 > [inlined code] from task.jl:422 > in advection_shared! at none:2 > > What am I doing wrong here? As far as I know I am just reproducing the > example in the docs... or not? > > Thanks for any help, > > Charles > > > -- > Um axé! :) > > -- > Charles Novaes de Santana, PhD > https://github.com/cndesantana >
