在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:JuliaParallel/Hwloc.jl开源软件地址:https://github.com/JuliaParallel/Hwloc.jl开源编程语言:Julia 100.0%开源软件介绍:Portable Hardware Locality (Hwloc)Hwloc.jl is a high-level wrapper of the hwloc library. It examines the current machine's hardware topology (memories, caches, cores, etc.) and provides Julia functions to visualize and access this information conveniently. Taken from the hwloc website:
UsagePerhaps the most important function is julia> using Hwloc
julia> topology()
Machine (16.0 GB)
Package L#0 P#0 (16.0 GB)
NUMANode (16.0 GB)
L3 (12.0 MB)
L2 (256.0 kB) + L1 (32.0 kB) + Core L#0 P#0
PU L#0 P#0
PU L#1 P#1
L2 (256.0 kB) + L1 (32.0 kB) + Core L#1 P#1
PU L#2 P#2
PU L#3 P#3
L2 (256.0 kB) + L1 (32.0 kB) + Core L#2 P#2
PU L#4 P#4
PU L#5 P#5
L2 (256.0 kB) + L1 (32.0 kB) + Core L#3 P#3
PU L#6 P#6
PU L#7 P#7
L2 (256.0 kB) + L1 (32.0 kB) + Core L#4 P#4
PU L#8 P#8
PU L#9 P#9
L2 (256.0 kB) + L1 (32.0 kB) + Core L#5 P#5
PU L#10 P#10
PU L#11 P#11 Often, one is only interested in a summary of this topology.
The function julia> topology_info()
Machine: 1 (16.0 GB)
Package: 1 (16.0 GB)
NUMANode: 1 (16.0 GB)
L3Cache: 1 (12.0 MB)
L2Cache: 6 (256.0 KB)
L1Cache: 6 (32.0 KB)
Core: 6
PU: 12 Obtaining particular information:Number of cores, NUMA nodes, and sockets
julia> num_physical_cores()
6
julia> num_virtual_cores()
12
julia> num_numa_nodes()
1
julia> num_packages()
1 One may also use julia> getinfo()
Dict{Symbol,Int64} with 8 entries:
:L2Cache => 6
:NUMANode => 1
:Core => 6
:Package => 1
:L1Cache => 6
:Machine => 1
:PU => 12
:L3Cache => 1 Cache propertiesAssuming that multiple caches of the same level (e.g. L1) have identical properties, one can use the convenience functions julia> cachesize()
(L1 = 32768, L2 = 262144, L3 = 12582912)
julia> cachelinesize()
(L1 = 64, L2 = 64, L3 = 64) Otherwise, there are the following more specific functions available: julia> @show Hwloc.l1cache_sizes();
@show Hwloc.l2cache_sizes();
@show Hwloc.l3cache_sizes();
Hwloc.l1cache_sizes() = [32768, 32768, 32768, 32768, 32768, 32768]
Hwloc.l2cache_sizes() = [262144, 262144, 262144, 262144, 262144, 262144]
Hwloc.l3cache_sizes() = [12582912] Manual accessTo manually traverse and investigate the system topology tree, one may use julia> topo = gettopology()
Hwloc.Object: Machine
julia> fieldnames(typeof(topo))
(:type_, :os_index, :name, :attr, :mem, :depth, :logical_index, :children, :memory_children)
julia> Hwloc.children(topo)
1-element Array{Hwloc.Object,1}:
Hwloc.Object: Package
julia> Hwloc.children(topo.children[1])
1-element Array{Hwloc.Object,1}:
Hwloc.Object: L3Cache
julia> l2cache = Hwloc.children(topo.children[1].children[1])[1]
Hwloc.Object: L2Cache
julia> Hwloc.attributes(l2cache)
Cache{size=262144,depth=2,linesize=64,associativity=4,type=Unified}
julia> l2cache |> print_topology
L2 (256.0 kB) + L1 (32.0 kB) + Core L#0 P#0
PU L#0 P#0
PU L#1 P#1 Topology elements of type julia> for obj in l2cache
@show hwloc_typeof(obj)
end
hwloc_typeof(obj) = :L2Cache
hwloc_typeof(obj) = :L1Cache
hwloc_typeof(obj) = :Core
hwloc_typeof(obj) = :PU
hwloc_typeof(obj) = :PU
julia> collect(obj for obj in l2cache)
5-element Array{Hwloc.Object,1}:
Hwloc.Object: L2Cache
Hwloc.Object: L1Cache
Hwloc.Object: Core
Hwloc.Object: PU
Hwloc.Object: PU
julia> count(hwloc_isa(:PU), l2cache)
2
julia> collectobjects(:PU, l2cache)
2-element Array{Hwloc.Object,1}:
Hwloc.Object: PU
Hwloc.Object: PU Manual topology queryOn the first call of |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论