How to tell if a Linux machine supports AVX

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.

asked May 27, 2016 at 9:40

Run this command:

grep avx /proc/cpuinfo

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

answered May 27, 2016 at 9:43

1 gold badge21 silver badges26 bronze badges

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.

answered May 27, 2016 at 9:56

5 gold badges28 silver badges38 bronze badges

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

answered Jun 28, 2018 at 22:08

1 silver badge4 bronze badges

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

answered May 27, 2016 at 9:44

36 gold badges386 silver badges556 bronze badges

I like to use this command: lscpu

answered Oct 13, 2022 at 21:01

Advanced Vector Extensions (AVX, also known as Sandy Bridge New Extensions) are extensions to the x86 instruction set architecture for microprocessors from Intel and AMD proposed by Intel in March 2008 and first supported by Intel with the Sandy Bridge processor shipping in Q1 2011 and later on by AMD with the Bulldozer processor shipping in Q3 2011. AVX provides new features, new instructions, and a new coding scheme.

Читать также:  В программе архивации данных произошла ошибка во время записи данных в целевое расположение

How to tell if a Linux machine supports AVX

CMD Error “Your CPU Supports Instructions”

What Causes this Warning?

In particular, the AVX introduced the FMA (Fused multiply-add); which is the floating-point multiply-add operation, and this all operation is done in a single step. This helps speed up many operations without any problem. It makes the algebra computation more fast and easy use, also the dot-product, matrix multiply, convolution, etc. And these are all the most used and basic operations for every machine-learning training. The CPUs that support the AVX and FMA will be far faster than the older ones. But the warning states that your CPU supports AVX, so it’s a good point.

How to tell if a Linux machine supports AVX

Intel AVX Technology

Why it isn’t used by default?

That is because the TensorFlow default distribution is built without the CPU extensions. By CPU extensions it states the AVX, AVX2, FMA, etc. The instructions which trigger this issue are not enabled by default on the available default builds. The reasons they are not enabled is to make this more compatible with as many CPUs as possible. Also to compare these extensions, they are a lot slower in CPU rather than GPU. CPU is used on the small-scale machine-learning while the use of GPU is expected when it is used for a medium or large-scale machine-learning training.

Fixing the Warning!

These warnings are just simple messages. The purpose of these warnings is to inform you about the built TensorFlow from source.  When you build the TensorFlow from the source it can be faster on the machine. So all these warnings are telling you about is the build up TensorFlow from source.

If you have a GPU on your machine, then you can ignore these warnings from AVX support. Because most expensive ones will be dispatched on a GPU device. And if you want to not see this error anymore, you can just simply ignore it by adding this:

Читать также:  Сравнительный анализ развития жилищно-коммунального хозяйства России и Казахстана

import the OS module in your main program code and also set the mapping object for it

But if you are on a Unix, then use the export command in bash shell

But if don’t have GPU, and you want to use your CPU as much as possible, you should build TensorFlow from the source optimized for your CPU with AVX, AVX2, and FMA enabled here.

Kevin Arrows

Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.

Если ваш процессор не поддерживает AVX, при попытке запустить игру, для которой требуется AVX, игра не запустится, и вы увидите сообщение об ошибке, подобное приведенному ниже.

«Ваш процессор должен поддерживать инструкции AVX для запуска этой игры».

«Обнаружено неподдерживаемое оборудование. Для запуска этой игры требуется процессор, поддерживающий набор инструкций AVX».

«Фатальная ошибка. Ошибка запуска приложения. Пожалуйста, проверьте системные требования. (AVX)».

«Минимальные требования не выполнены. Предупреждение. Ваша система не соответствует минимальным требованиям. Для получения оптимальной производительности обратитесь к списку поддерживаемого оборудования. Требуются следующие наборы инструкций ЦП: AVX».

Примечание. Игра может вылететь даже без каких-либо сообщений об ошибках.

Перед покупкой игры с требованиями AVX целесообразно проверить, поддерживает ли ее ваш процессор.

Вы можете использовать бесплатное программное обеспечение, чтобы проверить это. Вы можете установить его, выполнив следующие действия. Затем используйте его, чтобы убедиться, что ваш процессор поддерживает AVX.

What is this warning about?

Modern CPUs provide a lot of low-level instructions, besides the usual arithmetic and logic, known as extensions, e.g. SSE2, SSE4, AVX, etc. From the Wikipedia:

Читать также:  Программа для проверки системных ошибок на андроид

Advanced Vector Extensions (AVX) are extensions to the x86 instruction
set architecture for microprocessors from Intel and AMD proposed by
Intel in March 2008 and first supported by Intel with the Sandy
Bridge processor shipping in Q1 2011 and later on by AMD with the
Bulldozer processor shipping in Q3 2011. AVX provides new features,
new instructions and a new coding scheme.

In particular, AVX introduces fused multiply-accumulate (FMA) operations, which speed up linear algebra computation, namely dot-product, matrix multiply, convolution, etc. Almost every machine-learning training involves a great deal of these operations, hence will be faster on a CPU that supports AVX and FMA (up to 300%). The warning states that your CPU does support AVX (hooray!).

I’d like to stress here: it’s all about CPU only.

Why isn’t it used then?

Because tensorflow default distribution is built without CPU extensions, such as SSE4.1, SSE4.2, AVX, AVX2, FMA, etc. The default builds (ones from pip install tensorflow) are intended to be compatible with as many CPUs as possible. Another argument is that even with these extensions CPU is a lot slower than a GPU, and it’s expected for medium- and large-scale machine-learning training to be performed on a GPU.

What should you do?

If you have a GPU, you shouldn’t care about AVX support, because most expensive ops will be dispatched on a GPU device (unless explicitly set not to). In this case, you can simply ignore this warning by

If you don’t have a GPU and want to utilize CPU as much as possible, you should build tensorflow from the source optimized for your CPU with AVX, AVX2, and FMA enabled if your CPU supports them. It’s been discussed in this question and also this GitHub issue. Tensorflow uses an ad-hoc build system called bazel and building it is not that trivial, but is certainly doable. After this, not only will the warning disappear, tensorflow performance should also improve.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *