I get access to some xeon machines for checking performance. I want to find out what architecture they are using such as Haswell, Sandybridge , Ivybridge. Is there a command to find this out?
8 Answers
It's a bit of a cheap workaround but you could get that info from gcc
!
I'll explain : gcc
is able to optimize binaries for each subarch with the -march
option. Moreover, it is able to detect yours and automatically optimize for your machine with -march=native
Assuming so, you just have to call gcc
with march=native
and ask it what flags it would use :
in short
gcc -march=native -Q --help=target|grep march
for me it gives
-march= bdver1
since my pc runs with an amd buldozer processor
-
1
-
1This doesn't work for me as it returns
broadwell
instead ofkabylake
. This is probably because my version of gcc doesn't distinguish those two families when generating assembly.– TyiloJan 13, 2018 at 5:35 -
1gcc8 can identify skylake as such whereas gcc5 identifies as broadwell, indeed.– EricAug 12, 2018 at 17:00
This data is stored in PMU_NAME, just type:
cat /sys/devices/cpu/caps/pmu_name
haswell
-
2This is really the easiest solution and I believe the best answer, as it does not require any additional commands (like gcc or pup) to be installed and it gives a clean output of just the name of the microarchitecture, which can be used directly in a script.– ChrisWDec 24, 2019 at 10:01
-
3This gives
skylake
on my machine, whereas Intel's site says it iskaby lake
: ark.intel.com/content/www/us/en/ark/products/97185/… says– TyiloDec 26, 2019 at 16:58 -
8
-
2@Tyilo: Similar for me: an i7-8565U is reported as "skylake" whereas Intel says "Whiskey Lake". Apr 23, 2020 at 1:10
-
What this returns is I believe the gcc/clang march/mtune compiler flags. For example: march=skylake -mtune=skylake is from comet lake. en.wikichip.org/wiki/intel/microarchitectures/comet_lake inxi -Cx will attempt to show microarchitecture, but it uses a manually compiled table to generate the microarchitecture name, which can sometimes be ambiguous. Which means, always use the latest git inxi if you want this data to reflect latest known IDs and matches.– LizardxNov 18, 2020 at 21:12
You probably can't because those are marketing names for commercial sale, not the "technical" name.
You can, however, obtain what you need from dmidecode and then visit http://ark.intel.com (for your Xeon processor) to determine the commercial family.
[root@mediasrv ~]# dmidecode|grep -i intel
Socket Designation: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
Manufacturer: Intel
Version: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
From that output, I could visit Intel's ark website and search for the 3770 CPU, which would tell me I have an Ivy Bridge chip.
-
2To do it automated with a script i would use dmidecode or /proc/cpuinfo and combine it with grep or awk or perl and the printable version of the xeon cpu list on wikipedia which you get with curl or wget: en.wikipedia.org/w/…– erikSep 19, 2015 at 22:23
Note: This script doesn't work anymore. Intel's search URL has changed.
Below is a bash script that automatically finds the architecture code name for your CPU using /proc/cpuinfo
and https://ark.intel.com/.
To work it requires that you have pup installed.
Running the code on my computer I get the following result:
$ ./intel_codename
Processor name: i7-7700HQ
Kaby Lake
#!/bin/bash
set -euo pipefail
if [[ $# == 0 ]]; then
modelname=$(cat /proc/cpuinfo | grep 'model name' | head -1)
if ! grep Intel <<<"$modelname" > /dev/null; then
echo "You don't seem to have an Intel processor" >&2
exit 1
fi
name=$(sed 's/.*\s\(\S*\) CPU.*/\1/' <<<"$modelname")
echo "Processor name: $name" >&2
else
name=$1
fi
links=($(curl --silent "https://ark.intel.com/search?q=$name" | pup '.result-title a attr{href}'))
results=${#links[@]}
if [[ $results == 0 ]]; then
echo "No results found" >&2
exit 1
fi
link=${links[0]}
if [[ $results != 1 ]]; then
echo "Warning: $results results found" >&2
echo "Using: $link" >&2
fi
url="https://ark.intel.com$link"
codename=$(curl --silent "$url" | pup '.CodeNameText .value text{}' | xargs | sed 's/Products formerly //')
echo "$codename"
-
-
my /proc/cpuinfo contains "model name : Intel(R) Xeon(R) CPU @ 2.00GHz", so this script doesn't work Dec 12, 2019 at 20:40
-
A disadvantage is, that it requires 'pup' to be installed. After installing pup, it still fails without completing the script. Tested on GRML in 2019.– ChrisWDec 24, 2019 at 10:06
-
It is indeed true that this doesn't work anymore. There doesn't seem to be an easy way to fix this.– TyiloDec 26, 2019 at 16:55
On the cloud none of the above answers work for me. I have a model name of "Intel(R) Xeon(R) CPU @ 2.00GHz", dmidecode tells me that Google made the processors, et cetera.
/proc/cpuinfo "cpu family" and "model" help quite a bit. They're unique for almost all combinations and can be looked up on https://en.wikichip.org/wiki/intel/cpuid. However family 6 model 85 is both skylake and cascade lake.
Attempted to fix the script that @Tyilo posted earlier. The updated version is below.
#!/bin/bash
set -euo pipefail
if [[ $# == 0 ]]; then
modelname=$(cat /proc/cpuinfo | grep 'model name' | head -1)
if ! grep Intel <<<"$modelname" > /dev/null; then
echo "You don't seem to have an Intel processor" >&2
exit 1
fi
name=$(sed 's/.*CPU\s\(.*\)\s\(@\).*/\1/' <<<"$modelname")
echo "Processor name: $name" >&2
name=${name// /'%20'}
else
name=$1
fi
links=($(curl --silent "https://ark.intel.com/content/www/us/en/ark/search.html?_charset_=UTF-8&q=$name" | pup '#FormRedirectUrl attr{value}'))
results=${#links[@]}
if [[ $results == 0 ]]; then
echo "No results found" >&2
exit 1
fi
link=${links[0]}
if [[ $results != 1 ]]; then
echo "Warning: $results results found" >&2
echo "Using: $link" >&2
fi
url="https://ark.intel.com$link"
codename=$(curl --silent "$url" | pup 'span[data-key="CodeNameText"] text{}' | xargs | sed 's/Products formerly //')
echo "$codename"
Running the updated script on my server I get the following result:
$ ./intel_codename
Processor name: E3-1225 v5
Skylake
Not an expert at all. Just learned how to use curl and pup in the last hour or so. Didn't test it on others except my own machine.
Update: Did some more testing. The script should work for Xeon Processor family. However it breaks (showing No results found) if Intel Ark database query returns multiple results. For example for Xeon Platinum 8260, it will return 8260 and all its variants such as 8260M. Also, if the name (processor numbering) happens to be used in other products or key data fields, multiple results will be returned from the query and the script won't find the result. It also breaks for those version 0 processor, such as Xeon E5-2690 0.
For Intel Core Processor family (i7, i5, etc), you need to replace sed command with the original one by @Tyilo, see below.
name=$(sed 's/.*\s\(\S*\) CPU.*/\1/' <<<"$modelname")
Again, if query returns multiple results. This simple script won't be able to parse correct and yields No results found.
I'm currently working in server land. My script works on at least more recent servers. To differentiate between skylake and cascade lake servers is not pretty... it uses the /proc/cpuinfo 'model name' field to tease out skylake vs cascade lake.
#!/bin/bash
# cascade lake 2nd gen stuff from https://www.intel.com/content/www/us/en/products/docs/processors/xeon/2nd-gen-xeon-scalable-spec-update.html
# 2nd gen xeon scalable cpus: cascade lake sku is 82xx, 62xx, 52xx, 42xx 32xx W-32xx from https://www.intel.com/content/www/us/en/products/docs/processors/xeon/2nd-gen-xeon-scalable-spec-update.html
# skylake 1st gen stuff from https://www.intel.com/content/www/us/en/processors/xeon/scalable/xeon-scalable-spec-update.html
# 1st gen xeon scalable cpus: 81xx, 61xx, 51xx, 81xxT, 61xxT 81xxF, 61xxF, 51xx, 41xx, 31xx, 51xxT 41xxT, 51xx7,
CPU_NAME=`cat /proc/cpuinfo | awk '
function decode_fam_mod(vndor, fam, mod, mod_nm) {
if (vndor == "GenuineIntel") {
# cpuid tables from https://en.wikichip.org/wiki/intel/cpuid
dcd[1,1]="Ice Lake"; dcd[1,2] ="Family 6 Model 108";
dcd[2,1]="Ice Lake"; dcd[2,2] ="Family 6 Model 106";
dcd[3,1]="Cascade Lake/Skylake"; dcd[3,2] ="Family 6 Model 85"; # 06_55h Intel always does the hex fam_model
dcd[4,1]="Broadwell"; dcd[4,2] ="Family 6 Model 79"; # 06_4fh
dcd[5,1]="Broadwell"; dcd[5,2] ="Family 6 Model 86"; # 06_56h
dcd[6,1]="Haswell"; dcd[6,2] ="Family 6 Model 63"; # 06_3fh
dcd[7,1]="Ivy Bridge"; dcd[7,2] ="Family 6 Model 62";
dcd[8,1]="Sandy Bridge"; dcd[8,2] ="Family 6 Model 45"; # 06_2dh
dcd[9,1]="Westmere"; dcd[9,2] ="Family 6 Model 44";
dcd[10,1]="EX"; dcd[10,2]="Family 6 Model 47";
dcd[11,1]="Nehalem"; dcd[11,2]="Family 6 Model 46";
dcd[12,1]="Lynnfield"; dcd[12,2]="Family 6 Model 30";
dcd[13,1]="Bloomfield, EP, WS"; dcd[13,2]="Family 6 Model 26";
dcd[14,1]="Penryn"; dcd[14,2]="Family 6 Model 29";
dcd[15,1]="Harpertown, QC, Wolfdale, Yorkfield"; dcd[15,2]="Family 6 Model 23";
str = "Family " fam " Model " mod;
#printf("str= %s\n", str);
res=" ";
for(k=1;k <=15;k++) { if (dcd[k,2] == str) {res=dcd[k,1];break;}}
if (k == 3) {
# so Cooper Lake/Cascade Lake/SkyLake)
if (match(mod_nm, / [86543]2[0-9][0-9]/) > 0) { res="Cascade Lake";} else
if (match(mod_nm, / [86543]1[0-9][0-9]/) > 0) { res="Skylake";}
}
return res;
}
}
/^vendor_id/ {
vndr=$(NF);
}
/^cpu family/ {
fam=$(NF);
}
/^model/ {
if ($2 == ":") {
mod=$(NF);
}
}
/^model name/ {
#model name : Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
n=split($0, arr, ":");
mod_nm = arr[2];
#printf("vndr= %s, fam= %s, mod= %s, mod_nm= %s\n", vndr, fam, mod, mod_nm);
cpu_name=decode_fam_mod(vndr, fam, mod, mod_nm);
printf("%s\n", cpu_name);
exit;
}
'`
echo "cpu uarch= $CPU_NAME"
This doesn't handle the client cpus... but it should be relatively straight forward to take the client cpuid info from WikiChip and expand the list.
I have an AMD processor. This command helped me:
sudo dmidecode -t 4
In particular, here's what you need I think:
sudo dmidecode -t 4 | grep -i family
My result is:
Family: Zen
Signature: Family 23, Model 24, Stepping 1
/proc/cpuinfo
actually gives the model name likeIntel (R) blah blah blah GHz
, you should google it directly./proc/cpuinfo
, I think it's up to you to translate that into the corresponding family name.