Linux check whether hyperthreading is enabled or not
There parameters need to be obained: no. of physical CPU; no. of cores on each CPU; no. of all threads.
In my case, the CPU name: Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
(1) Check the number of physical CPU
# cat /proc/cpuinfo | grep "physical id" | sort | uniq
physical id : 0
physical id : 1
//// Here we can see the number of physical CPU is 2. Each physical CPU has its own fan.
(2) Check the number of logical cores on each CPU
# cat /proc/cpuinfo | grep "cores" | uniq
cpu cores : 10
//// Here each physical CPU has 10 cores.
(3) Check the number of all threads
# cat /proc/cpuinfo | grep "processor" | wc -l
40
//// After obtaining above three parameters, now we can judge whether the hyperthreading is enabled or not.
In the case withou hyperthreading, number of all threads= no. of physical CPU * no. of cores on each CPU * 1, then there is only one thread on each core.
When hyperthreading is enabled, for example, N threads are available on each core. Then the following relationship can be achived:
number of all threads= no. of physical CPU * no. of cores on each CPU * N.
NOTE: OpenMP
The OpenMP parallel language can also be used to check the number of threads per core.
#include "stdio.h"
#include "omp.h" int main()
{
int num_thread, myid; #pragma omp parallel
{
num_threads= omp_get_num_threads(); // get the total number of threads on one core
myid= omp_get_thread_num(); // get the ID of the current thread
printf("\nHello world from the thread %d out of %d threads!");
}
return ;
}
Use the following command to compile the C file "hello.c":
$ gcc -fopenmp -o run.o hello.c
$ ./run.o
Linux check whether hyperthreading is enabled or not的更多相关文章
- 【小错误】SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
1.今天在scott用户下执行语句跟踪时报了如下错误: SCOTT@ORA11GR2>set autotrace on SP2: Cannot find the Session Identifi ...
- Oracle set autotrace 时提示:Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SQL> set autotrace Usage: SET AUTOT[RACE] {OFF | ON | TRACE[ONLY]} [EXP[LAIN]] [STAT[ISTICS]] SQL ...
- SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled 今天是2013-09-17,在今天学习sql ...
- 【ORACLE错误】SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
执行set autotrace traceonly的时候,报错 SQL> set autotrace traceonly SP2-0618: Cannot find the Session Id ...
- Linux: Check version info
一.查看Linux内核版本命令(两种方法): 1.cat /proc/version [root@localhost ~]# cat /proc/version Linux version 2.6.1 ...
- linux check
建议安装chkrootkit.rkhunter.Lynis.ISPProtect这类安全工具,定期做扫描
- [转载] 构造linux 系统下免密码ssh登陆 _How to establish password-less login with SSH
In present (post production) IT infrastructure many different workstations, servers etc. have to be ...
- Understanding Linux /proc/cpuinfo
http://www.richweb.com/cpu_info A hyperthreaded processor has the same number of function units as a ...
- 用于软件包管理的21个Linux YUM命令 转载
http://flycars001.iteye.com/blog/1949085 YUM到底是啥东东? YUM(Yellowdog Updater Modified)是一款开源命令行及图形化软件包管理 ...
随机推荐
- mysql主从同步碰到的问题
一.mysql 安装https://www.cnblogs.com/jxrichar/p/9248480.html二.主从配置参考https://www.cnblogs.com/superfat/p/ ...
- 816D.Karen and Test 杨辉三角 规律 组合
LINK 题意:给出n个数,每个数对间进行加或减,结果作为下一层的数,问最后的值为多少 思路:首先我们发现很像杨辉三角,然后考虑如何计算每个数对结果的贡献值,找规律可以发现当数的个数为偶数时,其所在层 ...
- jQuery代码优化:基本事件
jQuery对事件系统的抽象与优化也是它的一大特色.本文仅从事件系统入手,简要分析一下jQuery为什么提供mouseenter和mouseleave事件,它们与标准的mouseover.mouseo ...
- [Swing]树形结构的实现
一般步骤: 1.建立根节点 private DefaultMutableTreeNode root = new DefaultMutableTreeNode("根节点"); 2.建 ...
- Redhat 7 之 Mariadb(mysql)
Redhat7 之后mysql 改为Mariadba,由于mysql 被卖给了IBM, 有闭源的风险. 所以就另外开了一个新的分支,继续开源.Maria 来源于mysql开发者的女儿的名字. 1. 安 ...
- 【CodeForces】704 B. Ant Man
[题目]B. Ant Man [题意]给定n个人的xi,ai,bi,ci,di,起点为s,终点为e,移动: In simpler words, jumping from i-th chair to j ...
- 【洛谷 P4166】 [SCOI2007]最大土地面积(凸包,旋转卡壳)
题目链接 又调了我两个多小时巨亏 直接\(O(n^4)\)枚举4个点显然不行. 数据范围提示我们需要一个\(O(n^2)\)的算法. 于是\(O(n^2)\)枚举对角线,然后在这两个点两边各找一个点使 ...
- VC拷贝字符串到剪切板
] ="中华人民共和国"; DWORD dwLength = ; // 要复制的字串长度 HANDLE hGlobalMemory = GlobalAlloc(GHND, dwLe ...
- three.js_camera相机
https://blog.csdn.net/yangnianbing110/article/details/51275927 文章地址
- hibernate CasCade deleted object ould be re-saved by cascade
这个问题个人认为看你用的那种方式,如果是注解式的 比如: @ManyToMany(cascade={CascadeType.MERGE,CascadeType.REFRESH,CascadeType. ...