Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mv does not seem to parallelize combine #60

Closed
DrChainsaw opened this issue Oct 22, 2021 · 1 comment · Fixed by #64
Closed

mv does not seem to parallelize combine #60

DrChainsaw opened this issue Oct 22, 2021 · 1 comment · Fixed by #64

Comments

@DrChainsaw
Copy link
Collaborator

I think this boils down to merge, but mv makes for a simpler MWE. Glancing at the code it looks like it should parallelize, but maybe there is a good reason why it doesn't.

julia> using Distributed, FileTrees

julia> addprocs(10; exeflags="--project");

julia> tt = mapvalues(identity, maketree("root" => ["next" => [(name=string(x), value=1:10) for x in 'a':'k']]); lazy=true)
root/
└─ next/
   ├─ a (Thunk(#71, (1:10,)))
   ├─ b (Thunk(#71, (1:10,)))
   ├─ c (Thunk(#71, (1:10,)))
   ├─ d (Thunk(#71, (1:10,)))
   ├─ e (Thunk(#71, (1:10,)))
   ├─ f (Thunk(#71, (1:10,)))
   ├─ g (Thunk(#71, (1:10,)))
   ├─ h (Thunk(#71, (1:10,)))
   ├─ i (Thunk(#71, (1:10,)))
   ├─ j (Thunk(#71, (1:10,)))
   └─ k (Thunk(#71, (1:10,)))


julia> @everywhere function myvcat(x, y)
        @info "on $(myid())"
        vcat(x,y)
        end


julia> ttm = mv(tt, r"next/[a-z]$", s"next"; combine=myvcat)
root/
└─ next (Thunk(myvcat, (Thunk(myvcat, ...), Thunk(#71, ...))))


julia> exec(ttm)
[ Info: on 13
[ Info: on 13
[ Info: on 13
[ Info: on 13
[ Info: on 13
[ Info: on 13
[ Info: on 13
[ Info: on 13
[ Info: on 13
[ Info: on 13
root/
└─ next (110-element Vector{Int64})


julia> ttm = mapsubtrees(ttt -> reducevalues(myvcat, ttt), tt, r"[a-z]")
root/
└─ next/ (Thunk(myvcat, (Thunk(myvcat, ...), Thunk(myvcat, ...))))


julia> exec(ttm)
[ Info: on 13
[ Info: on 19
[ Info: on 16
[ Info: on 13
[ Info: on 14
[ Info: on 19
[ Info: on 14
[ Info: on 13
[ Info: on 19
[ Info: on 13
root/
└─ next/ (110-element Vector{Int64})

I believe that achieving the latter is one of the use cases of mv, right?

@DrChainsaw
Copy link
Collaborator Author

I suppose one would need to implement something similar to assocreduce in merge, right? Probably need the same flag as reducevalues too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant