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)是一款开源命令行及图形化软件包管理 ...
随机推荐
- CSS进阶知识
html { -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; } 该属性的作用是 ...
- HDU 1394 Minimum Inversion Number (树状数组)
题目链接 Problem Description The inversion number of a given number sequence a1, a2, ..., an is the numb ...
- 爬虫实战--基于requests 和 Beautiful的7160美图网爬取图片
import requests import os from bs4 import BeautifulSoup import re # 初始地址 all_url = 'http://www.7160. ...
- zedboard学习记录.2.PS+PL 流水灯与uart
1.建立一个工程. 硬件设计 2.IP integrator -> create block desgin;Run Block Automation. 3.add IP -> AXI GP ...
- 一键切图 PS 动作 【收藏】
使用方法 一键切图动作.zip 1. 下载动作 2. 打开PS 动作 窗口,导入动作 3. 选中图层后 点击 F2 一键切图 详情看原文链接 原文链接
- 对RSA的认识
#没有经过专业老师的指导,所以您在阅读本文时建议参考即可. 学习视屏:https://www.youtube.com/watch?v=TqX0AHHwRYQ https://www.youtub ...
- flask插件系列之SQLAlchemy基础使用
sqlalchemy是一个操作关系型数据库的ORM工具.下面研究一下单独使用和其在flask框架中的使用方法. 直接使用sqlalchemy操作数据库 安装sqlalchemy pip install ...
- openjudge-NOI 2.6-2000 最长公共子上升序列
题目链接:http://noi.openjudge.cn/ch0206/2000/ 题解: 裸题,不解释(题目有毒) #include<cstdio> #include<algori ...
- js中的cookie使用和vue-cookie的使用
在HTTP协议的定义中,采用了一种机制来记录客户端和服务器端交互的信息,这种机制被称为cookie,cookie规范定义了服务器和客户端交互信息的格式.生存期.使用范围.安全性. 在JavaScrip ...
- OpenCV3学习笔记
http://blog.csdn.net/u010429424/article/details/73691001 http://blog.csdn.net/zhaoxfxy/article/detai ...