File tree 4 files changed +29
-7
lines changed
4 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -27,5 +27,5 @@ Logging = "1"
27
27
Parameters = " 0.12, 0.13"
28
28
Pkg = " 1"
29
29
Sockets = " 1"
30
- ThreadPinning = " 0.7.22, 1"
30
+ ThreadPinning = " 1"
31
31
julia = " 1.10"
Original file line number Diff line number Diff line change @@ -5,12 +5,18 @@ import LinearAlgebra
5
5
import Distributed
6
6
import ThreadPinning
7
7
8
- # ThreadPinning.jl does not support all operating systems, currently:
9
- const _threadpinning_supported = isdefined (ThreadPinning, :affinitymask2cpuids )
8
+
9
+ # ThreadPinning.jl does not fully support all operating systems, currently:
10
+ const _threadpinning_supported = try
11
+ @assert convert (Int, ThreadPinning. getcpuid ()) isa Int
12
+ true
13
+ catch err
14
+ false
15
+ end
16
+
10
17
11
18
@static if _threadpinning_supported
12
19
13
-
14
20
function ParallelProcessingTools. _pinthreads_auto_impl (:: Val{true} )
15
21
pid = Distributed. myid ()
16
22
if Distributed. myid () == 1
@@ -22,7 +28,7 @@ function ParallelProcessingTools._pinthreads_auto_impl(::Val{true})
22
28
end
23
29
else
24
30
@debug " On process $pid , pinning threads according to affinity mask"
25
- let available_cpus = ThreadPinning . affinitymask2cpuids (ThreadPinning. get_affinity_mask ())
31
+ let available_cpus = _ThreadPinning . Utility . affinitymask2cpuids (ThreadPinning. getaffinity ())
26
32
ThreadPinning. pinthreads (:affinitymask )
27
33
LinearAlgebra. BLAS. set_num_threads (length (available_cpus))
28
34
end
32
38
33
39
ParallelProcessingTools. _getcpuids_impl (:: Val{true} ) = ThreadPinning. getcpuids ()
34
40
35
-
36
41
end # if _threadpinning_supported
37
42
38
43
end # module ChangesOfVariablesInverseFunctionsExt
Original file line number Diff line number Diff line change 3
3
import Test
4
4
5
5
import ThreadPinning
6
- ThreadPinning. Prefs. set_os_warning (false )
6
+
7
+ if isdefined (ThreadPinning, :Prefs )
8
+ ThreadPinning. Prefs. set_os_warning (false )
9
+ end
7
10
8
11
Test. @testset " Package ParallelProcessingTools" begin
9
12
@info " Testing with $(Base. Threads. nthreads ()) Julia threads."
@@ -21,6 +24,7 @@ Test.@testset "Package ParallelProcessingTools" begin
21
24
include (" test_procinit.jl" )
22
25
include (" test_workerpool.jl" )
23
26
include (" test_onworkers.jl" )
27
+ include (" test_ext_threadpinning.jl" )
24
28
include (" test_deprecated.jl" )
25
29
include (" test_docs.jl" )
26
30
end # testset
Original file line number Diff line number Diff line change
1
+ # This file is a part of ParallelProcessingTools.jl, licensed under the MIT License (MIT).
2
+
3
+ using ParallelProcessingTools
4
+ using Test
5
+
6
+ import ThreadPinning
7
+
8
+ @testset " ext_threadpinning" begin
9
+ ParallelProcessingToolsThreadPinningExt = Base. get_extension (ParallelProcessingTools, :ParallelProcessingToolsThreadPinningExt )
10
+ @test ParallelProcessingToolsThreadPinningExt isa Module
11
+
12
+ @test pinthreads_auto () isa Nothing
13
+ end
You can’t perform that action at this time.
0 commit comments