-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Auto-generated wrappers + pylikwid features #10
Conversation
Disclaimer: this my first time wrapping a moderately complicated C library (beyond simple function calls etc.) 😄 typedef struct {
uint32_t numHWThreads; /*!< \brief Amount of active HW threads in the system (e.g. in cpuset) */
uint32_t activeHWThreads; /*!< \brief Amount of HW threads in the system and length of \a threadPool */
uint32_t numSockets; /*!< \brief Amount of CPU sockets/packages in the system */
uint32_t numDies; /*!< \brief Amount of CPU dies in the system */
uint32_t numCoresPerSocket; /*!< \brief Amount of physical cores in one CPU socket/package */
uint32_t numThreadsPerCore; /*!< \brief Amount of HW threads in one physical CPU core */
uint32_t numCacheLevels; /*!< \brief Amount of caches for each HW thread and length of \a cacheLevels */
HWThread* threadPool; /*!< \brief List of all HW thread descriptions */
CacheLevel* cacheLevels; /*!< \brief List of all caches in the hierarchy */
struct treeNode* topologyTree; /*!< \brief Anchor for a tree structure describing the system topology */
} CpuTopology; Julia struct: struct CpuTopology
numHWThreads::UInt32
activeHWThreads::UInt32
numSockets::UInt32
numDies::UInt32
numCoresPerSocket::UInt32
numThreadsPerCore::UInt32
numCacheLevels::UInt32
threadPool::Ptr{HWThread}
cacheLevels::Ptr{CacheLevel}
topologyTree::Ptr{treeNode}
end Should be correct, no? However, we get incorrect numbers when julia> LIKWID.init_topology();
julia> LIKWID.get_cpu_topology() # essentially ccall + unsafe_load
Dict{String, Any} with 7 entries:
"numSockets" => 2
"numHWThreads" => 40
"numCoresPerSocket" => 1
"numCacheLevels" => 20422880
"activeHWThreads" => 40
"numDies" => 20
"numThreadsPerCore" => 3 Note that the python pendant in pylikwid gets the correct numbers: >>> d["numSockets"]
2
>>> d["numHWThreads"]
40
>>> d["numCoresPerSocket"]
20
>>> d["numCacheLevels"]
3
>>> d["activeHWThreads"]
40
>>> d["numThreadsPerCore"]
1 What's going on? |
Note for future self, current output: julia> LIKWID.get_cpu_info()
LIKWID.CpuInfo
├ family: 6
├ model: 85
├ stepping: 4
├ vendor: 0
├ part: 0
├ clock: 0
├ turbo: true
├ osname: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
├ name: Intel Skylake SP processor
├ short_name: skylakeX
├ features: FP ACPI MMX SSE SSE2 HTT TM RDTSCP MONITOR VMX EIST TM2 SSSE FMA SSE4.1 SSE4.2 AES AVX RDRAND HLE AVX2 RTM AVX512 RDSEED SSE3
├ isIntel: true
├ architecture: x86_64
├ supportUncore: false
├ supportClientmem: false
├ featureFlags: 4328456191
├ perf_version: 4
├ perf_num_ctr: 8
├ perf_width_ctr: 48
└ perf_num_fixed_ctr: 3
julia> LIKWID.get_cpu_topology()
LIKWID.CpuTopology
├ numHWThreads: 40
├ activeHWThreads: 40
├ numSockets: 2
├ numCoresPerSocket: 20
├ numThreadsPerCore: 1
├ numCacheLevels: 3
├ threadPool: ... (40 elements)
└ cacheLevels: ... (3 elements)
julia> LIKWID.get_numa_topology().nodes[2]
LIKWID.NumaNode
├ id: 1
├ totalMemory: 94.48 GB
├ freeMemory: 85.26 GB
├ numberOfProcessors: 20
├ processors: [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]
├ numberOfDistances: 2
└ distances: [21, 10]
|
Codecov Report
@@ Coverage Diff @@
## main #10 +/- ##
==========================================
- Coverage 50.00% 44.37% -5.63%
==========================================
Files 2 19 +17
Lines 22 1386 +1364
==========================================
+ Hits 11 615 +604
- Misses 11 771 +760
Continue to review full report at Codecov.
|
@vchuravy I'd like to merge this to then set up documentation (Documenter.jl) directly on master. Any objections? |
Given that this PR is a strict (significant) improvement, I'll take the liberty to merge so that I can continue to work on things. Let's dicuss / improve (if necessary revert) things in separate issues / PRs. (I won't tag a new release soon). |
In this WIP PR I try to work towards the goal of reaching feature parity with pylikwid (#5).
pylikwid repository / README
likwid.h
(LibLikwid.jl
).Closes #5
Closes #2