使用gfortran而不是ifort进行编译

时间:2012-11-11 20:30:55

标签: gfortran intel-fortran

我有一个针对ifort优化的程序,但是我想用gfortran编译它。以下是提供的标志:

FCFLAGS=  -Vaxlib -CB -mcmodel=large -O -openmp -DOMP

我已经看过手册条目,试图找到相应的选项,但是我找不到任何东西(除了-openmp for -fopenmp,我已经知道了)。

1 个答案:

答案 0 :(得分:3)

这是一个选项等价表选项:

ifort          gfortran         Commentary
-----------------------------------------------------------------------
-Vaxlib                         Enables old VAX library compatibility
                                (should not be necessary with gfortran
                                 and newer ifort versions)
-CB            -fbounds-check   Enables array bounds check at run-time
-mcmode=large  -mcmodel=large   Enables large memory model
-O             -O2              Enables optimisaiton
-openmp        -fopenmp         Enables OpenMP support
-DOMP          -DOMP            Preprocessor option (defines the OMP symbol)

请注意,启用边界检查和大内存模型会降低代码执行速度。另请注意,-O单独使用ifort(相当于-O2)和gfortran(相当于-O1)可以实现不同级别的优化。另请注意,ifortgfortran更具侵略性。您可能需要提供更多选项来对后者进行微调,以达到与ifort相同的性能。