Skip to content

Commit d8a99a7

Browse files
Merge pull request #32 from rasmushenningsson/ThreadingQuickFix
Simple workaround for threadid() issue
2 parents db34993 + 77729b4 commit d8a99a7

File tree

2 files changed

+29
-24
lines changed

2 files changed

+29
-24
lines changed

.github/workflows/CI.yml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: CI
22
on:
3-
pull_request:
43
push:
5-
branches:
6-
- master
7-
tags: '*'
4+
branches: [main, master]
5+
tags: ["*"]
6+
pull_request:
87
jobs:
98
test:
109
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
@@ -13,34 +12,39 @@ jobs:
1312
fail-fast: false
1413
matrix:
1514
version:
16-
- '1.6'
17-
- '1'
18-
# - 'nightly'
15+
- '1' # automatically expands to the latest stable 1.x release of Julia
16+
- 'min'
17+
# - 'pre'
1918
os:
2019
- ubuntu-latest
21-
- macOS-latest
2220
- windows-latest
2321
arch:
2422
- x64
23+
include:
24+
- os: macOS-latest
25+
arch: aarch64
26+
version: 1
2527
steps:
26-
- uses: actions/checkout@v2
27-
- uses: julia-actions/setup-julia@v1
28+
- uses: actions/checkout@v4
29+
- uses: julia-actions/setup-julia@v2
2830
with:
2931
version: ${{ matrix.version }}
3032
arch: ${{ matrix.arch }}
31-
- uses: actions/cache@v1
32-
env:
33-
cache-name: cache-artifacts
34-
with:
35-
path: ~/.julia/artifacts
36-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
37-
restore-keys: |
38-
${{ runner.os }}-test-${{ env.cache-name }}-
39-
${{ runner.os }}-test-
40-
${{ runner.os }}-
33+
- uses: julia-actions/cache@v2
4134
- uses: julia-actions/julia-buildpkg@v1
4235
- uses: julia-actions/julia-runtest@v1
4336
- uses: julia-actions/julia-processcoverage@v1
44-
- uses: codecov/codecov-action@v1
37+
- uses: codecov/codecov-action@v5
4538
with:
46-
file: lcov.info
39+
files: lcov.info
40+
token: ${{ secrets.CODECOV_TOKEN }}
41+
docs:
42+
name: Documentation
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: julia-actions/julia-buildpkg@latest
47+
- uses: julia-actions/julia-docdeploy@latest
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

src/search.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ 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+
max_threads = @static VERSION >= v"1.9.0" ? Threads.maxthreadid() : Threads.nthreads()
26+
seen_sets = [BitVector(undef, length(data)) for _ in 1:max_threads]
27+
Threads.@threads :static for i in eachindex(queries) # :static needed to use threadid()
2728
# zero out seen
2829
seen = seen_sets[Threads.threadid()]
2930
seen .= false

0 commit comments

Comments
 (0)