how to find out intel architecture family from command line
Solution 1
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
but my pc runs with an amd buldozer processor
Solution 2
This data is stored in PMU_NAME, just type:
cat /sys/devices/cpu/caps/pmu_name
haswell
Solution 3
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.
Solution 4
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"
Solution 5
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.
Related videos on Youtube
a curious engineer
Updated on September 18, 2022Comments
-
a curious engineer over 1 year
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?
-
Mingye Wang over 8 years
/proc/cpuinfo
actually gives the model name likeIntel (R) blah blah blah GHz
, you should google it directly. -
a curious engineer over 8 yearsI was asking for architecture family
-
Gilles 'SO- stop being evil' over 8 yearsI don't think the “architecture family” is reported, they're just commercial names. You get the model name in
/proc/cpuinfo
, I think it's up to you to translate that into the corresponding family name. -
Mingye Wang over 8 years@Ijustwanttocode You have to use some kind of table to look up those commercial names.
-
-
erik over 8 yearsTo 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/…
-
AJN over 6 yearsyour solution answers the question. It works for me.
-
Tyilo over 6 yearsThis 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. -
Panayotis about 6 yearsIt works and does what @erik suggested!
-
Eric over 5 yearsgcc8 can identify skylake as such whereas gcc5 identifies as broadwell, indeed.
-
ChrisW over 4 yearsThis 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.
-
ChrisW over 4 yearsA disadvantage is, that it requires 'pup' to be installed. After installing pup, it still fails without completing the script. Tested on GRML in 2019.
-
Tyilo over 4 yearsIt is indeed true that this doesn't work anymore. There doesn't seem to be an easy way to fix this.
-
Tyilo over 4 yearsThis gives
skylake
on my machine, whereas Intel's site says it iskaby lake
: ark.intel.com/content/www/us/en/ark/products/97185/… says -
Reuben Thomas about 4 yearsNote that this file does not exist on AMD machines.
-
Nate Eldredge about 4 years@Tyilo: Similar for me: an i7-8565U is reported as "skylake" whereas Intel says "Whiskey Lake".
-
Lizardx over 3 yearsWhat 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.