且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-11-11 07:51:27

在Linux(或UNIX机器)上,有关CPU的信息位于/proc/cpuinfo中.您可以手动或使用grep命令(grep flags /proc/cpuinfo)从那里提取信息.

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

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

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