Closed cmcaine closed 3 years ago
This works for me. I wrote some tests too, but I can't get them to reliably fail on the old build of Nauty, so 🤷
Here's the test:
using LightGraphs
using Nauty
using Test
function dowork()
g = LightGraphs.barabasi_albert(63, 5)
Nauty.baked_canonical_form(g).canong
end
[fetch(Threads.@spawn dowork()) for _ in 1:10000]
# This line won't be executed if something above segfaults.
@test true
The idea is that you run that from the existing test file with:
using PerformanceTestTools: @include_foreach
@testset "Threading tests" begin
# This starts a new Julia process with 10 threads, includes the test file
# and checks that its exit code is zero (success).
@include_foreach("threading-test.jl", [["JULIA_NUM_THREADS" => "10"]])
end
I made some silly mistakes when testing the threading code. These new commits include working tests which should reliably fail on builds without thread local storage.
The benchmark is 10-15% slower on my system when thread local storage is enabled.
Fixes #5