Kinda new to Julia so not sure where to post this but I'll start here. The 
simple example from the docs involving @parallel and SharedArray doesn't 
seem to work. I would think I should end up with a=1:10, but instead it all 
zeros. 

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0-dev+4553 (2016-06-06 02:05 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit f4cb80b (5 days old master)
|__/                   |  x86_64-unknown-linux-gnu

julia> addprocs()
8-element Array{Int64,1}:
 2
 3
 4
 5
 6
 7
 8
 9

julia> begin
       a = SharedArray(Float64,10)
       @parallel for i=1:10
         a[i] = i
       end
       end
8-element Array{Any,1}:
 Future(2,1,26,#NULL)
 Future(3,1,27,#NULL)
 Future(4,1,28,#NULL)
 Future(5,1,29,#NULL)
 Future(6,1,30,#NULL)
 Future(7,1,31,#NULL)
 Future(8,1,32,#NULL)
 Future(9,1,33,#NULL)

julia> a
10-element SharedArray{Float64,1}:
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0


This is using a nightly build of v0.5.0 which I figured I should since this 
exact example is included in the 0.5.0 docs but not the 0.4.5 ones. In any 
case, from what I can gather this *should* also work on 0.4.5, and I've 
tried it and the results is identical as above. If I just put these 
commands in a script it also doesn't work. One note, if I just execute each 
command on its own line, rather than grouping them with the begin, then it 
works. 

Any ideas whats going on? 

Reply via email to