how to find out intel architecture family from command line

46,574

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.

Share:
46,574

Related videos on Youtube

a curious engineer
Author by

a curious engineer

Updated on September 18, 2022

Comments

  • a curious engineer
    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
      Mingye Wang over 8 years
      /proc/cpuinfo actually gives the model name like Intel (R) blah blah blah GHz, you should google it directly.
    • a curious engineer
      a curious engineer over 8 years
      I was asking for architecture family
    • Gilles 'SO- stop being evil'
      Gilles 'SO- stop being evil' over 8 years
      I 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
      Mingye Wang over 8 years
      @Ijustwanttocode You have to use some kind of table to look up those commercial names.
  • erik
    erik over 8 years
    To 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
    AJN over 6 years
    your solution answers the question. It works for me.
  • Tyilo
    Tyilo over 6 years
    This doesn't work for me as it returns broadwell instead of kabylake. This is probably because my version of gcc doesn't distinguish those two families when generating assembly.
  • Panayotis
    Panayotis about 6 years
    It works and does what @erik suggested!
  • Eric
    Eric over 5 years
    gcc8 can identify skylake as such whereas gcc5 identifies as broadwell, indeed.
  • ChrisW
    ChrisW over 4 years
    This 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
    ChrisW over 4 years
    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.
  • Tyilo
    Tyilo over 4 years
    It is indeed true that this doesn't work anymore. There doesn't seem to be an easy way to fix this.
  • Tyilo
    Tyilo over 4 years
    This gives skylake on my machine, whereas Intel's site says it is kaby lake : ark.intel.com/content/www/us/en/ark/products/97185/… says
  • Reuben Thomas
    Reuben Thomas about 4 years
    Note that this file does not exist on AMD machines.
  • Nate Eldredge
    Nate Eldredge about 4 years
    @Tyilo: Similar for me: an i7-8565U is reported as "skylake" whereas Intel says "Whiskey Lake".
  • Lizardx
    Lizardx over 3 years
    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.