Skip to content

Compiling with -march=native breaks the build (was ACTS-384)

Original author Hadrien Benjamin Grasland @hgraslan

By default, GCC produces programs that are compatible with a very wide set of machines, and does so by refraining from using newer backwards-incompatible CPU features, such as advanced vector instructions.

This setting is appropriate for software that is distributed in binary form to a wide audience, where maximal CPU compatibility is desired. But it also means that the full potential of the host CPU is not leveraged. By setting the "march" build flag, one can tell GCC that the binary only needs to be compatible with a smaller set of CPUs, "native" being the CPU of the build host. This setting is thus more appropriate when benchmarking software performance, where re-building is not an issue.

However, currently, setting march=native breaks the ACTS build (with tests and examples failing in various ways) on my Haswell CPU. This shouldn't happen, and warrants further investigation. It might be the sign of a subtle bug that only manifests when certain CPU architecture features are used.

Edited by Moritz Kiehn
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information