user4979733 user4979733 - 6 months ago 28
Linux Question

Linux: How to tell if a machine supports AVX/AVX2 instructions?

I'm on SUSE Linux Enterprise 10/11 machines. I launch my regressions to a farm of machines running Intel processors. Some of my tests fail because my tools are built using a library which requires AVX/AVX2 instruction support. I get an

Illegal exception
error. In Linux, is there any commands I can use to determine what is the CPU code/family name? I believe AVX and AVX2 are available onward from Intel SandyBridge and Haswell family, respectively.

Answer

On linux (or unix machines) the information about your cpu is in /proc/cpuinfo. You can extract information from there by hand, or with a grep command (grep flags /proc/cpuinfo).

Also most compilers will automatically define __AVX2__ so you can check for that too.