I tried to forge the tree structure using a SharedArray, putting the nodes 
and its childs in specific positions in the matrix. 

However, the SharedArray only allows Bits Types as elements. For my 
purposes, it would be interesting to have a user defined type, with various 
attributes of diferent types, like Numbers, DataFrames etc.


On Wednesday, May 27, 2015 at 8:40:03 PM UTC-3, Stefan Karpinski wrote:
>
> That could work, but that's an array, not a linked node structure as this 
> question indicates.
>
> On Wed, May 27, 2015 at 7:32 PM, datnamer <[email protected] <javascript:>
> > wrote:
>
>> What about shared array?
>>
>> On Wednesday, May 27, 2015 at 6:03:46 PM UTC-4, Stefan Karpinski wrote:
>>>
>>> Since Julia doesn't at this point have shared memory parallelism, you 
>>> can't do this.
>>>
>>> On Wed, May 27, 2015 at 4:28 PM, Diogo Gobira <[email protected]> wrote:
>>>
>>>>
>>>> What's the best (if it's possible) way to parallelize recursive calls 
>>>> on a recursive data structure, like a tree, allowing all the workers to 
>>>> update the nodes they received as parameter on the recursive function 
>>>> calls. My code is similar to this:
>>>>
>>>> function apply_simulation(node,data)
>>>>      #Do sometinhing with the root node
>>>>      do_something(node)
>>>>      for i=1:length(node.childs)
>>>>        # Call recursivelly on each child
>>>>        apply_simulation(node.child[i],data)
>>>>      end
>>>> end
>>>>
>>>> I would like to use @parallel, as shown in the code bellow. Is it 
>>>> possible for my tree object be visible and writable for all workers? 
>>>>
>>>> function apply_simulation(node,data)
>>>>      #Do something with the root node
>>>>      do_something(node, data)
>>>>      *@parallel* for i=1:length(node.childs)
>>>>        # Call recursivelly on each child
>>>>        apply_simulation(node.child[i],data)
>>>>      end
>>>> end
>>>>
>>>> Thanks!
>>>>
>>>>
>>>
>

Reply via email to