Skip to content

Commit 4de3c93

Browse files
Simple workaround for threadid() issue
Replace `Threads.nthreads()` with `Threads.maxthreadid()`. Use `Threads.@threads :static` to be able to use `Threads.threadid()`. This is just a quick bug fix, a better solution should be implemented down the line.
1 parent db34993 commit 4de3c93

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/search.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ function search(graph::G,
2222
# lists of candidates, sorted by distance
2323
candidates = [BinaryMaxHeap{Tuple{U, V, Bool}}() for _ in 1:length(queries)]
2424
# a set of seen candidates per thread
25-
seen_sets = [BitVector(undef, length(data)) for _ in 1:Threads.nthreads()]
26-
Threads.@threads for i in eachindex(queries)
25+
seen_sets = [BitVector(undef, length(data)) for _ in 1:Threads.maxthreadid()]
26+
Threads.@threads :static for i in eachindex(queries) # :static needed to use threadid()
2727
# zero out seen
2828
seen = seen_sets[Threads.threadid()]
2929
seen .= false

0 commit comments

Comments
 (0)