I also tried the following code with pmap. It ran and seemed to run with 4 processes as shown with 'top'. But using pmap with my own function, I don't see it run with 4 processes. What can be wrong?

==========
M = {rand(1000,1000) for i=1:10}
pmap(svd, M)
==========

On 04/19/2014 10:38 PM, cnbiz850 wrote:
Sorry, the error messages must have to do with the undefined f. It works with the folowing. So I guess simply adding @parallel (+) on a for loop can then realize using multiple cores?

=======
nheads = @parallel (+) for i=1:200000000
  int(randbool())
end
=======

On 04/19/2014 10:32 PM, cnbiz850 wrote:
Copied the following test code from the online documentation. When tried to run it, I got the errors. Any guidance please?

==========
a = randn(1000)
@parallel (+) for i=1:100000
  f(a[randi(end)])
end
==========

$ julia -p 4
  _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
|__/                   |  x86_64-linux-gnu

julia> include("ParallelTest.jl")
exception on 2: exception on 4: ERROR: ERROR: ff not defined not defined

 in  in anonymousanonymous at  at no fileno file::33

 in  in anonymousanonymous at  at multi.jlmulti.jl::12631263

 in  in anonymousanonymous at  at multi.jlmulti.jl::840840

 in  in run_work_thunkrun_work_thunk at  at multi.jlmulti.jl::613613

 in  in run_work_thunk at run_work_thunk at multi.jl:multi.jl:622622

 in  in anonymousanonymous at  at task.jltask.jl::66

ERROR: no method +(UndefVarError, UndefVarError)
 in mr_pairwise at reduce.jl:536
 in mapreduce at reduce.jl:548
 in preduce at multi.jl:1403
 in include at boot.jl:244
while loading ~/Coding/Julia/ParallelTest.jl, in expression starting on line 1477




Reply via email to