JuliaMath / JuliaMath/Combinatorics.jl

iterators like `pemutations` do not support @threads

Open
#165 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
230
Forks
62
PR merge metrics
No merged PRs in 30d

Description

iterators like `pemutations` do not support @threads

```
julia> P=permutations(1:3)
Combinatorics.Permutations{UnitRange{Int64}}(1:3, 3)

julia> for p∈P
println(p)
end
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]

julia> @threads for p∈P
println(p)
end
```

ERROR: TaskFailedException

nested task error: MethodError: no method matching firstindex(::Combinatorics.Permutations{UnitRange{Int64}})

Closest candidates are:
firstindex(::Any, ::Any)
@ Base abstractarray.jl:447
firstindex(::Base.JuliaSyntax.SourceFile)
@ Base C:\workdir\base\JuliaSyntax\src\source_files.jl:131
firstindex(::Markdown.MD)
@ Markdown C:\Users\congedom\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\Markdown\src\parse\parse.jl:27
...

Stacktrace:
[1] (::var"#539#threadsfor_fun#148"{var"#539#threadsfor_fun#147#149"{…}})(tid::Int64; onethread::Bool)
@ Main .\threadingconstructs.jl:199
[2] #539#threadsfor_fun
@ Main .\threadingconstructs.jl:181 [inlined]
[3] (::Base.Threads.var"#1#2"{var"#539#threadsfor_fun#148"{var"#539#threadsfor_fun#147#149"{…}}, Int64})()
@ Base.Threads .\threadingconstructs.jl:153

...and 5 more exceptions.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.