JuliaSIMD / JuliaSIMD/Polyester.jl
`@batch` uses only the first 64 threads
- Dominant language
- Julia
- Stars
- 285
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
I am currently working with a 128 cores (64 cores x 2 sockets) CPU, and I noticed that Polyester.jl will only use the first 64 threads available :
```julia
julia> using Polyester
julia> Threads.nthreads()
128
julia> tids = zeros(Int, Threads.nthreads());
julia> @batch for _ in 1:Threads.nthreads()
tids[Threads.threadid()] += 1
end
julia> all(tids .== 1)
false
julia> [tids[1:64]' ; tids[65:end]']
2x64 Matrix{Int64}
2 2 2 2 2 2 2 2 ... 2 2 2 2 2 2 2 2
0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0
julia> tids .= 0;
julia> Threads.@threads for _ in Threads.nthreads()
tids[Threads.threadid()] += 1
end
julia> all(tids .== 1)
true
julia> [tids[1:64]' ; tids[65:end]']
2x64 Matrix{Int64}
1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1
```
Notice how the threads 65 to 128 were ignored by `@batch` but not by `Threads.@threads`.
I get similar results with hyperthreading with 256 threads.
I am quite sure that this also affects LoopVectorization.jl since I am getting the same time for some very simple benchmarks :
```julia
julia> a = rand(Float64, 10000); b = rand(Float64, 10000); c = rand(Float64, 10000);
julia> @btime @tturbo for i in 1:10000
c[i] = a[i] * b[i]
end
```
Gives ~3.0 µs for 64 or 128 threads.
I suppose that it is related to the behaviors mentioned in #22. In any case I would be happy to help resolving this issue.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.