小编Bow*_*ens的帖子

-march native 如何影响浮点精度?

我编写的代码中有大量的浮点运算。我们有测试用例来记录给定输入的输出,并验证我们不会对结果进行太多更改。我建议我启用 -march native 以提高性能。然而,启用该功能后,我们会遇到测试失败的情况,因为结果发生了变化。由于访问由 -march native 启用的更现代的硬件而将使用的指令是否会减少浮点错误量?增加浮点误差量?或者两者兼而有之?融合乘法加法应该可以减少浮点错误量,但这是否是随时间添加的指令的典型情况?或者是否添加了一些说明,虽然效率更高,但准确性较低?

我的目标平台是 x86_64 Linux。处理器信息根据/proc/cpuinfo是:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 85
model name  : Intel(R) Xeon(R) Gold 6152 CPU @ 2.10GHz
stepping    : 4
microcode   : 0x2006a0a
cpu MHz     : 2799.999
cache size  : 30976 KB
physical id : 0
siblings    : 44
core id     : 0
cpu cores   : 22
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level …
Run Code Online (Sandbox Code Playgroud)

c c++ floating-point precision x86-64

6
推荐指数
2
解决办法
470
查看次数

标签 统计

c ×1

c++ ×1

floating-point ×1

precision ×1

x86-64 ×1