1

同じコードを Intel Fortran コンパイラーと Portlan Group コンパイラーでコンパイルすると、異なる結果が得られます。pgi Fortran-fp-model preciseで ifort に最も近いフラグは何ですか? ifort フラグ
の組み合わせに一致する一連のフラグが pgi にありますか? ありがとう-O2 -fp-model precise

4

1 に答える 1

3

Programs compiled with different compilers (or even different versions of the same compiler) are not expected to produce exactly the same results. Different levels of optimization (-On flag) are also not equivalent between compilers (except -O0 which requests no optimization at all).

I do not think there is an equivalent flag in PGI to ifort's -fp-model precise, but you may want to look into target-specific flags in the manual for PGI Fortran compiler, and more specifically, these:

-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

It is acceptable for the program's output to be different at some less significant digit between different compilers. If your results are very different, your algorithm might not be very robust and may need work.

于 2013-02-22T21:39:00.967 に答える