问题
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.
回答1:
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.
回答2:
Run this command:
grep avx /proc/cpuinfo
Or
grep avx2 /proc/cpuinfo
This will give you:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx avx2 hypervisor lahf_lm arat tsc_adjust xsaveopt
回答3:
You can also run lscpu
and check the list of instructions at the end.
回答4:
You can test for availability of SIMD instruction sets and other CPU features by examining /proc/cpuinfo
, e.g.
$ grep avx2 /proc/cpuinfo
flags : fpu vme ... sse4_1 sse4_2 ... bmi1 avx2 ... bmi2 ...
来源:https://stackoverflow.com/questions/37480071/how-to-tell-if-a-linux-machine-supports-avx-avx2-instructions