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

tcollect fails with nested generators #113

Open
juliohm opened this issue Jul 24, 2024 · 2 comments
Open

tcollect fails with nested generators #113

juliohm opened this issue Jul 24, 2024 · 2 comments

Comments

@juliohm
Copy link

juliohm commented Jul 24, 2024

MWE:

using Transducers
using OhMyThreads

f(xs) = Transducers.tcollect(abs(x) for x in xs)
g(xs) = OhMyThreads.tcollect(abs(x) for x in xs)

f((x for x in rand(100))) # works as expected
g((x for x in rand(100))) # fails with the error below
ERROR: MethodError: no method matching tmap(::typeof(identity), ::Base.Generator{Base.Generator{Vector{Float64}, typeof(identity)}, var"#13#14"})

Closest candidates are:
  tmap(::Any, ::Union{ChunkSplitters.Chunk, AbstractArray}, AbstractArray...; scheduler, kwargs...)
   @ OhMyThreads ~/.julia/packages/OhMyThreads/PtzLw/src/implementation.jl:323
  tmap(::Any, ::Type{T}, ::AbstractArray, ::AbstractArray...; kwargs...) where T
   @ OhMyThreads ~/.julia/packages/OhMyThreads/PtzLw/src/implementation.jl:318

Stacktrace:
 [1] tcollect(A::Base.Generator{Base.Generator{Vector{Float64}, typeof(identity)}, var"#13#14"}; kwargs::@Kwargs{})
   @ OhMyThreads.Implementation ~/.julia/packages/OhMyThreads/PtzLw/src/implementation.jl:472
 [2] g(xs::Base.Generator{Vector{Float64}, typeof(identity)})
   @ Main ./REPL[23]:1
 [3] top-level scope
   @ REPL[27]:1
@carstenbauer carstenbauer changed the title tcollect fails with generators tcollect fails with nested generators Aug 15, 2024
@carstenbauer
Copy link
Member

The issue here is the nesting of generators.

OhMyThreads.tcollect(abs(x) for x in rand(100))

works just fine.

@carstenbauer
Copy link
Member

I'm not sure we want to or even can support this properly.

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

No branches or pull requests

2 participants