将Ifort标志转换为Pgi Fortran标志

时间:2013-02-22 19:51:52

标签: compilation fortran

当我使用英特尔Fortran编译器和Portlan Group编译器编译它时,我从相同的代码得到不同的结果。 pgi Fortran中最接近ifort的-fp-model precise的旗帜是什么?
pgi中是否有一组与-O2 -fp-model precise ifort标志组合匹配的标志?
感谢

1 个答案:

答案 0 :(得分:3)

使用不同编译器(甚至同一编译器的不同版本)编译的程序预计不会产生完全相同的结果。不同级别的优化(-On标志)在编译器之间也不相同(-O0除外,它根本不请求优化)。

我认为PGI中的ifort -fp-model precise没有等效的标志,但您可能希望在PGI Fortran编译器的手册中查看特定于目标的标志,更具体地说,这些:

-K[no]ieee          Use IEEE division, optionally enable traps
-Ktrap=align|denorm|divz|fp|inexact|inv|none|ovf|unf
                    Determine IEEE Trap conditions
-M[no]daz           Treat denormalized numbers as zero
-M[no]flushz        Set SSE to flush-to-zero mode
-M[no]fpapprox[=div|sqrt|rsqrt]
                    Perform certain fp operations using low-precision approximation
    div             Approximate floating point division
    sqrt            Approximate floating point square root
    rsqrt           Approximate floating point reciprocal square root
    -Mfpapprox      Approximate div,sqrt,rsqrt
-M[no]fpmisalign    Allow use of vector arithmetic instructions for unaligned operands
-M[no]fprelaxed[=div|recip|sqrt|rsqrt|[no]order]
                    Perform certain fp operations using relaxed precision
    div             Perform divide with relaxed precision
    recip           Perform reciprocal with relaxed precision
    sqrt            Perform square root with relaxed precision
    rsqrt           Perform reciprocal square root with relaxed precision
    [no]order       Allow expression reordering, including factoring
    -Mfprelaxed     Choose which operations depending on target processor

程序的输出在不同编译器之间的某个不太重要的数字上是不同的是可接受的。如果您的结果非常不同,您的算法可能不是很强大,可能需要工作。