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!