Hi there,

I am trying to spawn and evaluate expressions over different processes. The 
expressions contain local parts of distributed arrays, and this seems to 
create problems. 
For example,
 
  addprocs(2)
  x = [i for i = 1:10]
  foo = @spawnat 2 quote
out = x[1]
for i = 2:5
out += x[i]
end
out 
  end
eval(fetch(foo))

gives, as expected,

Out [ ]: 15    

However, if I try to replace the vector x with a distributed array dx and 
use only the local chunk in the expression, I get the following error.

  dx  = DArray(I->[i for i in I[1]], (10, ))    # Construct a distributed 
array dx = [1,2,3,4,5,6,7,8,9,10]
  dfoo = @spawnat 2 quote
out = localpart(dx)[1]
for i = 2:5
out += localpart(dx)[i]
end
out 
  end
  eval(fetch(dfoo))

  Out []: ERROR: BoundsError()
  while loading In[9], in expression starting on line 9

   in getindex at array.jl:246
   in anonymous at In[9]:2

I got the feeling that the problem is the localpart() which is not 
recognized when the expression is evaluated. 
Am I right?
Is there a way around this issue?

Thank you
 












Reply via email to