-
Notifications
You must be signed in to change notification settings - Fork 25
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
Question on eduction #313
Comments
Here is a list of similar snippets what happens with them:
If the mapping, filtering, etc. are slow and/or the input is huge, I'd recommend one of the threaded versions. Note that the functions used in the iterator should be "thread-safe" (not modifying shared state etc.). If you are not using transducers directly, I think ThreadsX.jl interface is simpler to use and easier to get rid of.
If you are going to |
So ThreadsX.jl is a wrapper over Transducers.jl to provide similar syntax to Base, right? I will think about it carefully, but since the package is "heavier" than Transducers.jl that is already a good reason to stick with Transducers.jl for now. ThreadsX.jl provides any performance benefit compared to Transducers.jl? |
There is also ThreadPools.jl, I wonder if you had a chance to compare. |
Regarding the eduction, I asked because I think it didn't work when I tried it here. |
Yeah, Threadsx.jl is mostly a wrapper around Transducers.jl. It makes sense to stick with Transducers.jl if you don't need it. Some reducers are non-trivial to implement (e.g.,
Not really. It has a bit of heuristics for
I haven't done any performance comparison yet. But my impression is that there is no threading tool that is as extensible and "correct" as Transducers.jl. For example, many threaded map implementation uses I think the current performance of Transducers.jl is reasonably OK. So I want to cleanup/consolidate the API first. After that, there is plenty of room for optimizations and a lot to learn from other threading tools like ThreadPools.jl.
Did it error out or was it just slow? The latest release (0.4.36) tweaked this part so it may be worth trying it again. See also #306. As usual, a bug report (preferably with a MWE) is very welcome :) |
It errors with the following message: Varioplane: Error During Test at /home/juliohm/.julia/dev/Variography/test/varioplane.jl:1
Got exception outside of a @test
MethodError: no method matching halve(::SpatialPartition{RegularGridData{Float64,2}}) Could you please confirm that the method only works with iterators that provide a |
Do I understand correctly that I need to implement I am a bit confused given that I couldn't find the To clarify a bit, I've just tried removing the |
If you want multi-threaded reduction on a custom container, you need to define (I guess the word "reducible" is confusing at this moment. It was written before I added parallel reductions.) |
Can I implement the |
Transducers.jl import SplittablsBase.jl always anyway so there is no point to avoid adding it as a dependency. SplittablsBase.jl is meant to be a light-weight package to let packages support Transducers.jl etc. without importing Transducers.jl. FWIW, I think I'll move (You can do |
I will try to implement the function tomorrow. My iterator stores a vector of vectors that could be halved. In general, should I expect a major performance gain by avoiding the collect? |
Looking at Otherwise, defining struct SpatialPartition{O<:AbstractSpatialObject,V<:AbstractVector{Vector{Int}}}
object::O
subsets::V # so that we can use view
metadata::Dict
end
function SplittablesBase.halve(partition::SpatialPartition)
left, right = SplittablesBase.halve(partition.subsets)
return (
SpatialPartition(partition.object, left, partition.metadata),
SpatialPartition(partition.object, right, partition.metadata),
)
end
I guess it depends. If the computation for each element is very expensive, it's probably hard to observe the difference. |
Thank you for the clarifications @tkf , I will close the issue for now knowing the the way forward is to implement |
Is there any major difference in performance between:
and
in general? When is it recommended to collect the iterator?
The text was updated successfully, but these errors were encountered: