如何判断Linux机器是否支持AVX / AVX2指令?

时间:2022-09-17 23:09:55

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.

我在使用SUSE Linux Enterprise 10/11计算机。我将回归发送到运行英特尔处理器的计算机的农场。我的一些测试失败是因为我的工具是使用需要AVX / AVX2指令支持的库构建的。我收到了非法异常错误。

In Linux, is there any commands I can use to determine what is the CPU code/family name?

在Linux中,是否有任何命令可用于确定什么是CPU代码/系列名称?

I believe AVX and AVX2 are available onward from Intel SandyBridge and Haswell family, respectively.

我相信AVX和AVX2分别可以从Intel SandyBridge和Haswell系列开始。

4 个解决方案

#1


10  

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).

在linux(或unix机器)上,有关你的cpu的信息在/ proc / cpuinfo中。您可以手动或使用grep命令(grep flags / proc / cpuinfo)从那里提取信息。

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

大多数编译器也会自动定义__AVX2__,因此您也可以检查它。

#2


22  

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

标志: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


2  

You can test for availability of SIMD instruction sets and other CPU features by examining /proc/cpuinfo, e.g.

您可以通过检查/ proc / cpuinfo来测试SIMD指令集和其他CPU功能的可用性,例如:

$ grep avx2 /proc/cpuinfo
flags       : fpu vme ... sse4_1 sse4_2 ... bmi1 avx2 ... bmi2 ...

#4


1  

You can also run lscpu and check the list of instructions at the end.

您还可以运行lscpu并在最后检查指令列表。

#1


10  

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).

在linux(或unix机器)上,有关你的cpu的信息在/ proc / cpuinfo中。您可以手动或使用grep命令(grep flags / proc / cpuinfo)从那里提取信息。

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

大多数编译器也会自动定义__AVX2__,因此您也可以检查它。

#2


22  

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

标志: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


2  

You can test for availability of SIMD instruction sets and other CPU features by examining /proc/cpuinfo, e.g.

您可以通过检查/ proc / cpuinfo来测试SIMD指令集和其他CPU功能的可用性,例如:

$ grep avx2 /proc/cpuinfo
flags       : fpu vme ... sse4_1 sse4_2 ... bmi1 avx2 ... bmi2 ...

#4


1  

You can also run lscpu and check the list of instructions at the end.

您还可以运行lscpu并在最后检查指令列表。