-
Notifications
You must be signed in to change notification settings - Fork 9
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
collect = true leads to a vector of nothing #105
Comments
Hm, that's strange, I can't reproduce: julia> using OhMyThreads
julia> @tasks for i in 1:3
@set collect=true
i^2
end
3-element Vector{Int64}:
1
4
9
(@v1.10) pkg> st OhMyThreads
Status `~/.julia/environments/v1.10/Project.toml`
[67456a42] OhMyThreads v0.5.2 Can you please show me the output of using Pkg; pkg"which OhMyThreads" and @macroexpand1 @tasks for i in 1:3
@set collect=true
i^2
end ? |
Thanks for replying so quickly. using Pkg; pkg"which OhMyThreads" does not seem to be a julia command ? Maybe you mean the version? (
|
Note additionally, I tried it with Julia |
We can't reproduce the issue and apparently it works for you on the latest stable Julia version. For these reasons, I'm going to close this. |
Yes, sorry I meant I just checked on v1.9.2 and 1.9.4 and and I am able to reproduce the issue. That's quite strange, I wonder what could cause it. I'm going to re-open this because we do claim support for v1.9. I'd say we should either look for a fix, or drop v1.9 support. |
Even more bizarre is that the error only occurs for me when using the macro, not if I copy-paste the macroexpanded code: julia> @tasks for i in 1:3
@set collect=true
i^2
end
3-element Vector{Nothing}:
nothing
nothing
nothing
julia> @macroexpand1 @tasks for i in 1:3
@set collect=true
i^2
end
:(let
begin
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:80 =#
begin
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:246 =#
end
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:81 =#
begin
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:266 =#
end
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:82 =#
nothing
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:83 =#
local function var"#10#mapping_function"(i)
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:57 =#
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:58 =#
begin
#= REPL[18]:2 =#
#= REPL[18]:3 =#
i ^ 2
#= REPL[18]:4 =#
end
end
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:84 =#
OhMyThreads.tmap(var"#10#mapping_function", 1:3; )
end
end)
julia> let
begin
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:80 =#
begin
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:246 =#
end
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:81 =#
begin
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:266 =#
end
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:82 =#
nothing
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:83 =#
local function var"#10#mapping_function"(i)
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:57 =#
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:58 =#
begin
#= REPL[18]:2 =#
#= REPL[18]:3 =#
i ^ 2
#= REPL[18]:4 =#
end
end
#= /home/mason/.julia/packages/OhMyThreads/V13wc/src/macro_impl.jl:84 =#
OhMyThreads.tmap(var"#10#mapping_function", 1:3; )
end
end
3-element Vector{Int64}:
1
4
9 but I do get the wrong behaviour if I directly julia> eval(begin
@macroexpand1 @tasks for i in 1:3
@set collect=true
i^2
end
end)
3-element Vector{Nothing}:
nothing
nothing
nothing That's really spooky. I'm starting to suspect this is a julia-side bug, but it'll require some more digging. |
Although a bit disappointing, I think we should drop 1.9 support given that 1.10 is the new LTS. (FWIW, I'm doing the same for ThreadPinning.jl in the next version.) |
Yeah lets do that. |
Support for Julia < 1.10 will be dropped in version 0.6 (to be released soon). |
I tried the following example in Public API
and it will return a length-3 vector of nothing. Note explicit
return i^2
will solve this problem and gives[1, 4, 9]
correctly. Is this an expected behavior or just a bug?The julia version is
The text was updated successfully, but these errors were encountered: