如何用Linux的命令正确识别cpu的个数和核数
如何用Linux的命令正確識別cpu的個數和核數
分類: 科學技術:分布式系統、算法數據結構、網絡科學、機器學習等 2012-01-30 12:28 7786人閱讀 評論(0) 收藏 舉報 linuxexceptioncache64bitsocketaix 判斷依據:1.具有相同core id的cpu是同一個core的超線程。
2.具有相同physical id的cpu是同一顆cpu封裝的線程或者cores。
英文版:
1.Physical id and core id are not necessarily consecutive but they are unique. Any cpu with the same core id are hyperthreads in the same core.
2.Any cpu with the same physical id are threads or cores in the same physical socket.
查看當前操作系統內核信息
# uname -a
Linux redcat 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 05:23:09 UTC 2010 i686 GNU/Linux
查看當前操作系統發行版信息
#cat /etc/issue
Ubuntu 9.10 \n \l
查看cpu型號
# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
2? Intel(R) Core(TM)2 Duo CPU???? P8600? @ 2.40GHz
(看到有2個邏輯CPU, 也知道了CPU型號)
查看物理cpu顆數
# cat /proc/cpuinfo | grep physical | uniq -c
2 physical id?? ?: 0(說明實際上是1顆2核的CPU)
查看cpu運行模式
# getconf LONG_BIT
32
(說明當前CPU運行在32bit模式下, 但不代表CPU不支持64bit)
查看cpu是否支持64bit
# cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l
2
(結果大于0, 說明支持64bit計算. lm指long mode, 支持lm則是64bit)
查看cpu信息概要(昨天看aix的時候剛發現的,在ubuntu上竟然也有~):
#lscpu
Architecture:????????? i686??????????????????????????? #架構686
CPU(s):??????????????? 2?????????????????????????????????? #邏輯cpu顆數是2
Thread(s) per core:??? 1?????????? ? ? ? ? ? ? ? ? #每個核心線程數是1 ???????????????
Core(s) per socket:??? 2?????????????????????????? #每個cpu插槽核數/每顆物理cpu核數是2
CPU socket(s):???????? 1??????????????????????????? #cpu插槽數是1
Vendor ID:???????????? GenuineIntel?????????? #cpu廠商ID是GenuineIntel
CPU family:??????????? 6????????????????????????????? #cpu系列是6
Model:???????????????? 23??????????????????????????????? #型號23
Stepping:????????????? 10????????????????????????????? #步進是10
CPU MHz:?????????????? 800.000???????????????? #cpu主頻是800MHz
Virtualization:??????? VT-x???????????????????????? #cpu支持的虛擬化技術VT-x(對此在下一博文中解釋下http://hi.baidu.com/sdusoul/blog/item/5d8e0488def3a998a5c272c0.html)
L1d cache:???????????? 32K???????????????????????? #一級緩存32K(google了下,這具體表示表示cpu的L1數據緩存為32k)
L1i cache:???????????? 32K????????????????????????? #一級緩存32K(具體為L1指令緩存為32K)
L2 cache:????????????? 3072K????????????????????? #二級緩存3072K
最后來個大而全的:
#cat /proc/cpuinfo
processor??? : 0
vendor_id??? : GenuineIntel
cpu family??? : 6
model??? ??? : 23
model name??? : Intel(R) Core(TM)2 Duo CPU???? P8600? @ 2.40GHz
stepping??? : 10
cpu MHz??? ??? : 800.000
cache size??? : 3072 KB
physical id??? : 0
siblings??? : 2
core id??? ??? : 0
cpu cores??? : 2
apicid??? ??? : 0
initial apicid??? : 0
fdiv_bug??? : no
hlt_bug??? ??? : no
f00f_bug??? : no
coma_bug??? : no
fpu??? ??? : yes
fpu_exception??? : yes
cpuid level??? : 13
wp??? ??? : yes
flags??? ??? : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm ida tpr_shadow vnmi flexpriority
bogomips??? : 4788.60
clflush size??? : 64
power management:
processor??? : 1
vendor_id??? : GenuineIntel
cpu family??? : 6
model??? ??? : 23
model name??? : Intel(R) Core(TM)2 Duo CPU???? P8600? @ 2.40GHz
stepping??? : 10
cpu MHz??? ??? : 800.000
cache size??? : 3072 KB
physical id??? : 0
siblings??? : 2
core id??? ??? : 1
cpu cores??? : 2
apicid??? ??? : 1
initial apicid??? : 1
fdiv_bug??? : no
hlt_bug??? ??? : no
f00f_bug??? : no
coma_bug??? : no
fpu??? ??? : yes
fpu_exception??? : yes
cpuid level??? : 13
wp??? ??? : yes
flags??? ??? : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm ida tpr_shadow vnmi flexpriority
bogomips??? : 4787.96
clflush size??? : 64
power management:
總結
以上是生活随笔為你收集整理的如何用Linux的命令正确识别cpu的个数和核数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Ubuntu终端远程连接计算机(Linu
- 下一篇: 监督学习 | 朴素贝叶斯原理及Pytho