Hello, In the interest of fetching this information from Ansible for the GCC compile farm [1], I would like to determine the number of cores vs. hyper-threads on a system.
With OpenBSD 6.9, this is what I get with "sysctl hw" on a dual 6-core Xeon system: hw.model=Intel(R) Xeon(R) CPU E5-2640 0 @ 2.50GHz hw.ncpu=24 hw.ncpufound=24 hw.smt=0 hw.ncpuonline=12 Because SMT is disabled, I can guess that there are 12 cores (ncpuonline) and 24 threads (ncpu), which is good. However, if SMT is enabled, this "guess" no longer works: hw.ncpu=24 hw.ncpufound=24 hw.smt=1 hw.ncpuonline=24 Is there another method that always works? I could parse the output of dmesg, it would work on this system: # dmesg | grep smt cpu0: smt 0, core 0, package 0 ... cpu12: smt 1, core 0, package 0 ... However, parsing dmesg was removed from Ansible in 2016 because it was not considered reliable enough: https://github.com/ansible/ansible/commit/c17dad0def2fa86733c07610189e94486e056203 In addition, this method would only work on amd64/i386 (according to the comment added in this commit). Thanks, Baptiste [1] https://cfarm.tetaneutral.net
signature.asc
Description: PGP signature

