Internals
This section isn't part of the official API. Things might change at any point without further notice.
Utility
ThreadPinning.Utility.BLAS_lib — Method
Returns the name of the loaded BLAS library (the first, if multiple are loaded).
ThreadPinning.Utility._execute — Method
Run a Cmd object, returning the stdout & stderr contents plus the exit code
ThreadPinning.Utility.affinitymask2cpuids — Method
Turn the affinity mask (a vector of ones and zeros) into a vector of CPU IDs.
ThreadPinning.Utility.cpuids2affinitymask — Method
Turn the vector of CPU IDs into an affinity mask (a vector of ones and zeros).
ThreadPinning.Utility.nblasthreads — Method
Number of BLAS threads.
ThreadPinning.Utility.taskid — Method
Returns a (most likely) unique id for the calling task.
MKL
ThreadPinning.MKL.mkl_fullpath — Method
Returns the full path to the libmkl_rt library if the latter is loaded. Will try to locate the library and, if successfull, will cache the result. Throws an error otherwise.
To force an update of the cache, provide force_update=true.
ThreadPinning.MKL.mkl_get_dynamic — Method
mkl_get_dynamic()Wrapper around the MKL function mkl_get_dynamic.
ThreadPinning.MKL.mkl_is_loaded — Method
Check whether Intel MKL is currently loaded via libblastrampoline
ThreadPinning.MKL.mkl_set_dynamic — Method
mkl_set_dynamic(flag::Integer)Wrapper around the MKL function mkl_set_dynamic.
Faking (Test Systems)
ThreadPinning.Faking.isfaking — Method
Are we currently in fake mode?
ThreadPinning.Faking.start — Method
start(system_name)Start faking being on the given system.
ThreadPinning.Faking.stop — Method
stop()Stop faking.
ThreadPinning.Faking.with — Method
with(f, system_name)Fake running f on the given system.
Example
with("PerlmutterComputeNode") do
threadinfo()
endExample
julia> using ThreadPinning
julia> threadinfo(; color=false) # host system
Hostname: login01
CPU(s): 2 x Intel(R) Xeon(R) Gold 6226R CPU @ 2.90GHz
CPU target: cascadelake
Cores: 32 (32 CPU-threads)
NUMA domains: 4 (8 cores each)
Julia threads: 5
CPU socket 1
_,_,_,3,_,9,10,_,_,_,_,_,12,_,_,_
CPU socket 2
_,_,_,_,_,_,_,_,_,_,_,_,_,29,_,_
# = Julia thread, # = >1 Julia thread
(Mapping: 1 => 3, 2 => 29, 3 => 9, 4 => 12, 5 => 10, ...)
julia> ThreadPinning.Faking.start("PerlmutterComputeNode") # <----- Start Faking
[ Info: Using backend hwloc.
julia> threadinfo(; color=false) # fake system
Hostname: PerlmutterComputeNode
CPU(s): 2 x AMD EPYC 7763 64-Core Processor
CPU target: znver3
Cores: 128 (256 CPU-threads due to 2-way SMT)
NUMA domains: 8 (16 cores each)
Julia threads: 5
CPU socket 1
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,140, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, 36,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_
CPU socket 2
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, 99,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, 118,246, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_
# = Julia thread, # = Julia thread on HT, # = >1 Julia thread
(Mapping: 1 => 140, 2 => 246, 3 => 118, 4 => 36, 5 => 99, ...)
julia> pinthreads(:cores) # fake pinning
julia> threadinfo(; color=false) # fake system
Hostname: PerlmutterComputeNode
CPU(s): 2 x AMD EPYC 7763 64-Core Processor
CPU target: znver3
Cores: 128 (256 CPU-threads due to 2-way SMT)
NUMA domains: 8 (16 cores each)
Julia threads: 5
CPU socket 1
0,_, 1,_, 2,_, 3,_, 4,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_
CPU socket 2
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_,
_,_, _,_, _,_, _,_, _,_, _,_, _,_, _,_
# = Julia thread, # = Julia thread on HT, # = >1 Julia thread
(Mapping: 1 => 0, 2 => 1, 3 => 2, 4 => 3, 5 => 4, ...)
julia> ThreadPinning.Faking.stop() # <----- Stop Faking
julia> threadinfo(; color=false) # host system
Hostname: login01
CPU(s): 2 x Intel(R) Xeon(R) Gold 6226R CPU @ 2.90GHz
CPU target: cascadelake
Cores: 32 (32 CPU-threads)
NUMA domains: 4 (8 cores each)
Julia threads: 5
CPU socket 1
_,_,_,3,_,9,10,_,_,_,_,_,12,_,_,_
CPU socket 2
_,_,_,_,_,_,_,_,_,_,_,_,_,29,_,_
# = Julia thread, # = >1 Julia thread
(Mapping: 1 => 3, 2 => 29, 3 => 9, 4 => 12, 5 => 10, ...)