GCC与多种架构兼容的最高指令集

sty*_*yko 5 c gcc cpu-architecture

我是一个具有不同体系结构的机器组成的集群上运行的作业: gcc -march=native -Q --help=target | grep -- '-march=' | cut -f3给我的其中之一:broadwellhaswellivybridgesandybridgeskylake

可执行文件必须是相同的,所以我不能使用,-march=native但是同时架构具有共同点(我认为它们都支持AVX?)。

I am aware that gcc (contrary to Intel icc) does not allow for multiple archictures in a single executable. What I would like to know is if there is a way to ask gcc for the highest set of instructions compatible with all the architectures listed above.

gcc version: 8.1.1

Gos*_*low 1

我想知道是否有一种方法可以向 gcc 询问与上面列出的所有体系结构兼容的最高指令集。

那是不。

如果您想要最佳性能,请查看胖二进制文件,正如 Saner De Dycker 评论的那样。

另一种解决方案是为每个指令集编译二进制文件和库,并在每个系统上设置 PATH 和 LD_LIBRARY_PATH 以选择最佳指令集。