2013-02-22 52 views
1

當我使用英特爾Fortran編譯器和Portlan組編譯器進行編譯時,我得到的代碼不同。什麼是pgi Fortran中最靠近-fp-model precise if flag的標誌?
在pgi中是否有一組標誌可以匹配-O2 -fp-model precise ifort標誌的組合?
謝謝將Ifort標誌轉換爲Pgi Fortran標誌

回答

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 

程序的輸出在不同編譯器之間的某些不太重要的數字上是不同的。如果你的結果非常不同,你的算法可能不是很健壯,可能需要工作。